Subversion Repositories SvarDOS

Rev

Rev 987 | Rev 1001 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 987 Rev 989
Line 136... Line 136...
136
      cmdline++;
136
      cmdline++;
137
      continue;
137
      continue;
138
    }
138
    }
139
 
139
 
140
    if (*cmdline != '/') {
140
    if (*cmdline != '/') {
141
      output("Invalid parameter: ");
141
      nls_output(0,6); /* "Invalid parameter" */
-
 
142
      output(": ");
142
      outputnl(cmdline);
143
      outputnl(cmdline);
143
      goto SKIP_TO_NEXT_ARG;
144
      goto SKIP_TO_NEXT_ARG;
144
    }
145
    }
145
 
146
 
146
    /* got a slash */
147
    /* got a slash */
Line 172... Line 173...
172
      case 'P':
173
      case 'P':
173
        cfg->flags |= FLAG_PERMANENT;
174
        cfg->flags |= FLAG_PERMANENT;
174
        break;
175
        break;
175
 
176
 
176
      case '?':
177
      case '?':
177
        outputnl("Starts the SvarCOM command interpreter");
178
        nls_outputnl(1,0); /* "Starts the SvarCOM command interpreter" */
178
        outputnl("");
179
        outputnl("");
179
        outputnl("COMMAND /E:nnn [/[C|K] [/P] [/D] command]");
180
        nls_outputnl(1,1); /* "COMMAND /E:nnn [/[C|K] [/P] [/D] command]" */
180
        outputnl("");
181
        outputnl("");
181
        outputnl("/D      Skip AUTOEXEC.BAT processing (makes sense only with /P)");
182
        nls_outputnl(1,2); /* "/D      Skip AUTOEXEC.BAT processing (makes sense only with /P)" */
182
        outputnl("/E:nnn  Sets the environment size to nnn bytes");
183
        nls_outputnl(1,3); /* "/E:nnn  Sets the environment size to nnn bytes" */
183
        outputnl("/P      Makes the new command interpreter permanent and run AUTOEXEC.BAT");
184
        nls_outputnl(1,4); /* "/P      Makes the new command interpreter permanent and run AUTOEXEC.BAT" */
184
        outputnl("/C      Executes the specified command and returns");
185
        nls_outputnl(1,5); /* "/C      Executes the specified command and returns" */
185
        outputnl("/K      Executes the specified command and continues running");
186
        nls_outputnl(1,6); /* "/K      Executes the specified command and continues running" */
186
        exit(1);
187
        exit(1);
187
        break;
188
        break;
188
 
189
 
189
      default:
190
      default:
190
        output("Invalid switch: /");
191
        nls_output(0,2); /* invalid switch */
-
 
192
        output(": /");
191
        outputnl(cmdline);
193
        outputnl(cmdline);
192
        break;
194
        break;
193
    }
195
    }
194
 
196
 
195
    /* move to next argument or quit processing if end of cmdline */
197
    /* move to next argument or quit processing if end of cmdline */
Line 768... Line 770...
768
  if (rmod == NULL) {
770
  if (rmod == NULL) {
769
    /* look at command line parameters (in case env size if set there) */
771
    /* look at command line parameters (in case env size if set there) */
770
    parse_argv(&cfg);
772
    parse_argv(&cfg);
771
    rmod = rmod_install(cfg.envsiz, BUFFER, BUFFER_len);
773
    rmod = rmod_install(cfg.envsiz, BUFFER, BUFFER_len);
772
    if (rmod == NULL) {
774
    if (rmod == NULL) {
773
      outputnl("ERROR: rmod_install() failed");
775
      nls_outputnl_err(2,1); /* "FATAL ERROR: rmod_install() failed" */
774
      return(1);
776
      return(1);
775
    }
777
    }
776
    /* copy flags to rmod's storage (and enable ECHO) */
778
    /* copy flags to rmod's storage (and enable ECHO) */
777
    rmod->flags = cfg.flags | FLAG_ECHOFLAG;
779
    rmod->flags = cfg.flags | FLAG_ECHOFLAG;
778
    /* printf("rmod installed at %Fp\r\n", rmod); */
780
    /* printf("rmod installed at %Fp\r\n", rmod); */
Line 783... Line 785...
783
     * die asap, because the command has been executed already, so I no longer
785
     * die asap, because the command has been executed already, so I no longer
784
     * have a purpose in life */
786
     * have a purpose in life */
785
    if (rmod->flags & FLAG_EXEC_AND_QUIT) sayonara(rmod);
787
    if (rmod->flags & FLAG_EXEC_AND_QUIT) sayonara(rmod);
786
    /* */
788
    /* */
787
    if (rmod->version != BYTE_VERSION) {
789
    if (rmod->version != BYTE_VERSION) {
788
      outputnl("SVARCOM VERSION CHANGED. SYSTEM HALTED. PLEASE REBOOT YOUR COMPUTER.");
790
      nls_outputnl_err(2,0);
789
      _asm {
791
      _asm {
790
        HALT:
792
        HALT:
791
        hlt
793
        hlt
792
        jmp HALT
794
        jmp HALT
793
      }
795
      }
Line 877... Line 879...
877
        rmod_inputbuf[0] = 128;  /* max allowed input length */
879
        rmod_inputbuf[0] = 128;  /* max allowed input length */
878
        rmod_inputbuf[1] = 0;    /* string len stored in buffer */
880
        rmod_inputbuf[1] = 0;    /* string len stored in buffer */
879
        rmod_inputbuf[2] = '\r'; /* string terminator */
881
        rmod_inputbuf[2] = '\r'; /* string terminator */
880
        rmod_inputbuf[3] = 0xCA; /* trailing signature */
882
        rmod_inputbuf[3] = 0xCA; /* trailing signature */
881
        rmod_inputbuf[4] = 0xFE; /* trailing signature */
883
        rmod_inputbuf[4] = 0xFE; /* trailing signature */
882
        outputnl("SvarCOM: stack overflow detected, command history flushed (this is not a bug)");
884
        nls_outputnl_err(2,2); /* "stack overflow detected, command history flushed" */
883
      }
885
      }
884
      /* interactive mode: display prompt (if echo enabled) and wait for user
886
      /* interactive mode: display prompt (if echo enabled) and wait for user
885
       * command line */
887
       * command line */
886
      if (rmod->flags & FLAG_ECHOFLAG) build_and_display_prompt(BUFFER, *rmod_envseg);
888
      if (rmod->flags & FLAG_ECHOFLAG) build_and_display_prompt(BUFFER, *rmod_envseg);
887
      /* collect user input */
889
      /* collect user input */
Line 932... Line 934...
932
 
934
 
933
      /* is it a newly launched BAT file? */
935
      /* is it a newly launched BAT file? */
934
      if ((rmod->bat != NULL) && (rmod->bat->nextline == 0)) goto SKIP_NEWLINE;
936
      if ((rmod->bat != NULL) && (rmod->bat->nextline == 0)) goto SKIP_NEWLINE;
935
      /* run_as_external() does not return on success, if I am still alive then
937
      /* run_as_external() does not return on success, if I am still alive then
936
       * external command failed to execute */
938
       * external command failed to execute */
937
      outputnl("Bad command or file name");
939
      nls_outputnl(0,5); /* "Bad command or file name" */
938
      continue;
940
      continue;
939
    }
941
    }
940
 
942
 
941
    /* I should never ever land here */
943
    /* I should never ever land here */
942
    outputnl("INTERNAL ERR: INVALID CMDRES");
944
    outputnl("INTERNAL ERR: INVALID CMDRES");