Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 8 Aug 2009 22:09:51 +0000 (15:09 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 8 Aug 2009 22:09:51 +0000 (15:09 -0700)
usr.bin/printenv/printenv.c

index bd5f778..f61f3b3 100644 (file)
@@ -77,14 +77,12 @@ main(int argc, char **argv)
        }
        len = strlen(*argv);
        for (ep = environ; *ep != NULL; ep++) {
-               if (memcmp(*ep, *argv, len) == 0) {
-                       cp = *ep + len;
-                       if (*cp == '=') {
+               cp = strchr(*ep, '=');
+               if (cp == *ep + len) {
+                       if (memcmp(*ep, *argv, len) == 0) {
                                printf("%s\n", cp + 1);
                                exit(0);
                        }
-                       if (*cp == '\0')
-                               exit(0);
                }
        }
        exit(1);