blob: d5ea5313c7b96e222fa7bb1e7683b2cdd98d7508 [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001#include <stdio.h>
2#include <stdlib.h>
3
4extern char** environ;
5
6int printenv_main (int argc, char **argv)
7{
8 char** e;
9 char* v;
10 int i;
11
12 if (argc == 1) {
13 e = environ;
14 while (*e) {
15 printf("%s\n", *e);
16 e++;
17 }
18 } else {
19 for (i=1; i<argc; i++) {
20 v = getenv(argv[i]);
21 if (v) {
22 printf("%s\n", v);
23 }
24 }
25 }
26
27 return 0;
28}
29