platform_system_core/toolbox/printenv.c
The Android Open Source Project 4f6e8d7a00 Initial Contribution
2008-10-21 07:00:00 -07:00

29 lines
455 B
C

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