+ const char *smashedopt;
+
+ if (argc>=2 &&
+ (smashedopt = argv[1]) &&
+ smashedopt[0]=='-' &&
+ (strchr(smashedopt,' ') || strchr(smashedopt,','))) {
+ /* single argument containg all the options and <interp> */
+ argv += 2; /* eat argv[0] and smashedopt */
+ const char *split_args[MAX_OPTS+1];
+ int split_argc = 0;
+ for (;;) {
+ if (split_argc >= MAX_OPTS) errx(127,"too many options in combined arg");
+ split_args[split_argc++] = smashedopt;
+ if (smashedopt[0] != '-') /* never true on first iteration */
+ break;
+ char *delim = strchr(smashedopt,' ');
+ if (!delim) delim = strchr(smashedopt,',');
+ if (!delim)
+ errx(127,"combined arg lacks <interpreter>");
+ *delim = 0;
+ smashedopt = delim+1;
+ }
+ assert(split_argc <= MAX_OPTS);
+ split_args[split_argc++] = 0;
+
+ const char *const *split_argv = split_args;
+
+ shbang_opts(&split_argv, cmdinfos);
+ /* sets interp */
+ if (!split_argv) errx(127,"combined arg too many non-option arguments");
+ } else {
+ shbang_opts(&argv, cmdinfos);
+ }