commit 3fa0a358b1cd599bc699b4d338eb3df6ff69d071 parent 25a375b7073902c9f796a311bc58f3f975a7b1ef Author: sin <sin@2f30.org> Date: Sun, 16 Nov 2014 13:11:12 +0000 Fix completely broken printenv(1) Diffstat:
M | printenv.c | | | 15 | +++++++-------- |
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/printenv.c b/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) { - if ((var = getenv(*argv))) - printf("%s\n", var); + } else { + while (*argv) { + if ((var = getenv(*argv))) + printf("%s\n", var); + argv++; + } } - return 0; }