|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T p
Length: 4426 (0x114a) Types: TextFile Names: »parse2.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0 └─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z« └─⟦de7628f85⟧ └─⟦this⟧ »isode-6.0/quipu/parse2.c«
/* parse2.c - */ #ifndef lint static char *rcsid = "$Header: /f/osi/quipu/RCS/parse2.c,v 7.2 90/01/11 18:37:23 mrose Exp $"; #endif /* * $Header: /f/osi/quipu/RCS/parse2.c,v 7.2 90/01/11 18:37:23 mrose Exp $ * * * $Log: parse2.c,v $ * Revision 7.2 90/01/11 18:37:23 mrose * real-sync * * Revision 7.1 89/12/19 16:20:42 mrose * sync * * Revision 7.0 89/11/23 22:17:57 mrose * Release 6.0 * */ /* * NOTICE * * Acquisition, use, and distribution of this module and related * materials are subject to the restrictions of a license agreement. * Consult the Preface in the User's Manual for the full terms of * this agreement. * */ #include "quipu/util.h" #include "quipu/entry.h" #include "cmd_srch.h" Entry getentry_block_aux (), get_entry_aux(); extern LLog * log_dsap; char * getline (); rdn_print (); int master_edbs = 0; int slave_edbs = 0; Entry getentry_block (p_parent,fname) Entry p_parent; char * fname; { return getentry_block_aux (p_parent,fname, fopen (fname, "r")); } Entry getentry_block_aux (p_parent,fname,file) Entry p_parent; char * fname; FILE *file; { extern char * parse_file; extern int parse_status; extern int parse_line; Entry entryptr; int dtype; char *version; Entry get_entries_aux (); extern int errno; if (file == NULL) { LLOG (log_dsap,LLOG_NOTICE,("WARNING - Can't open \"%s\" (%d)- should I be able to ?",fname,errno)); return (NULLENTRY); } LLOG (log_dsap,LLOG_NOTICE,("Loading \"%s\"",fname)); parse_status = 0; parse_line = 0; parse_file = fname; if (get_header (file,&dtype,&version) != OK) { parse_line = 0; parse_error ("File %s not loaded",fname); parse_file = NULLCP; (void) fclose (file); return (NULLENTRY); } entryptr = get_entries_aux (file,p_parent,version,dtype); if ((parse_status != 0) || (entryptr == NULLENTRY)) { parse_line = 0; parse_error ("File %s not loaded",fname); parse_file = NULLCP; (void) fclose (file); return (NULLENTRY); } if ( p_parent != NULLENTRY ) { p_parent->e_edbversion = version; if ((dtype == E_DATA_MASTER) || (dtype == E_TYPE_SLAVE)) p_parent->e_allchildrenpresent = TRUE; } parse_file = NULLCP; if (dtype == E_DATA_MASTER) master_edbs++; if (dtype == E_TYPE_SLAVE) slave_edbs++; (void) fclose (file); return (entryptr); } get_header (file,typeptr,versionptr) FILE * file; int * typeptr; char ** versionptr; { char * ptr; static CMD_TABLE cmd_header [] = { "MASTER", E_DATA_MASTER, "SLAVE", E_TYPE_SLAVE, "CACHE", E_TYPE_CACHE_FROM_MASTER, 0, -1, }; if ((ptr = getline (file)) == NULLCP) { parse_error ("NULL file !!!",NULLCP); return (NOTOK); } if ((*typeptr = cmd_srch (ptr,cmd_header)) == -1) { parse_error ("File type %s not recognised",ptr); return (NOTOK); } if ((ptr = getline (file)) == NULLCP) { parse_error ("No version specified",NULLCP); return (NOTOK); } *versionptr = strdup (ptr); return (OK); } /* ARGSUSED */ Entry get_entries_aux (file,parent,version,dtype) FILE * file; Entry parent; char * version; int dtype; { Entry eptr = NULLENTRY; Entry top = NULLENTRY; Entry trail; Entry find_sibling(); #ifdef TURBO_LOAD if ( ! turbo_start(file)) { parse_error ("Turbo load failed",NULLCP); return NULLENTRY; } #endif while (feof(file) == 0) { if ((eptr = get_entry_aux (file,parent,dtype)) == NULLENTRY) continue; if ( top == NULLENTRY) { top = eptr; trail = eptr; } else { #ifdef TURBO_LOAD if ( turbo_insert(eptr->e_name) != OK ) #else if (find_sibling (eptr->e_name,top) != NULLENTRY) #endif { pslog (log_dsap,LLOG_EXCEPTIONS,"Duplicate entry for",rdn_print,(caddr_t)eptr->e_name); parse_error ("Non Unique RDN",NULLCP); } trail->e_sibling = eptr; trail = eptr; } } #ifdef TURBO_LOAD turbo_end(); #endif return (top); } Entry get_entries (file,parent,version,dtype) FILE * file; Entry parent; char * version; int dtype; { extern int parse_status; extern int parse_line; parse_status = 0; parse_line = 0; return (get_entries_aux (file,parent,version,dtype)); } Entry find_sibling (object,start) RDN object; Entry start; { if (start == NULLENTRY) return (NULLENTRY); while (rdn_cmp (start->e_name, object) != OK) { start = start->e_sibling ; if ( start == NULLENTRY ) return (NULLENTRY); } return (start); }