int main (int argc,char * argv []) { datum cle; datum donnee; int i; int numero; if (argc < 2) { fprintf (stderr, "Syntaxe : %s nom_base clés...\n", argv [0]); exit (1); } if (dbminit (argv [1]) != 0) { perror ("dbminit"); exit (1); } for (i = 2; i < argc; i ++) { if (sscanf (argv [i], "%d", & numero) == 1) { cle . dptr = (char *) (& numero); cle . dsize = sizeof (int); donnee = fetch (cle); if (donnee . dptr != NULL) affiche_contributeur (cle, donnee); else fprintf (stderr, "%s : inconnu\n", argv [i]); } } dbmclose (); return (0); }
void makedbz(char *histpath, long entry) { long size; size = dbzsize(entry); dbzfresh(histpath, size, '\t', 0, 1); dbmclose(); }
/* ** Close the history files. */ void HISclose() { if (HISwritefp != NULL) { /* * Since dbmclose calls dbzsync we could replace this line * with "HISdirty = 0;". Oh well, it keeps the abstraction * clean. */ HISsync(); if (dbmclose() < 0) syslog(LOG_ERR, "%s cant dbmclose %m", LogName); if (fclose(HISwritefp) == EOF) syslog(LOG_ERR, "%s cant fclose history %m", LogName); HISwritefp = NULL; if (close(HISreadfd) < 0) syslog(LOG_ERR, "%s cant close history %m", LogName); HISreadfd = -1; } }