/* * Template for using the doubly linked list. * The dll_dbg.h header is not actually used in * the code below; however, this could be one way * that a debugging version could be implemented. * For a more complete example of how to use the * doubly linked list refer to the documentation * and source code in the distribution package. */ #include #include #ifdef DEBUG # include /* For debug only */ #else # include /* For production */ #endif typedef struct name_addr /* Sample data * structure */ { char name[30]; char street[40]; char city[22]; char state[3]; char zip[11]; } NameAddr; void main(void) { List *NAList = NULL; DLL_Return DLL_Exit; if(DLL_CreateList(&NAList) == NULL) { fputs("Fatal Memory error", stderr); exit(EXIT_FAILURE); } if((DLL_Exit = DLL_InitializeList(NAList, sizeof(NameAddr))) != DLL_NORMAL) { (void)(DLL_Exit == DLL_ZERO_INFO && fputs( "Size of address record is zero.\n\n", stderr)); (void)(DLL_Exit == DLL_NULL_LIST && fputs( "NAList points to a NULL address.\n\n", stderr)); exit(EXIT_FAILURE); } DoYourThingHere(NAList); DLL_DestroyList(&NAList); exit(EXIT_SUCCESS); }