[hackers] [sbase] Fix completely broken printenv(1) || sin

From: <git_AT_suckless.org>
Date: Sun, 16 Nov 2014 14:11:40 +0100

commit 3fa0a358b1cd599bc699b4d338eb3df6ff69d071
Author: sin <sin_AT_2f30.org>
Date: Sun Nov 16 13:11:12 2014 +0000

    Fix completely broken printenv(1)

diff --git a/printenv.c b/printenv.c
index 534be83..358e714 100644
--- a/printenv.c
+++ b/printenv.c
_AT_@ -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;
 }
Received on Sun Nov 16 2014 - 14:11:40 CET

This archive was generated by hypermail 2.3.0 : Sun Nov 16 2014 - 14:12:09 CET