If the user specifies that an argument is required, but none is provided, return '?' as the option, rather than NULL as the optarg. This fixes an issue if the last option specified in the option list requires an argument, but none is provided.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2000
ad392aa1-c5ef-ae45-8dd8-
e69d62a5ef86
goto out;\r
\r
optarg = argv[++optind];\r
- while(optarg && *optarg && (*optarg == ' ' || *optarg == ' ')) optarg++;\r
- if (optarg && !(*optarg))\r
- optarg = NULL; \r
+ if (!optarg || !(*optarg)) {\r
+ return '?';\r
+ }\r
\r
out:\r
optind++;\r