|
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 e
Length: 3020 (0xbcc) Types: TextFile Names: »entry_dump.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0 └─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z« └─⟦de7628f85⟧ └─⟦this⟧ »isode-6.0/quipu/entry_dump.c«
/* entry_dump.c - routines to dump the database */ #ifndef lint static char *rcsid = "$Header: /f/osi/quipu/RCS/entry_dump.c,v 7.0 89/11/23 22:17:31 mrose Rel $"; #endif /* * $Header: /f/osi/quipu/RCS/entry_dump.c,v 7.0 89/11/23 22:17:31 mrose Rel $ * * * $Log: entry_dump.c,v $ * Revision 7.0 89/11/23 22:17:31 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 <errno.h> #include "tailor.h" extern LLog * log_dsap; extern RDN parse_rdn; extern char * new_version(); static header_print (psa,edb) PS psa; Entry edb; { switch (edb->e_data) { case E_DATA_MASTER: ps_print (psa,"MASTER\n"); break; case E_TYPE_SLAVE : ps_print (psa,"SLAVE\n"); break; default: ps_print (psa,"CACHE\n"); break; } if (edb->e_parent != NULLENTRY) ps_printf (psa,"%s\n",edb->e_parent->e_edbversion); else ps_printf (psa,"%s\n",new_version()); } static entry_print (psa,entryptr) PS psa; Entry entryptr; { if (entryptr == NULLENTRY) return; rdn_print (psa,entryptr->e_name,EDBOUT); parse_rdn = entryptr->e_name; ps_print (psa,"\n"); as_print (psa,entryptr->e_attributes,EDBOUT); parse_rdn = NULLRDN; } static entry_block_print (psa,block) PS psa; Entry block; { Entry ptr; if (block != NULLENTRY) { header_print (psa,block); for ( ptr = block; ptr != NULLENTRY; ptr = ptr->e_sibling) { entry_print (psa,ptr); ps_print (psa,"\n"); } } } write_edb (ptr,filename) Entry ptr; char * filename; { int um; FILE * fptr; PS entryps; extern char * parse_file; extern int errno; um = umask (0177); if ((fptr = fopen (filename,"w")) == (FILE *) NULL) { LLOG (log_dsap,LLOG_EXCEPTIONS,("file_open failed: \"%s\" (%d)",filename,errno)); return NOTOK; } (void) umask (um); if ((entryps = ps_alloc (std_open)) == NULLPS) { LLOG (log_dsap,LLOG_EXCEPTIONS,("ps_alloc failed")); (void) fclose (fptr); return NOTOK; } if (std_setup (entryps,fptr) == NOTOK) { LLOG (log_dsap,LLOG_EXCEPTIONS,("std_setup failed")); (void) fclose (fptr); return NOTOK; } parse_file = filename; entry_block_print (entryps,ptr); if (entryps->ps_errno != PS_ERR_NONE) { LLOG (log_dsap,LLOG_EXCEPTIONS,("write_edb ps error: %s",ps_error(entryps->ps_errno))); (void) fclose (fptr); return NOTOK; } ps_free (entryps); if (fflush (fptr) != 0) { LLOG (log_dsap,LLOG_EXCEPTIONS,("write_edb flush error: %d",errno)); return NOTOK; } if (fsync (fileno(fptr)) != 0) { LLOG (log_dsap,LLOG_EXCEPTIONS,("write_edb fsync error: %d",errno)); return NOTOK; } if (fclose (fptr) != 0) { LLOG (log_dsap,LLOG_EXCEPTIONS,("write_edb EDB close error: %d",errno)); return NOTOK; } LLOG (log_dsap,LLOG_NOTICE,("Written %s",filename)); return (OK); }