Subversion Repositories SvarDOS

Rev

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

Rev 1715 Rev 1730
Line 44... Line 44...
44
 * mismatch, then it would likely mean that SvarCOM has been upgraded and
44
 * mismatch, then it would likely mean that SvarCOM has been upgraded and
45
 * RMOD should not be accessed as its structure might no longer be in sync
45
 * RMOD should not be accessed as its structure might no longer be in sync
46
 * with what I think it is.
46
 * with what I think it is.
47
 *          *** INCREMENT THIS AT EACH NEW SVARCOM RELEASE! ***
47
 *          *** INCREMENT THIS AT EACH NEW SVARCOM RELEASE! ***
48
 *            (or at least whenever RMOD's struct is changed)            */
48
 *            (or at least whenever RMOD's struct is changed)            */
49
#define BYTE_VERSION 4
49
#define BYTE_VERSION 5
50
 
50
 
51
 
51
 
52
struct config {
52
struct config {
53
  unsigned char flags; /* command.com flags, as defined in rmodinit.h */
53
  unsigned char flags; /* command.com flags, as defined in rmodinit.h */
54
  char *execcmd;
54
  char *execcmd;
Line 400... Line 400...
400
 
400
 
401
 
401
 
402
/* a few internal flags */
402
/* a few internal flags */
403
#define DELETE_STDIN_FILE 1
403
#define DELETE_STDIN_FILE 1
404
#define CALL_FLAG         2
404
#define CALL_FLAG         2
-
 
405
#define LOADHIGH_FLAG     4
405
 
406
 
406
static void run_as_external(char *buff, const char *cmdline, unsigned short envseg, struct rmod_props far *rmod, struct redir_data *redir, unsigned char flags) {
407
static void run_as_external(char *buff, const char *cmdline, unsigned short envseg, struct rmod_props far *rmod, struct redir_data *redir, unsigned char flags) {
407
  char *cmdfile = buff + 512;
408
  char *cmdfile = buff + 512;
408
  const char far *pathptr;
409
  const char far *pathptr;
409
  int lookup;
410
  int lookup;
Line 579... Line 580...
579
  rmod_cmdtail[i] = '\r';
580
  rmod_cmdtail[i] = '\r';
580
  rmod_cmdtail[-1] = i;
581
  rmod_cmdtail[-1] = i;
581
 
582
 
582
  /* set up rmod to execute the command */
583
  /* set up rmod to execute the command */
583
 
584
 
-
 
585
  /* loadhigh? */
-
 
586
  if (flags & LOADHIGH_FLAG) {
-
 
587
    unsigned char far *farptr = MK_FP(rmod->rmodseg, RMOD_OFFSET_EXEC_LH);
-
 
588
    *farptr = 1;
-
 
589
  }
-
 
590
 
584
  ExecParam->envseg = envseg;
591
  ExecParam->envseg = envseg;
585
  ExecParam->cmdtail = (unsigned long)MK_FP(rmod->rmodseg, 0x80); /* farptr, must be in PSP format (lenbyte args \r) */
592
  ExecParam->cmdtail = (unsigned long)MK_FP(rmod->rmodseg, 0x80); /* farptr, must be in PSP format (lenbyte args \r) */
586
  /* far pointers to unopened FCB entries (stored in RMOD's own PSP) */
593
  /* far pointers to unopened FCB entries (stored in RMOD's own PSP) */
587
  {
594
  {
588
    char far *farptr;
595
    char far *farptr;
Line 1154... Line 1161...
1154
      goto EXEC_CMDLINE;
1161
      goto EXEC_CMDLINE;
1155
    } else if (cmdres == CMD_CHANGED_BY_CALL) { /* cmdline changed *specifically* by CALL */
1162
    } else if (cmdres == CMD_CHANGED_BY_CALL) { /* cmdline changed *specifically* by CALL */
1156
      /* the distinction is important since it changes the way batch files are processed */
1163
      /* the distinction is important since it changes the way batch files are processed */
1157
      flags |= CALL_FLAG;
1164
      flags |= CALL_FLAG;
1158
      goto EXEC_CMDLINE;
1165
      goto EXEC_CMDLINE;
-
 
1166
    } else if (cmdres == CMD_CHANGED_BY_LH) { /* cmdline changed *specifically* by LH */
-
 
1167
      flags |= LOADHIGH_FLAG;
-
 
1168
      goto EXEC_CMDLINE;
1159
    } else if (cmdres == CMD_NOTFOUND) {
1169
    } else if (cmdres == CMD_NOTFOUND) {
1160
      /* this was not an internal command, try matching an external command */
1170
      /* this was not an internal command, try matching an external command */
1161
      run_as_external(BUFFER, cmdline, *rmod_envseg, rmod, &redirprops, flags);
1171
      run_as_external(BUFFER, cmdline, *rmod_envseg, rmod, &redirprops, flags);
1162
 
1172
 
1163
      /* is it a newly launched BAT file? */
1173
      /* is it a newly launched BAT file? */
Line 1171... Line 1181...
1171
    }
1181
    }
1172
 
1182
 
1173
    /* reset one-time only flags */
1183
    /* reset one-time only flags */
1174
    flags &= ~CALL_FLAG;
1184
    flags &= ~CALL_FLAG;
1175
    flags &= ~FLAG_STEPBYSTEP;
1185
    flags &= ~FLAG_STEPBYSTEP;
-
 
1186
    flags &= ~LOADHIGH_FLAG;
1176
 
1187
 
1177
    /* repeat unless /C was asked - but always finish running an ongoing batch
1188
    /* repeat unless /C was asked - but always finish running an ongoing batch
1178
     * file (otherwise only first BAT command would be executed with /C) */
1189
     * file (otherwise only first BAT command would be executed with /C) */
1179
  } while (((rmod->flags & FLAG_EXEC_AND_QUIT) == 0) || (rmod->bat != NULL) || (rmod->forloop != NULL));
1190
  } while (((rmod->flags & FLAG_EXEC_AND_QUIT) == 0) || (rmod->bat != NULL) || (rmod->forloop != NULL));
1180
 
1191