int cmd_set(char *param) { char *value; if(leadOptions(¶m, opt_set, 0) != E_None) return 1; switch(breakVarAssign(ctxtEnvironment, param, &value)) { case 1: /* no equal sign */ error_syntax(0); return 1; case 0: /* displayed */ return 0; #ifdef DEBUG case 2: break; default: dprintf(("[SET: Invalid response from breakVarAssign()]\n")); return 1; #endif } /* If the value is just blanks, it means to delete the value; but otherwise even leading and trailing spaces must be kept */ if(is_empty(value)) value = 0; return chgEnvCase(optC, param, value); }
int cmd_set(char *param) { char *value; char *promptBuf = 0; int ret; optC = promptUser = 0; if(leadOptions(¶m, opt_set, 0) != E_None) return 1; switch(breakVarAssign(ctxtEnvironment, param, &value)) { case 1: /* no equal sign */ error_syntax(0); return 1; case 0: /* displayed */ return 0; #ifdef DEBUG case 2: break; default: dprintf(("[SET: Invalid response from breakVarAssign()]\n")); return 1; #endif } if(promptUser) { /* -> Display the value, then read and assign */ assert(value); fputs(value, stdout); promptBuf = malloc(promptBuffer); if(!promptBuf) { error_out_of_memory(); return E_NoMem; } fgets(promptBuf, promptBuffer, stdin); if(cbreak) { free(promptBuf); return E_CBreak; } value = strchr(promptBuf, '\0'); while(--value >= promptBuf && (*value == '\n' || *value == '\r')); value[1] = '\0'; /* strip trailing newlines */ value = promptBuf; } /* If the value is just blanks, it means to delete the value; but otherwise even leading and trailing spaces must be kept */ if(is_empty(value)) value = 0; ret = chgEnvCase(optC, param, value); free(promptBuf); return ret; }
int cmd_time(char *rest) { struct dostime_t t; char s[40]; int ec; noPrompt = 0; if((ec = leadOptions(&rest, opt_date, NULL)) != E_None) return ec; if (!*rest) { char *time; _dos_gettime(&t); time = nls_maketime(0, t.hour, t.minute, t.second, t.hsecond); if(!time) { error_out_of_memory(); return 1; } displayString(TEXT_MSG_CURRENT_TIME, time); free(time); rest = NULL; } while (1) { if (rest) { if (parsetime(rest)) return 0; } else { if(noPrompt) return 0; if ((rest = getMessage(TEXT_MSG_ENTER_TIME)) == NULL) return 1; fputs(rest, stdout); free(rest); fgets(s, sizeof(s), stdin); if (cbreak) return 1; if (parsetime(s)) return 0; } displayString(TEXT_ERROR_INVALID_TIME); // force input the next time around. rest = NULL; } }
int cmd_call(char *param) { /* * Perform CALL command. * * Allocate a new batch context and add it to the current chain. * Call parsecommandline passing in our param string * If No batch file was opened then remove our newly allocted * context block. */ struct bcontext *n = newBatchContext(); int ec; if (n == 0) { /* Not in a batch file */ return 1; } optS = optN = 0; if((ec = leadOptions(¶m, opt_call, 0)) != E_None) return ec; if(swapOnExec != ERROR) { if(optS) swapOnExec = TRUE; if(optN) swapOnExec = FALSE; } parsecommandline(param, FALSE); if(swapOnExec != ERROR) swapOnExec = FALSE; if (bc->bfile == 0 && bc->bfnam == 0) { /* Wasn't a batch file so remove context */ bc = bc->prev; free(n); } return 0; }
int cmd_time(char *param) { char s[40]; int ec; noPrompt = 0; if((ec = leadOptions(¶m, opt_date, 0)) != E_None) return ec; if(!*param) { char *time; if((time = curTime()) == 0) return 1; displayString(TEXT_MSG_CURRENT_TIME, time); free(time); param = 0; } while(1) { if(!param) { if(noPrompt) return 0; displayString(TEXT_MSG_ENTER_TIME); fgets(s, sizeof(s), stdin); if (cbreak) return 1; param = s; } if(my_settime(param)) break; error_invalid_time(); /* force user interaction the next time around. */ param = 0; } return 0; }
int initialize(void) { int comPath; /* path to COMMAND.COM (for COMSPEC/reload) */ char *newTTY; /* what to change TTY to */ int showinfo; /* show initial info only if no command line options */ int key; int ec; /* error code */ unsigned offs; /* offset into environment segment */ int cmdlen; /* length of command line */ char *cmdline; /* command line duplicated into heap */ char *p, *h, *q; #ifdef FEATURE_CALL_LOGGING FILE *f; #endif /* Set up the host environment of COMMAND.COM */ /* Install the ^Break handler (see chkCBreak() for more details) */ extern void initCBreakCatcher(void); initCBreakCatcher(); /* Install INT 24 Critical error handler */ init_error_handler(); /* DOS shells patch the PPID to the own PID, how stupid this is, however, because then DOS won't terminate them, e.g. when a Critical Error occurs that is not detected by COMMAND.COM */ oldPSP = OwnerPSP; atexit(exitfct); OwnerPSP = _psp; /* Some elder DOSs may not pass an initialzied environment segment */ if (env_glbSeg && !isMCB(SEG2MCB(env_glbSeg))) env_setGlbSeg(0); /* Disable the environment */ /* Now parse the command line parameters passed to COMMAND.COM */ /* Preparations */ newTTY = NULL; comPath = tracemode = 0; showinfo = 1; /* Because FreeCom should be executed in a DOS3+ compatible environment most of the time, it is assumed that its path can be determined from the environment. This has the advantage that the string area is accessable very early in the run. The name of the current file is string #0. */ if((offs = env_string(0, 0)) != 0) /* OK, environment filled */ grabComFilename(0, (char far *)MK_FP(env_glbSeg, offs)); /* Aquire the command line, there are three possible sources: 1) DOS command line @PSP:0x80 as pascal string, 2) extended DOS command line environment variable CMDLINE, if peekb(PSP, 0x80) == 127,& 3) MKS command line @ENV:2, if peekb(ENV, 0) == '~' Currently implemented is version #1 only */ cmdlen = peekb(_psp, 0x80); if(cmdlen < 0 || cmdlen > 126) { error_corrupt_command_line(); cmdlen = 0; } /* duplicate the command line into the local address space */ if((cmdline = malloc(cmdlen + 1)) == NULL) { error_out_of_memory(); /* Cannot recover from this problem */ return E_NoMem; } _fmemcpy((char far*)cmdline, MK_FP(_psp, 0x81), cmdlen); cmdline[cmdlen] = '\0'; #ifdef FEATURE_CALL_LOGGING if((f = fopen(logFilename, "at")) == NULL) { fprintf(stderr, "Cannot open logfile: \"%s\"\n", logFilename); exit(125); } putc('"', f); if(ComPath) /* path to command.com already known */ fputs(ComPath, f); putc('"', f); putc(':', f); fputs(cmdline, f); putc('\n', f); fclose(f); #endif p = cmdline; /* start of the command line */ do { ec = leadOptions(&p, opt_init, NULL); if(ec == E_NoOption) { /* /C or /K */ assert(p && *p); if(!isoption(p)) { error_quoted_c_k(); p = NULL; break; } assert(p[1] && strchr("kKcC", p[1])); p += 2; /* p := start of command line to execute */ break; } else if(ec != E_None) { showhelp = 1; p = NULL; break; } assert(p && !isoption(p) && !isspace(*p)); if(!*p) { p = NULL; break; /* end of line reached */ } q = unquote(p, h = skip_word(p)); p = h; /* Skip this word */ if(!q) { error_out_of_memory(); p = NULL; break; } if(!comPath) { /* 1st argument */ grabComFilename(1, (char far*)q); comPath = 1; free(q); } else if(!newTTY) { /* 2nd argument */ #ifdef INCLUDE_CMD_CTTY newTTY = q; #else error_ctty_excluded(); free(q); #endif } else { error_too_many_parameters(q); showhelp = 1; free(q); break; } } while(1); /* * Now: * + autoexec: AUTOEXEC.BAT file to be executed if /P switch * is enabled; if NULL, use default * + comPath: user-defined PATH to COMMAND.COM; if NULL, use * the one from the environment * + newTTY: the name of the device to be CTTY'ed; if NULL, * no change * + p: pointer to the command to be executed: * *p == 'c' or 'C' --> spawn command, then terminate shell * *p == 'k' or 'K' --> spawn command, then go interactive * &p[1] --> command line, unless the first character is an * argument character */ /* Now process the options */ #ifdef INCLUDE_CMD_CTTY if (newTTY) { /* change TTY as early as possible so the caller gets the messages into the correct channel */ cmd_ctty(newTTY); free(newTTY); } #endif if(!ComPath) { /* FreeCom is unable to find itself --> print error message */ /* Emergency error */ puts("You must specify the complete path to " COM_NAME); puts("as the first argument of COMMAND,"); puts("for instance: C:\\FDOS"); return E_Useage; } /* First of all, set up the environment */ env_resizeCtrl |= ENV_USEUMB | ENV_ALLOWMOVE; if (envSize < 0) envSize = 32767; /* Numeric overflow (number > 32767 specified) */ else if (envSize < 256) envSize = 256; /* Minimum size of 256. */ if(envSize > env_resize(0, 0)) /* Test if to enlarge environment */ env_setsize(0, envSize); /* Set the COMSPEC variable. */ #if 0 if (chgEnv("COMSPEC", ComPath)) error_env_var("COMSPEC"); #else if (chgEnv("COMSPEC", ComPath)) { /* Failed to add this variable, the most likely problem should be that the environment is too small --> it is increased and the operation is redone */ env_resize(0, strlen(ComPath) + 10); if (chgEnv("COMSPEC", ComPath)) error_env_var("COMSPEC"); } #endif if(internalBufLen) error_l_notimplemented(); if(inputBufLen) error_u_notimplemented(); if(tracemode) showinfo = 0; if (showhelp) displayString(TEXT_CMDHELP_COMMAND); if ((showhelp || exitflag) && canexit) return E_None; /* Now the /P option can be processed */ if (!canexit) { char *autoexec; autoexec = user_autoexec? user_autoexec: AUTO_EXEC; showinfo = 0; short_version(); /* JP: changed so that if autoexec does not exist, then don't ask to trace or bypass. */ if (exist(autoexec)) { printf("\nPress F8 for trace mode, or F5 to bypass %s... ", autoexec); key = WaitForFkeys(); putchar('\n'); if (key == KEY_F8) { tracemode = 1; } if (key == KEY_F5) { printf("Bypassing %s\n", autoexec); } else process_input(1, autoexec); } else { if(user_autoexec) printf("%s not found.\n", autoexec); #ifdef INCLUDE_CMD_DATE cmd_date(NULL); #endif #ifdef INCLUDE_CMD_TIME cmd_time(NULL); #endif } free(user_autoexec); } else { assert(user_autoexec == NULL); } /* Now the /C or /K option can be processed */ if (p) { process_input(1, p); return spawnAndExit; } /* Don't place something here that must be executed after a /K or /C */ if (showinfo) { short_version(); putchar('\n'); showcmds(NULL); putchar('\n'); } return E_None; }
int cmd_copy(char *rest) { char **argv, *p; int argc, opts, argi; int freeDestFile = 0; struct CopySource *h; /* Initialize options */ optA = optB = optV = optY = 0; /* read the parameters from env */ if ((argv = scanCmdline(getEnv("COPYCMD"), opt_copy, 0, &argc, &opts)) == 0) return 1; freep(argv); /* ignore any parameter from env var */ if((argv = scanCmdline(rest, opt_copy, 0, &argc, &opts)) == 0) return 1; /* scan the trailing '/a' and '/b' options */ while(argc > 0 && isoption(argv[argc - 1])) { p = argv[--argc]; /* argv[] must not be changed */ if(leadOptions(&p, opt_copy1, 0) != E_None) { freep(argv); return 1; } } initContext(); /* Now parse the remaining arguments into the copy file structure */ for(argi = 0; argi < argc; ++argi) if(isoption(p = argv[argi])) { /* infix /a or /b */ if(leadOptions(&p, opt_copy1, 0) != E_None) { killContext(); freep(argv); return 1; } /* Change the flags of the previous argument */ if(lastApp) lastApp->flags = cpyFlags(); } else { /* real argument */ if(*p == '+') { /* to previous argument */ appendToFile = 1; while(*++p == '+'); if(!*p) continue; } if(!addSource(p)) { killContext(); freep(argv); return 1; } } if(appendToFile) { error_trailing_plus(); killContext(); freep(argv); return 1; } if(!last) { /* Nothing to do */ error_nothing_to_do(); killContext(); freep(argv); return 1; } assert(head); /* Now test if a destination was specified */ if(head != last && !last->app) { /* Yeah */ destFile = dfnexpand(last->fnam, 0); if(!destFile) { error_out_of_memory(); goto errRet; } freeDestFile = 1; h = head; /* remove it from argument list */ while(h->nxt != last) { assert(h->nxt); h = h->nxt; } free(last); (last = h)->nxt = 0; p = strchr(destFile, '\0') - 1; if(*p == '\\' || *p == '/') /* must be a directory */ destIsDir = 1; else destIsDir = dfnstat(destFile) & DFN_DIRECTORY; } else { /* Nay */ destFile = "."; destIsDir = 1; } /* Now copy the files */ h = head; while(copyFiles(h) && (h = h->nxt) != 0); if(freeDestFile) free(destFile); errRet: killContext(); freep(argv); return 0; }
int cmd_set(char *param) { char *value; char *promptBuf = 0, tempcmd[255]; int ret; optC = promptUser = upCaseValue = optExecute = 0; if(leadOptions(¶m, opt_set, 0) != E_None) return 1; switch(breakVarAssign(ctxtEnvironment, param, &value)) { case 1: /* no equal sign */ #ifdef FEATURE_CMD_SET_PRINT if( ( value = getEnv( param ) ) != NULL ) printf( "%s\n", value ); else { error_env_var_not_found( param ); return( 1 ); } return( 0 ); #else error_syntax(0); return 1; #endif case 0: /* displayed */ return 0; #ifdef DEBUG case 2: break; default: dprintf(("[SET: Invalid response from breakVarAssign()]\n")); return 1; #endif } if(promptUser) { /* -> Display the value, then read and assign */ assert(value); fputs(value, stdout); promptBuf = malloc(promptBuffer); if(!promptBuf) { error_out_of_memory(); return E_NoMem; } fgets(promptBuf, promptBuffer, stdin); if(cbreak) { free(promptBuf); return E_CBreak; } value = strchr(promptBuf, '\0'); while(--value >= promptBuf && (*value == '\n' || *value == '\r')); value[1] = '\0'; /* strip trailing newlines */ value = promptBuf; } if (optExecute) { char *tempfile = tmpfn(); FILE *fhandle; if (!tempfile) return (1); sprintf (tempcmd, "%s>%s", value, tempfile); parsecommandline (tempcmd, TRUE); fhandle = fopen (tempfile, "r"); if (!fhandle) { unlink (tempfile); free (tempfile); return (1); } fgets (tempcmd, 255, fhandle); value = strchr(tempcmd, '\n'); if (value) *value = '\0'; value = tempcmd; fclose (fhandle); unlink (tempfile); free (tempfile); } /* If the value is just blanks, it means to delete the value; but otherwise even leading and trailing spaces must be kept */ if(is_empty(value)) value = 0; if (upCaseValue) StrUpr(value); /* set value as upper case, eg for if testing */ ret = chgEnvCase(optC, param, value); free(promptBuf); return ret; }
int initialize(void) { //int rc; int comPath; /* path to COMMAND.COM (for COMSPEC/reload) */ char *newTTY; /* what to change TTY to */ int showinfo; /* show initial info only if no command line options */ int ec; /* error code */ unsigned offs; /* offset into environment segment */ int cmdlen; /* length of command line */ char *cmdline; /* command line duplicated into heap */ char *p, *h, *q; #ifdef FEATURE_CALL_LOGGING #ifndef INCLUDE_CMD_FDDEBUG FILE *f; #endif #endif /* Set up the host environment of COMMAND.COM */ /* Install the dummy handlers for Criter and ^Break */ initCBreak(); setvect(0x23, cbreak_handler); setvect(0x24, dummy_criter_handler); /* DOS shells patch the PPID to the own PID, how stupid this is, however, because then DOS won't terminate them, e.g. when a Critical Error occurs that is not detected by COMMAND.COM */ oldPSP = OwnerPSP; atexit(exitfct); OwnerPSP = _psp; dbg_printmem(); #ifdef DEBUG { void* p; if((p = malloc(5*1024)) == 0) dprintf(("[MEM: Out of memory allocating test block during INIT]")); else free(p); } #endif #ifdef FEATURE_KERNEL_SWAP_SHELL if(kswapInit()) { /* re-invoked */ if(kswapLoadStruc()) { /* OK, on success we need not really keep the shell trick (pretend we are our own parent), which might cause problems with beta-software-bugs ;-) In fact, KSSF will catch up our crashes and re-invoke FreeCOM, probably with the loss of any internal settings. */ OwnerPSP = oldPSP; return E_None; } } #endif /* Some elder DOSs may not pass an initializied environment segment */ if (env_glbSeg && !isMCB(SEG2MCB(env_glbSeg))) env_setGlbSeg(0); /* Disable the environment */ /* Now parse the command line parameters passed to COMMAND.COM */ /* Preparations */ newTTY = 0; comPath = tracemode = 0; showinfo = 1; /* Because FreeCom should be executed in a DOS3+ compatible environment most of the time, it is assumed that its path can be determined from the environment. This has the advantage that the string area is accessable very early in the run. The name of the current file is string #0. */ if((offs = env_string(0, 0)) != 0) /* OK, environment filled */ grabComFilename(0, (char far *)MK_FP(env_glbSeg, offs)); /* After that argv[0] is no longer used and maybe zapped. This also will help, as most programs altering the environment segment externally don't expect a string area. */ env_nullStrings(0); /* Aquire the command line, there are three possible sources: 1) DOS command line @PSP:0x80 as pascal string, 2) extended DOS command line environment variable CMDLINE, if peekb(PSP, 0x80) == 127,& 3) MKS command line @ENV:2, if peekb(ENV, 0) == '~' && peekb(ENV, 1) == '=' Currently implemented is version #1 only */ cmdlen = peekb(_psp, 0x80); if(cmdlen < 0 || cmdlen > 126) { error_corrupt_command_line(); cmdlen = 0; } /* duplicate the command line into the local address space */ if((cmdline = malloc(cmdlen + 1)) == 0) { error_out_of_memory(); /* Cannot recover from this problem */ return E_NoMem; } _fmemcpy((char far*)cmdline, MK_FP(_psp, 0x81), cmdlen); cmdline[cmdlen] = '\0'; #ifdef FEATURE_CALL_LOGGING #ifndef INCLUDE_CMD_FDDEBUG if((f = fopen(logFilename, "at")) == 0) { fprintf(stderr, "Cannot open logfile: \"%s\"\n", logFilename); } else { putc('"', f); if(ComPath) /* path to command.com already known */ fputs(ComPath, f); putc('"', f); putc(':', f); fputs(cmdline, f); putc('\n', f); fclose(f); } #else cmd_fddebug(logFilename); dbg_outc('"'); dbg_outs(ComPath); dbg_outc('"'); dbg_outc(':'); dbg_outsn(cmdline); #endif #endif canexit = 1; p = cmdline; /* start of the command line */ do { ec = leadOptions(&p, opt_init, 0); if(ec == E_NoOption) { /* /C or /K */ assert(p && *p); if(!isoption(p)) { error_quoted_c_k(); p = 0; break; } assert(p[1] && strchr("kKcC", p[1])); p += 2; /* p := start of command line to execute */ break; } else if(ec != E_None) { showhelp = 1; p = 0; break; } assert(p && !isoption(p) && !isspace(*p)); if(!*p) { p = 0; break; /* end of line reached */ } q = unquote(p, h = skip_word(p)); p = h; /* Skip this word */ if(!q) { error_out_of_memory(); p = 0; break; } if(!comPath) { /* 1st argument */ grabComFilename(1, (char far*)q); comPath = 1; free(q); } else if(!newTTY) { /* 2nd argument */ #ifdef INCLUDE_CMD_CTTY newTTY = q; #else error_ctty_excluded(); free(q); #endif } else { error_too_many_parameters(q); showhelp = 1; free(q); break; } } while(1); /* * Now: * + autoexec: AUTOEXEC.BAT file to be executed if /P switch * is enabled; if NULL, use default * + comPath: user-defined PATH to COMMAND.COM; if NULL, use * the one from the environment * + newTTY: the name of the device to be CTTY'ed; if NULL, * no change * + p: pointer to the command to be executed: * *p == 'c' or 'C' --> spawn command, then terminate shell * *p == 'k' or 'K' --> spawn command, then go interactive * &p[1] --> command line, unless the first character is an * argument character */ /* Now process the options */ #ifdef INCLUDE_CMD_CTTY if (newTTY) { /* change TTY as early as possible so the caller gets the messages into the correct channel */ cmd_ctty(newTTY); free(newTTY); } #endif if(!ComPath) { /* FreeCom is unable to find itself --> print error message */ /* Emergency error */ #undef TEXT_MSG_FREECOM_NOT_FOUND puts(TEXT_MSG_FREECOM_NOT_FOUND); return E_Useage; } /* First of all, set up the environment */ /* If a new valid size is specified, use that */ env_resizeCtrl |= ENV_USEUMB | ENV_ALLOWMOVE; if(newEnvSize > 16 && newEnvSize < 32767) env_setsize(0, newEnvSize); /* Otherwise the path is placed into the environment */ /* Set the COMSPEC variable. */ if(chgEnv("COMSPEC", ComPath)) { /* keep it silent */ /* Failed to add this variable, the most likely problem should be that the environment is too small --> it is increased and the operation is redone */ env_resize(0, strlen(ComPath) + 10); if(chgEnv("COMSPEC", ComPath)) chgEnv("COMSPEC", NULL); /* Cannot set -> zap an old one */ } inInit = 0; /* Install INT 24 Critical error handler */ /* Needs the ComPath variable, eventually */ if(!kswapContext) { /* Load the module/context into memory */ if((kswapContext = modContext()) == 0) { error_loading_context(); return E_NoMem; } #ifdef FEATURE_KERNEL_SWAP_SHELL if(swapOnExec != ERROR) kswapRegister(kswapContext); #endif } ctxtCreate(); /* re-use the already loaded Module */ setvect(0x24, (void interrupt(*)()) MK_FP(FP_SEG(kswapContext->cbreak_hdlr), kswapContext->ofs_criter)); if(internalBufLen) error_l_notimplemented(); if(inputBufLen) error_u_notimplemented(); if(tracemode) showinfo = 0; if (showhelp) displayString(TEXT_CMDHELP_COMMAND); if ((showhelp || exitflag) && canexit) return E_None; /* Now the /P option can be processed */ if(!canexit) { char *autoexec; autoexec = user_autoexec? user_autoexec: AUTO_EXEC; showinfo = 0; short_version(); if(skipAUTOEXEC) { /* /D option */ showinfo = 0; displayString(TEXT_MSG_INIT_BYPASSING_AUTOEXEC, autoexec); } else { if(exist(autoexec)) { #ifdef FEATURE_BOOT_KEYS struct REGPACK r; int key; r.r_ax = 0x3000; /* Get DOS version & OEM ID */ intr(0x21, &r); if(!tracemode /* /Y --> F8 on CONFIG.SYS */ || ((r.r_bx & 0xff00) == 0xfd00 /* FreeDOS >= build 2025 */ && !(r.r_cx > 0x101 || (r.r_bx & 0xff) > 24))) { displayString(TEXT_MSG_INIT_BYPASS_AUTOEXEC, autoexec); key = cgetchar_timed(3); putchar('\n'); } else key = 0; if(key == KEY_F8) tracemode = 1; if(key == KEY_F5) displayString(TEXT_MSG_INIT_BYPASSING_AUTOEXEC, autoexec); else #endif process_input(1, autoexec); } else { if(user_autoexec) error_sfile_not_found(user_autoexec); #ifdef INCLUDE_CMD_DATE cmd_date(0); #endif #ifdef INCLUDE_CMD_TIME cmd_time(0); #endif } } free(user_autoexec); } else { assert(user_autoexec == 0); } /* Now the /C or /K option can be processed */ if (p) { process_input(1, p); return spawnAndExit; } /* Don't place something here that must be executed after a /K or /C */ if (showinfo) { short_version(); #ifndef DEBUG putchar('\n'); showcmds(0); putchar('\n'); #endif } return E_None; }
int parseArgs(char *cmdline, char **fnam, char **rest) { char *c; assert(fnam); assert(rest); /* initialize options */ optS = 0; optL = NULL; if(leadOptions(&cmdline, loadfix_flag? NULL: opt_lh, NULL) != E_None) return err_silent; if((c = optL) != NULL) { int i, r; /* Disable access to all UMB regions not listed here */ for (i = 1; i < umbRegions; i++) umbRegion[i].access = 0; r = 0; do { DWORD region_minSize = 0xffff; /* flag value, indicating no minsize was specified */ int region_number = (int)strtol(c, &c, 10); if (*c == ',') { long larg; c++; if ((larg = strtol(c, &c, 10)) != -1L) region_minSize = topara(larg); } if (region_number >= umbRegions) displayString(TEXT_ERROR_REGION_WARNING, region_number); else { if (!r && !region_number) upper_flag = 0; r++; assert(region_minSize < 0x10000ul); umbRegion[region_number].minSize = (unsigned)region_minSize; umbRegion[region_number].access = 1; } } while (*c++ == ';'); if(c[-1]) cmdline = ""; /* to cause an error later */ } /* does a file name follow? */ if (!*cmdline) return err_invalid_parms; if (optS && !optL) return err_invalid_parms; /* The next argument is the file name. The rest of the command line * are passed as parameters to the new program. */ if((*fnam = unquote(cmdline, c = skipwd(cmdline))) == NULL) return err_out_of_memory; *rest = skipdm(c); return OK; }