Fix completely broken printenv(1)

This commit is contained in:
sin 2014-11-16 13:11:12 +00:00
parent 25a375b707
commit 3fa0a358b1

View File

@ -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;
} else {
while (*argv) {
if ((var = getenv(*argv)))
printf("%s\n", var);
argv++;
}
}
while(*++argv) {
if ((var = getenv(*argv)))
printf("%s\n", var);
}
return 0;
}