1: /*
   2:  * Copyright (c) 1988 Regents of the University of California.
   3:  * All rights reserved.
   4:  *
   5:  * Redistribution and use in source and binary forms are permitted
   6:  * provided that this notice is preserved and that due credit is given
   7:  * to the University of California at Berkeley. The name of the University
   8:  * may not be used to endorse or promote products derived from this
   9:  * software without specific prior written permission. This software
  10:  * is provided ``as is'' without express or implied warranty.
  11:  */
  12: 
  13: #if !defined(lint) && defined(DOSCCS)
  14: char copyright[] =
  15: "@(#) Copyright (c) 1988 Regents of the University of California.\n\
  16:  All rights reserved.\n";
  17: 
  18: static char sccsid[] = "@(#)praliases.c	5.3.1 (2.11BSD) 1996/10/24";
  19: #endif
  20: 
  21: #include <sendmail.h>
  22: 
  23: typedef struct {
  24:     char *dptr;
  25:     int dsize;
  26: } datum;
  27: 
  28: 
  29: main(argc, argv)
  30:     char **argv;
  31: {
  32:     extern char *optarg;
  33:     extern int optind;
  34:     static char *filename = "/etc/aliases";
  35:     datum content, key, firstkey(), nextkey(), fetch();
  36:     int ch;
  37: 
  38:     while ((ch = getopt(argc, argv, "f:")) != EOF)
  39:         switch((char)ch) {
  40:         case 'f':
  41:             filename = optarg;
  42:             break;
  43:         case '?':
  44:         default:
  45:             fputs("usage: praliases [-f file]\n", stderr);
  46:             exit(EX_USAGE);
  47:         }
  48:     argc -= optind;
  49:     argv += optind;
  50: 
  51:     if (dbminit(filename) < 0)
  52:         exit(EX_OSFILE);
  53:     if (!argc)
  54:         for (key = firstkey(); key.dptr; key = nextkey(key)) {
  55:             content = fetch(key);
  56:             printf("%s:%s\n", key.dptr, content.dptr);
  57:         }
  58:     else for (; *argv; ++argv) {
  59:         key.dptr = *argv;
  60:         key.dsize = strlen(*argv) + 1;
  61:         content = fetch(key);
  62:         if (!content.dptr)
  63:             printf("%s: No such key\n", key.dptr);
  64:         else
  65:             printf("%s:%s\n", key.dptr, content.dptr);
  66:     }
  67:     exit(EX_OK);
  68: }

Defined functions

main defined in line 29; never used

Defined variables

copyright defined in line 14; never used
sccsid defined in line 18; never used
Last modified: 1996-10-25
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2504
Valid CSS Valid XHTML 1.0 Strict