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();
|
||||
} ARGEND;
|
||||
|
||||
if (argc == 1) {
|
||||
if (argc == 0) {
|
||||
while (*environ)
|
||||
printf("%s\n", *environ++);
|
||||
|
||||
return 0;
|
||||
}
|
||||
while(*++argv) {
|
||||
} else {
|
||||
while (*argv) {
|
||||
if ((var = getenv(*argv)))
|
||||
printf("%s\n", var);
|
||||
argv++;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user