M7350/system/core/toolbox/printenv.c
2024-09-09 08:52:07 +00:00

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