1: #ifndef lint
   2: static char *sccsid = "@(#)printenv.c	4.1 (Berkeley) 10/2/80";
   3: #endif
   4: 
   5: /*
   6:  * printenv
   7:  *
   8:  * Bill Joy, UCB
   9:  * February, 1979
  10:  */
  11: 
  12: extern  char **environ;
  13: 
  14: main(argc, argv)
  15:     int argc;
  16:     char *argv[];
  17: {
  18:     register char **ep;
  19:     int found = 0;
  20: 
  21:     argc--, argv++;
  22:     if (environ)
  23:         for (ep = environ; *ep; ep++)
  24:             if (argc == 0 || prefix(argv[0], *ep)) {
  25:                 register char *cp = *ep;
  26: 
  27:                 found++;
  28:                 if (argc) {
  29:                     while (*cp && *cp != '=')
  30:                         cp++;
  31:                     if (*cp == '=')
  32:                         cp++;
  33:                 }
  34:                 printf("%s\n", cp);
  35:             }
  36:     exit (!found);
  37: }
  38: 
  39: prefix(cp, dp)
  40:     char *cp, *dp;
  41: {
  42: 
  43:     while (*cp && *dp && *cp == *dp)
  44:         cp++, dp++;
  45:     if (*cp == 0)
  46:         return (*dp == '=');
  47:     return (0);
  48: }

Defined functions

main defined in line 14; never used
prefix defined in line 39; used 1 times
  • in line 24

Defined variables

sccsid defined in line 2; never used
Last modified: 1982-11-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 662
Valid CSS Valid XHTML 1.0 Strict