Subversion Repositories SvarDOS

Rev

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

Rev 963 Rev 983
Line 801... Line 801...
801
  lastexitcode = MK_FP(rmod->rmodseg, RMOD_OFFSET_LEXITCODE);
801
  lastexitcode = MK_FP(rmod->rmodseg, RMOD_OFFSET_LEXITCODE);
802
 
802
 
803
  /* make COMPSEC point to myself */
803
  /* make COMPSEC point to myself */
804
  set_comspec_to_self(*rmod_envseg);
804
  set_comspec_to_self(*rmod_envseg);
805
 
805
 
806
/*  {
-
 
807
    unsigned short envsiz;
-
 
808
    unsigned short far *sizptr = MK_FP(*rmod_envseg - 1, 3);
-
 
809
    envsiz = *sizptr;
-
 
810
    envsiz *= 16;
-
 
811
    printf("rmod_inpbuff at %04X:%04X, env_seg at %04X:0000 (env_size = %u bytes)\r\n", rmod->rmodseg, RMOD_OFFSET_INPBUFF, *rmod_envseg, envsiz);
-
 
812
  }*/
-
 
813
 
-
 
814
  /* on /P check for the presence of AUTOEXEC.BAT and execute it if found,
806
  /* on /P check for the presence of AUTOEXEC.BAT and execute it if found,
815
   * but skip this check if /D was also passed */
807
   * but skip this check if /D was also passed */
816
  if ((cfg.flags & (FLAG_PERMANENT | FLAG_SKIP_AUTOEXEC)) == FLAG_PERMANENT) {
808
  if ((cfg.flags & (FLAG_PERMANENT | FLAG_SKIP_AUTOEXEC)) == FLAG_PERMANENT) {
817
    if (file_getattr("AUTOEXEC.BAT") >= 0) cfg.execcmd = "AUTOEXEC.BAT";
809
    if (file_getattr("AUTOEXEC.BAT") >= 0) cfg.execcmd = "AUTOEXEC.BAT";
818
  }
810
  }
Line 875... Line 867...
875
        outputnl(cmdline);
867
        outputnl(cmdline);
876
      }
868
      }
877
      /* skip the @ prefix if present, it is no longer useful */
869
      /* skip the @ prefix if present, it is no longer useful */
878
      if (cmdline[0] == '@') cmdline++;
870
      if (cmdline[0] == '@') cmdline++;
879
    } else {
871
    } else {
-
 
872
      unsigned char far *rmod_inputbuf = MK_FP(rmod->rmodseg, RMOD_OFFSET_INPUTBUF);
-
 
873
      unsigned short far *rmod_stacksig = MK_FP(rmod->rmodseg, RMOD_OFFSET_STACKSIG);
-
 
874
      /* invalidate input history if it appears to be damaged (could occur
-
 
875
       * because of a stack overflow, for example if some stack-hungry TSR is
-
 
876
       * being used) */
-
 
877
      if (*rmod_stacksig != 0xCAFE) {
-
 
878
        *rmod_stacksig = 0xCAFE;
-
 
879
        rmod_inputbuf[0] = 128; /* max allowed input length */
-
 
880
        rmod_inputbuf[1] = 0;
-
 
881
        rmod_inputbuf[2] = '\r';
-
 
882
        /* printf("STACK OVERFLOW DETECTED: HISTORY FLUSHED\r\n"); */
-
 
883
      }
880
      /* interactive mode: display prompt (if echo enabled) and wait for user
884
      /* interactive mode: display prompt (if echo enabled) and wait for user
881
       * command line */
885
       * command line */
882
      if (rmod->flags & FLAG_ECHOFLAG) build_and_display_prompt(BUFFER, *rmod_envseg);
886
      if (rmod->flags & FLAG_ECHOFLAG) build_and_display_prompt(BUFFER, *rmod_envseg);
883
      /* collect user input */
887
      /* collect user input */
884
      cmdline_getinput(FP_SEG(rmod->inputbuf), FP_OFF(rmod->inputbuf));
888
      cmdline_getinput(rmod->rmodseg, RMOD_OFFSET_INPUTBUF);
885
      /* copy it to local cmdline */
889
      /* copy it to local cmdline */
886
      if (rmod->inputbuf[1] != 0) _fmemcpy(cmdline, rmod->inputbuf + 2, rmod->inputbuf[1]);
890
      if (rmod_inputbuf[1] != 0) _fmemcpy(cmdline, rmod_inputbuf + 2, rmod_inputbuf[1]);
887
      cmdline[(unsigned)(rmod->inputbuf[1])] = 0; /* zero-terminate local buff (oriignal is '\r'-terminated) */
891
      cmdline[rmod_inputbuf[1]] = 0; /* zero-terminate local buff (original is '\r'-terminated) */
888
    }
892
    }
889
 
893
 
890
    /* if nothing entered, loop again (but without appending an extra CR/LF) */
894
    /* if nothing entered, loop again (but without appending an extra CR/LF) */
891
    if (cmdline[0] == 0) goto SKIP_NEWLINE;
895
    if (cmdline[0] == 0) goto SKIP_NEWLINE;
892
 
896