1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #ifndef lint
   8: char copyright[] =
   9: "@(#) Copyright (c) 1980 Regents of the University of California.\n\
  10:  All rights reserved.\n";
  11: #endif not lint
  12: 
  13: #ifndef lint
  14: static char sccsid[] = "@(#)printenv.c	5.1 (Berkeley) 5/31/85";
  15: #endif not lint
  16: 
  17: /*
  18:  * printenv
  19:  *
  20:  * Bill Joy, UCB
  21:  * February, 1979
  22:  */
  23: 
  24: extern  char **environ;
  25: 
  26: main(argc, argv)
  27:     int argc;
  28:     char *argv[];
  29: {
  30:     register char **ep;
  31:     int found = 0;
  32: 
  33:     argc--, argv++;
  34:     if (environ)
  35:         for (ep = environ; *ep; ep++)
  36:             if (argc == 0 || prefix(argv[0], *ep)) {
  37:                 register char *cp = *ep;
  38: 
  39:                 found++;
  40:                 if (argc) {
  41:                     while (*cp && *cp != '=')
  42:                         cp++;
  43:                     if (*cp == '=')
  44:                         cp++;
  45:                 }
  46:                 printf("%s\n", cp);
  47:             }
  48:     exit (!found);
  49: }
  50: 
  51: prefix(cp, dp)
  52:     char *cp, *dp;
  53: {
  54: 
  55:     while (*cp && *dp && *cp == *dp)
  56:         cp++, dp++;
  57:     if (*cp == 0)
  58:         return (*dp == '=');
  59:     return (0);
  60: }

Defined functions

main defined in line 26; never used
prefix defined in line 51; used 1 times
  • in line 36

Defined variables

copyright defined in line 8; never used
sccsid defined in line 14; never used
Last modified: 1985-05-31
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 828
Valid CSS Valid XHTML 1.0 Strict