Fix completely broken printenv(1)
This commit is contained in:
parent
25a375b707
commit
3fa0a358b1
11
printenv.c
11
printenv.c
@ -22,16 +22,15 @@ main(int argc, char *argv[])
|
|||||||
usage();
|
usage();
|
||||||
} ARGEND;
|
} ARGEND;
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 0) {
|
||||||
while (*environ)
|
while (*environ)
|
||||||
printf("%s\n", *environ++);
|
printf("%s\n", *environ++);
|
||||||
|
} else {
|
||||||
return 0;
|
while (*argv) {
|
||||||
}
|
|
||||||
while(*++argv) {
|
|
||||||
if ((var = getenv(*argv)))
|
if ((var = getenv(*argv)))
|
||||||
printf("%s\n", var);
|
printf("%s\n", var);
|
||||||
|
argv++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user