!<arch> Islprepend 418431515 968 27 100644 67 ` 10th 1st 2nd 3rd 4th 5th 6th 7th 8th 9th AAA aaa Aaa BBB bbb Bbb Oslprepend 418431515 968 27 100644 78 ` Bbb bbb BBB Aaa aaa AAA 9th 8th 7th 6th 5th 4th 3rd 2nd 1st 10th maxkey = 4 Tslprepend.c 418431515 968 27 100644 621 ` /* * slinit() * slprepend() */ #include <stdio.h> #include "null.h" #include "slist.h" #define KEYSIZE 10 char *PGN = "Tslprepend"; main() { char key[KEYSIZE]; /* key to be added */ char *gets(); /* get a line from stdin */ char *slprepend(); /* prepend key */ SLBLK *curblk; /* current list block */ SLIST *slinit(); /* initialize list */ SLIST *slist; /* pointer to list head block */ slist = slinit(); while (gets(key) != NULL) slprepend(key, slist); for (curblk = slist->head; curblk != NULL; curblk = curblk->next) puts(curblk->key); printf("maxkey = %d\n", slist->maxkey); exit(0); }