diff options
author | Jim Meyering <jim@meyering.net> | 2003-05-10 20:01:32 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-05-10 20:01:32 +0000 |
commit | c2173890f05d9e53cac1002f647053aff2fb3f5b (patch) | |
tree | 1b61803f1a15c5d5ef0bcde51d95cf51727967e7 /src | |
parent | 2c199e699083cf3170bc896e655a5a64f6b18911 (diff) | |
download | coreutils-c2173890f05d9e53cac1002f647053aff2fb3f5b.tar.xz |
(main): Handle argc < optind.
Diffstat (limited to 'src')
-rw-r--r-- | src/env.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -168,7 +168,7 @@ main (register int argc, register char **argv, char **envp) } } - if (optind != argc && !strcmp (argv[optind], "-")) + if (optind < argc && !strcmp (argv[optind], "-")) ignore_environment = 1; environ = dummy_environ; @@ -183,14 +183,14 @@ main (register int argc, register char **argv, char **envp) if (optc == 'u') putenv (optarg); /* Requires GNU putenv. */ - if (optind != argc && !strcmp (argv[optind], "-")) + if (optind < argc && !strcmp (argv[optind], "-")) ++optind; while (optind < argc && strchr (argv[optind], '=')) putenv (argv[optind++]); /* If no program is specified, print the environment and exit. */ - if (optind == argc) + if (argc <= optind) { while (*environ) puts (*environ++); |