1: # include "postbox.h"
   2: 
   3: static char SccsId[] =  "@(#)showdbm.c	4.1	7/25/83";
   4: 
   5: typedef struct { char *dptr; int dsize; } datum;
   6: datum   firstkey(), nextkey(), fetch();
   7: char    *filename = ALIASFILE;
   8: 
   9: main(argc, argv)
  10:     char **argv;
  11: {
  12:     datum content, key;
  13: 
  14:     if (argc > 2 && strcmp(argv[1], "-f") == 0)
  15:     {
  16:         argv++;
  17:         filename = *++argv;
  18:         argc -= 2;
  19:     }
  20: 
  21:     if (dbminit(filename) < 0)
  22:         exit(EX_OSFILE);
  23:     argc--, argv++;
  24:     if (argc == 0) {
  25:         for (key = firstkey(); key.dptr; key = nextkey(key)) {
  26:             content = fetch(key);
  27:             printf("\n%s:%s\n", key.dptr, content.dptr);
  28:         }
  29:         exit(EX_OK);
  30:     }
  31:     while (argc) {
  32:         key.dptr = *argv;
  33:         key.dsize = strlen(*argv)+1;
  34:         content = fetch(key);
  35:         if (content.dptr == 0)
  36:             printf("%s: No such key\n");
  37:         else
  38:             printf("\n%s:%s\n", key.dptr, content.dptr);
  39:         argc--, argv++;
  40:     }
  41:     exit(EX_OK);
  42: }

Defined functions

main defined in line 9; never used

Defined variables

SccsId defined in line 3; never used
filename defined in line 7; used 2 times
Last modified: 1987-02-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1953
Valid CSS Valid XHTML 1.0 Strict