sbase/printenv.c

25 lines
281 B
C
Raw Normal View History

2013-06-09 13:20:55 +00:00
#include <stdio.h>
#include <stdlib.h>
extern char **environ;
int
main(int argc, char **argv)
{
char *var;
if(argc == 1) {
while(*environ)
printf("%s\n", *environ++);
return 0;
}
while(*++argv) {
if((var = getenv(*argv)))
printf("%s\n", var);
}
return 0;
}