1: # include "dlvrmail.h"
2:
3: static char sccsid[] = "@(#)showdbm.c 2.1 11/5/80";
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