/* * This file contains the linked list routines that are necessary to control * the objects from the objects.C source file * * The print routines have been moved to seperate files. * */ #include "objects.h" void initobjlist(void) { ohead = (objlist *) malloc(sizeof(objlist)); sprintf(ohead->type,"%s","AAAA"); sprintf(ohead->ipaddr,"%s","AAAA"); sprintf(ohead->netmask,"%s","AAAA"); sprintf(ohead->gateways,"%s","AAAA"); sprintf(ohead->broadcast,"%s","AAAA"); otail = (objlist *) malloc(sizeof(objlist)); sprintf(otail->type,"%s","ZZZZ"); sprintf(otail->ipaddr,"%s","ZZZZ"); sprintf(otail->netmask,"%s","ZZZZ"); sprintf(otail->gateways,"%s","ZZZZ"); sprintf(otail->broadcast,"%s","ZZZZ"); /* tail has no links */ otail->nodelink = NULL; /* point head at tail */ ohead->nodelink = otail; /* intilize head and tail counters */ ohead->objcount = -1; otail->objcount = MAXOBJECTS; otail->nodelink = NULL; ohead->nodelink = otail; } void find_group(char *grpname) { /* pointer used to traverse objects structure, looking for * grpname passed in from dumpnetobj() */ objlist *obj; /* start both off at the top of the structure */ obj = ohead->nodelink; while(obj->nodelink != NULL) { if((obj->objname != NULL) && (strcmp(obj->objname,grpname) == 0)) { printf("%16s%16s ",obj->ipaddr,obj->netmask); return; } obj = obj->nodelink; } }