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
Defined variables
sccsid
defined in line
2;
never used