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