platform_system_core/toolbox/printenv.c

30 lines
455 B
C
Raw Normal View History

2008-10-21 16:00:00 +02:00
#include <stdio.h>
#include <stdlib.h>
extern char** environ;
int printenv_main (int argc, char **argv)
{
char** e;
char* v;
int i;
if (argc == 1) {
e = environ;
while (*e) {
printf("%s\n", *e);
e++;
}
} else {
for (i=1; i<argc; i++) {
v = getenv(argv[i]);
if (v) {
printf("%s\n", v);
}
}
}
return 0;
}