From c2173890f05d9e53cac1002f647053aff2fb3f5b Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 10 May 2003 20:01:32 +0000 Subject: (main): Handle argc < optind. --- src/env.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/env.c b/src/env.c index 596498aa6..2db3ad6dd 100644 --- a/src/env.c +++ b/src/env.c @@ -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++); -- cgit v1.2.3-70-g09d2