sbase/printenv.c
2013-06-09 15:20:55 +02:00

25 lines
281 B
C

#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;
}