#define OPTERRARG (3)
+char buff[81]; /* too hold option value when needed */
char *ap_php_optarg;
int ap_php_optind = 1;
static int ap_php_opterr = 1;
}
if (cp[1] == ':')
{
+ /* Check for cases where the value of the argument
+ is in the form -<arg> <val> or in the form -<arg><val> */
dash = 0;
- ap_php_optind++;
- if (ap_php_optind == argc)
- return(ap_php_optiserr(argc, argv, ap_php_optind-1, optstr, optchr, OPTERRARG));
- ap_php_optarg = argv[ap_php_optind++];
+ if(!argv[ap_php_optind][2]) {
+ ap_php_optind++;
+ if (ap_php_optind == argc)
+ return(ap_php_optiserr(argc, argv, ap_php_optind-1, optstr, optchr, OPTERRARG));
+ ap_php_optarg = argv[ap_php_optind++];
+ }
+ else
+ {
+ int offset = 2;
+ int len = 0;
+ while(argv[ap_php_optind][offset]) {
+ buff[len++] = argv[ap_php_optind][offset++];
+ }
+ ap_php_optarg = buff;
+ ap_php_optind++;
+ }
return(*cp);
}
else