Subversion Repositories SvarDOS

Rev

Rev 962 | Rev 1045 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 962 Rev 982
1
/* This file is part of the SvarCOM project and is published under the terms
1
/* This file is part of the SvarCOM project and is published under the terms
2
 * of the MIT license.
2
 * of the MIT license.
3
 *
3
 *
4
 * Copyright (C) 2021-2022 Mateusz Viste
4
 * Copyright (C) 2021-2022 Mateusz Viste
5
 *
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a
6
 * Permission is hereby granted, free of charge, to any person obtaining a
7
 * copy of this software and associated documentation files (the "Software"),
7
 * copy of this software and associated documentation files (the "Software"),
8
 * to deal in the Software without restriction, including without limitation
8
 * to deal in the Software without restriction, including without limitation
9
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
 * and/or sell copies of the Software, and to permit persons to whom the
10
 * and/or sell copies of the Software, and to permit persons to whom the
11
 * Software is furnished to do so, subject to the following conditions:
11
 * Software is furnished to do so, subject to the following conditions:
12
 *
12
 *
13
 * The above copyright notice and this permission notice shall be included in
13
 * The above copyright notice and this permission notice shall be included in
14
 * all copies or substantial portions of the Software.
14
 * all copies or substantial portions of the Software.
15
 *
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
 * DEALINGS IN THE SOFTWARE.
22
 * DEALINGS IN THE SOFTWARE.
23
 */
23
 */
24
 
24
 
25
/* entry point for internal commands, it matches internal commands and
25
/* entry point for internal commands, it matches internal commands and
26
 * executes them.
26
 * executes them.
27
 *
27
 *
28
 * returns one of the following values:
28
 * returns one of the following values:
29
 *   CMD_OK               command executed successfully
29
 *   CMD_OK               command executed successfully
30
 *   CMD_FAIL             command ended in error
30
 *   CMD_FAIL             command ended in error
31
 *   CMD_CHANGED          command-line has been modified (used by IF)
31
 *   CMD_CHANGED          command-line has been modified (used by IF)
32
 *   CMD_CHANGED_BY_CALL  command-line has been modified by CALL
32
 *   CMD_CHANGED_BY_CALL  command-line has been modified by CALL
33
 *   CMD_NOTFOUND         command unrecognized
33
 *   CMD_NOTFOUND         command unrecognized
34
 */
34
 */
35
 
35
 
36
#include <i86.h>
36
#include <i86.h>
37
#include <stdio.h>
37
#include <stdio.h>
38
#include <stdlib.h>
38
#include <stdlib.h>
39
#include <string.h>
39
#include <string.h>
40
 
40
 
41
#include "env.h"
41
#include "env.h"
42
#include "helpers.h"
42
#include "helpers.h"
43
#include "redir.h"
43
#include "redir.h"
44
#include "rmodinit.h"
44
#include "rmodinit.h"
45
#include "sayonara.h"
45
#include "sayonara.h"
46
 
46
 
47
#include "cmd.h"
47
#include "cmd.h"
48
 
48
 
49
 
49
 
50
struct cmd_funcparam {
50
struct cmd_funcparam {
51
  int argc;                 /* number of arguments */
51
  int argc;                 /* number of arguments */
52
  const char *argv[128];    /* pointers to each argument */
52
  const char *argv[128];    /* pointers to each argument */
53
  char argvbuf[256];        /* buffer that hold data pointed out by argv[] */
53
  char argvbuf[256];        /* buffer that hold data pointed out by argv[] */
54
  unsigned short env_seg;   /* segment of environment block */
54
  unsigned short env_seg;   /* segment of environment block */
55
  struct rmod_props far *rmod; /* rmod settings */
55
  struct rmod_props far *rmod; /* rmod settings */
56
  unsigned short argoffset; /* offset of cmdline where first argument starts */
56
  unsigned short argoffset; /* offset of cmdline where first argument starts */
57
  const char *cmdline;      /* original cmdline (terminated by a NULL) */
57
  const char *cmdline;      /* original cmdline (terminated by a NULL) */
58
  unsigned short BUFFERSZ;  /* avail space in BUFFER */
58
  unsigned short BUFFERSZ;  /* avail space in BUFFER */
59
  char BUFFER[1];           /* a buffer for whatever is needed (must be last) */
59
  char BUFFER[1];           /* a buffer for whatever is needed (must be last) */
60
};
60
};
61
 
61
 
62
/* scans argv for the presence of a "/?" parameter. returns 1 if found, 0 otherwise */
62
/* scans argv for the presence of a "/?" parameter. returns 1 if found, 0 otherwise */
63
static int cmd_ishlp(const struct cmd_funcparam *p) {
63
static int cmd_ishlp(const struct cmd_funcparam *p) {
64
  int i;
64
  int i;
65
  for (i = 0; i < p->argc; i++) {
65
  for (i = 0; i < p->argc; i++) {
66
    if ((p->argv[i][0] == '/') && (p->argv[i][1] == '?')) return(1);
66
    if ((p->argv[i][0] == '/') && (p->argv[i][1] == '?')) return(1);
67
  }
67
  }
68
  return(0);
68
  return(0);
69
}
69
}
70
 
70
 
71
#include "cmd/_notimpl.c"
71
#include "cmd/_notimpl.c"
72
#include "cmd/break.c"
72
#include "cmd/break.c"
73
#include "cmd/call.c"
73
#include "cmd/call.c"
74
#include "cmd/cd.c"
74
#include "cmd/cd.c"
75
#include "cmd/chcp.c"
75
#include "cmd/chcp.c"
76
#include "cmd/cls.c"
76
#include "cmd/cls.c"
77
#include "cmd/copy.c"
77
#include "cmd/copy.c"
78
#include "cmd/date.c"
78
#include "cmd/date.c"
79
#include "cmd/del.c"
79
#include "cmd/del.c"
-
 
80
#include "cmd/for.c"
80
#include "cmd/goto.c"
81
#include "cmd/goto.c"
81
#include "cmd/if.c"
82
#include "cmd/if.c"
82
#include "cmd/vol.c"     /* must be included before dir.c due to dependency */
83
#include "cmd/vol.c"     /* must be included before dir.c due to dependency */
83
#include "cmd/dir.c"
84
#include "cmd/dir.c"
84
#include "cmd/echo.c"
85
#include "cmd/echo.c"
85
#include "cmd/exit.c"
86
#include "cmd/exit.c"
86
#include "cmd/ln.c"
87
#include "cmd/ln.c"
87
#include "cmd/mkdir.c"
88
#include "cmd/mkdir.c"
88
#include "cmd/path.c"
89
#include "cmd/path.c"
89
#include "cmd/pause.c"
90
#include "cmd/pause.c"
90
#include "cmd/prompt.c"
91
#include "cmd/prompt.c"
91
#include "cmd/rem.c"
92
#include "cmd/rem.c"
92
#include "cmd/rename.c"
93
#include "cmd/rename.c"
93
#include "cmd/rmdir.c"
94
#include "cmd/rmdir.c"
94
#include "cmd/set.c"
95
#include "cmd/set.c"
95
#include "cmd/shift.c"
96
#include "cmd/shift.c"
96
#include "cmd/time.c"
97
#include "cmd/time.c"
97
#include "cmd/type.c"
98
#include "cmd/type.c"
98
#include "cmd/ver.c"
99
#include "cmd/ver.c"
99
#include "cmd/verify.c"
100
#include "cmd/verify.c"
100
 
101
 
101
 
102
 
102
struct CMD_ID {
103
struct CMD_ID {
103
  const char *cmd;
104
  const char *cmd;
104
  enum cmd_result (*func_ptr)(struct cmd_funcparam *); /* pointer to handling function */
105
  enum cmd_result (*func_ptr)(struct cmd_funcparam *); /* pointer to handling function */
105
};
106
};
106
 
107
 
107
const struct CMD_ID INTERNAL_CMDS[] = {
108
const struct CMD_ID INTERNAL_CMDS[] = {
108
  {"BREAK",   cmd_break},
109
  {"BREAK",   cmd_break},
109
  {"CALL",    cmd_call},
110
  {"CALL",    cmd_call},
110
  {"CD",      cmd_cd},
111
  {"CD",      cmd_cd},
111
  {"CHCP",    cmd_chcp},
112
  {"CHCP",    cmd_chcp},
112
  {"CHDIR",   cmd_cd},
113
  {"CHDIR",   cmd_cd},
113
  {"CLS",     cmd_cls},
114
  {"CLS",     cmd_cls},
114
  {"COPY",    cmd_copy},
115
  {"COPY",    cmd_copy},
115
  {"CTTY",    cmd_notimpl},
116
  {"CTTY",    cmd_notimpl},
116
  {"DATE",    cmd_date},
117
  {"DATE",    cmd_date},
117
  {"DEL",     cmd_del},
118
  {"DEL",     cmd_del},
118
  {"DIR",     cmd_dir},
119
  {"DIR",     cmd_dir},
119
  {"ECHO",    cmd_echo},
120
  {"ECHO",    cmd_echo},
120
  {"ERASE",   cmd_del},
121
  {"ERASE",   cmd_del},
121
  {"EXIT",    cmd_exit},
122
  {"EXIT",    cmd_exit},
-
 
123
  {"FOR",     cmd_for},
122
  {"GOTO",    cmd_goto},
124
  {"GOTO",    cmd_goto},
123
  {"IF",      cmd_if},
125
  {"IF",      cmd_if},
124
  {"LH",      cmd_notimpl},
126
  {"LH",      cmd_notimpl},
125
  {"LN",      cmd_ln},
127
  {"LN",      cmd_ln},
126
  {"LOADHIGH",cmd_notimpl},
128
  {"LOADHIGH",cmd_notimpl},
127
  {"MD",      cmd_mkdir},
129
  {"MD",      cmd_mkdir},
128
  {"MKDIR",   cmd_mkdir},
130
  {"MKDIR",   cmd_mkdir},
129
  {"PAUSE",   cmd_pause},
131
  {"PAUSE",   cmd_pause},
130
  {"PATH",    cmd_path},
132
  {"PATH",    cmd_path},
131
  {"PROMPT",  cmd_prompt},
133
  {"PROMPT",  cmd_prompt},
132
  {"RD",      cmd_rmdir},
134
  {"RD",      cmd_rmdir},
133
  {"REM",     cmd_rem},
135
  {"REM",     cmd_rem},
134
  {"REN",     cmd_rename},
136
  {"REN",     cmd_rename},
135
  {"RENAME",  cmd_rename},
137
  {"RENAME",  cmd_rename},
136
  {"RMDIR",   cmd_rmdir},
138
  {"RMDIR",   cmd_rmdir},
137
  {"SET",     cmd_set},
139
  {"SET",     cmd_set},
138
  {"SHIFT",   cmd_shift},
140
  {"SHIFT",   cmd_shift},
139
  {"TIME",    cmd_time},
141
  {"TIME",    cmd_time},
140
  {"TYPE",    cmd_type},
142
  {"TYPE",    cmd_type},
141
  {"VER",     cmd_ver},
143
  {"VER",     cmd_ver},
142
  {"VERIFY",  cmd_verify},
144
  {"VERIFY",  cmd_verify},
143
  {"VOL",     cmd_vol},
145
  {"VOL",     cmd_vol},
144
  {NULL,      NULL}
146
  {NULL,      NULL}
145
};
147
};
146
 
148
 
147
 
149
 
148
/* NULL if cmdline is not matching an internal command, otherwise returns a
150
/* NULL if cmdline is not matching an internal command, otherwise returns a
149
 * pointer to a CMD_ID struct */
151
 * pointer to a CMD_ID struct */
150
static const struct CMD_ID *cmd_match(const char *cmdline, unsigned short *argoffset) {
152
static const struct CMD_ID *cmd_match(const char *cmdline, unsigned short *argoffset) {
151
  unsigned short i;
153
  unsigned short i;
152
  char buff[10];
154
  char buff[10];
153
 
155
 
154
  /* copy command to buffer, until space, NULL, tab, return, dot, slash or backslash */
156
  /* copy command to buffer, until space, NULL, tab, return, dot, slash or backslash */
155
  for (i = 0; i < 9; i++) {
157
  for (i = 0; i < 9; i++) {
156
    if (cmdline[i] == ' ') break;
158
    if (cmdline[i] == ' ') break;
157
    if (cmdline[i] == 0) break;
159
    if (cmdline[i] == 0) break;
158
    if (cmdline[i] == '\t') break;
160
    if (cmdline[i] == '\t') break;
159
    if (cmdline[i] == '\r') break;
161
    if (cmdline[i] == '\r') break;
160
    if (cmdline[i] == '.') break;
162
    if (cmdline[i] == '.') break;
161
    if (cmdline[i] == '/') break;
163
    if (cmdline[i] == '/') break;
162
    if (cmdline[i] == '\\') break;
164
    if (cmdline[i] == '\\') break;
163
    buff[i] = cmdline[i];
165
    buff[i] = cmdline[i];
164
  }
166
  }
165
  buff[i] = 0;
167
  buff[i] = 0;
166
 
168
 
167
  /* advance to nearest non-space to find where arguments start */
169
  /* advance to nearest non-space to find where arguments start */
168
  while (cmdline[i] == ' ') i++;
170
  while (cmdline[i] == ' ') i++;
169
  *argoffset = i;
171
  *argoffset = i;
170
 
172
 
171
  /* try matching an internal command */
173
  /* try matching an internal command */
172
  for (i = 0; INTERNAL_CMDS[i].cmd != NULL; i++) {
174
  for (i = 0; INTERNAL_CMDS[i].cmd != NULL; i++) {
173
    /*printf("imatch(%s,%s)\r\n", buff, INTERNAL_CMDS[i].cmd); */
175
    /*printf("imatch(%s,%s)\r\n", buff, INTERNAL_CMDS[i].cmd); */
174
    if (imatch(buff, INTERNAL_CMDS[i].cmd)) {
176
    if (imatch(buff, INTERNAL_CMDS[i].cmd)) {
175
      /*printf("match cmd i=%u (buff=%s)\r\n", i, buff);*/
177
      /*printf("match cmd i=%u (buff=%s)\r\n", i, buff);*/
176
      return(&(INTERNAL_CMDS[i]));
178
      return(&(INTERNAL_CMDS[i]));
177
    }
179
    }
178
  }
180
  }
179
 
181
 
180
  return(NULL); /* command is not recognized as internal */
182
  return(NULL); /* command is not recognized as internal */
181
}
183
}
182
 
184
 
183
 
185
 
184
/* explodes a command into an array of arguments where last arg is NULL.
186
/* explodes a command into an array of arguments where last arg is NULL.
185
 * if argvlist is not NULL, it will be filled with pointers that point to buff
187
 * if argvlist is not NULL, it will be filled with pointers that point to buff
186
 * locations. buff is filled with all the arguments, each argument being
188
 * locations. buff is filled with all the arguments, each argument being
187
 * zero-separated. buff is terminated with an empty argument to mark the end
189
 * zero-separated. buff is terminated with an empty argument to mark the end
188
 * of arguments.
190
 * of arguments.
189
 * returns number of args */
191
 * returns number of args */
190
unsigned short cmd_explode(char *buff, const char far *s, char const **argvlist) {
192
unsigned short cmd_explode(char *buff, const char far *s, char const **argvlist) {
191
  int si = 0, argc = 0, i = 0;
193
  int si = 0, argc = 0, i = 0;
192
  for (;;) {
194
  for (;;) {
193
    /* skip to next non-space character */
195
    /* skip to next non-space character */
194
    while (s[si] == ' ') si++;
196
    while (s[si] == ' ') si++;
195
    /* end of string? */
197
    /* end of string? */
196
    if (s[si] == 0) break;
198
    if (s[si] == 0) break;
197
    /* set argv ptr */
199
    /* set argv ptr */
198
    if (argvlist) argvlist[argc] = buff + i;
200
    if (argvlist) argvlist[argc] = buff + i;
199
    argc++;
201
    argc++;
200
    /* find next arg delimiter (spc, null, slash or plus) while copying arg to local buffer */
202
    /* find next arg delimiter (spc, null, slash or plus) while copying arg to local buffer */
201
    do {
203
    do {
202
      buff[i++] = s[si++];
204
      buff[i++] = s[si++];
203
    } while (s[si] != ' ' && s[si] != 0 && s[si] != '/' && s[si] != '+');
205
    } while (s[si] != ' ' && s[si] != 0 && s[si] != '/' && s[si] != '+');
204
    buff[i++] = 0;
206
    buff[i++] = 0;
205
    /* is this end of string? */
207
    /* is this end of string? */
206
    if (s[si] == 0) break;
208
    if (s[si] == 0) break;
207
  }
209
  }
208
  buff[i] = 0; /* terminate with one extra zero to tell "this is the end of list" */
210
  buff[i] = 0; /* terminate with one extra zero to tell "this is the end of list" */
209
  if (argvlist) argvlist[argc] = NULL;
211
  if (argvlist) argvlist[argc] = NULL;
210
  return(argc);
212
  return(argc);
211
}
213
}
212
 
214
 
213
 
215
 
214
enum cmd_result cmd_process(struct rmod_props far *rmod, unsigned short env_seg, const char *cmdline, void *BUFFER, unsigned short BUFFERSZ, const struct redir_data *redir, unsigned char delstdin) {
216
enum cmd_result cmd_process(struct rmod_props far *rmod, unsigned short env_seg, const char *cmdline, void *BUFFER, unsigned short BUFFERSZ, const struct redir_data *redir, unsigned char delstdin) {
215
  const struct CMD_ID *cmdptr;
217
  const struct CMD_ID *cmdptr;
216
  unsigned short argoffset;
218
  unsigned short argoffset;
217
  enum cmd_result cmdres;
219
  enum cmd_result cmdres;
218
  struct cmd_funcparam *p = (void *)BUFFER;
220
  struct cmd_funcparam *p = (void *)BUFFER;
219
  p->BUFFERSZ = BUFFERSZ - sizeof(*p);
221
  p->BUFFERSZ = BUFFERSZ - sizeof(*p);
220
 
222
 
221
  /* special case: is this a drive change? (like "E:") */
223
  /* special case: is this a drive change? (like "E:") */
222
  if ((cmdline[0] != 0) && (cmdline[1] == ':') && ((cmdline[2] == ' ') || (cmdline[2] == 0))) {
224
  if ((cmdline[0] != 0) && (cmdline[1] == ':') && ((cmdline[2] == ' ') || (cmdline[2] == 0))) {
223
    if (((cmdline[0] >= 'a') && (cmdline[0] <= 'z')) || ((cmdline[0] >= 'A') && (cmdline[0] <= 'Z'))) {
225
    if (((cmdline[0] >= 'a') && (cmdline[0] <= 'z')) || ((cmdline[0] >= 'A') && (cmdline[0] <= 'Z'))) {
224
      unsigned char drive = cmdline[0];
226
      unsigned char drive = cmdline[0];
225
      unsigned char curdrive = 0;
227
      unsigned char curdrive = 0;
226
      if (drive >= 'a') {
228
      if (drive >= 'a') {
227
        drive -= 'a';
229
        drive -= 'a';
228
      } else {
230
      } else {
229
        drive -= 'A';
231
        drive -= 'A';
230
      }
232
      }
231
      _asm {
233
      _asm {
232
        push ax
234
        push ax
233
        push dx
235
        push dx
234
        mov ah, 0x0e     /* DOS 1+ - SELECT DEFAULT DRIVE */
236
        mov ah, 0x0e     /* DOS 1+ - SELECT DEFAULT DRIVE */
235
        mov dl, drive    /* DL = new default drive (00h = A:, 01h = B:, etc) */
237
        mov dl, drive    /* DL = new default drive (00h = A:, 01h = B:, etc) */
236
        int 0x21
238
        int 0x21
237
        mov ah, 0x19     /* DOS 1+ - GET CURRENT DRIVE */
239
        mov ah, 0x19     /* DOS 1+ - GET CURRENT DRIVE */
238
        int 0x21
240
        int 0x21
239
        mov curdrive, al /* cur drive (0=A, 1=B, etc) */
241
        mov curdrive, al /* cur drive (0=A, 1=B, etc) */
240
        pop dx
242
        pop dx
241
        pop ax
243
        pop ax
242
      }
244
      }
243
      if (curdrive == drive) return(CMD_OK);
245
      if (curdrive == drive) return(CMD_OK);
244
      nls_outputnl_doserr(0x0f);
246
      nls_outputnl_doserr(0x0f);
245
      return(CMD_FAIL);
247
      return(CMD_FAIL);
246
    }
248
    }
247
  }
249
  }
248
 
250
 
249
  /* try matching an internal command */
251
  /* try matching an internal command */
250
  cmdptr = cmd_match(cmdline, &argoffset);
252
  cmdptr = cmd_match(cmdline, &argoffset);
251
  if (cmdptr == NULL) return(CMD_NOTFOUND); /* command is not recognized as internal */
253
  if (cmdptr == NULL) return(CMD_NOTFOUND); /* command is not recognized as internal */
252
 
254
 
253
  /* printf("recognized internal command: '%s', tail of command at offset %u\r\n", cmdptr->cmd, argoffset); */
255
  /* printf("recognized internal command: '%s', tail of command at offset %u\r\n", cmdptr->cmd, argoffset); */
254
 
256
 
255
  /* apply redirections (if any) */
257
  /* apply redirections (if any) */
256
  if (redir_apply(redir) != 0) return(CMD_FAIL);
258
  if (redir_apply(redir) != 0) return(CMD_FAIL);
257
 
259
 
258
  /* prepare function parameters and feed it to the cmd handling function */
260
  /* prepare function parameters and feed it to the cmd handling function */
259
  p->argc = cmd_explode(p->argvbuf, cmdline + argoffset, p->argv);
261
  p->argc = cmd_explode(p->argvbuf, cmdline + argoffset, p->argv);
260
  p->env_seg = env_seg;
262
  p->env_seg = env_seg;
261
  p->rmod = rmod;
263
  p->rmod = rmod;
262
  p->argoffset = argoffset;
264
  p->argoffset = argoffset;
263
  p->cmdline = cmdline;
265
  p->cmdline = cmdline;
264
 
266
 
265
  cmdres = (cmdptr->func_ptr)(p);
267
  cmdres = (cmdptr->func_ptr)(p);
266
 
268
 
267
  /* cancel redirections */
269
  /* cancel redirections */
268
  redir_revert();
270
  redir_revert();
269
 
271
 
270
  /* delete stdin temporary file */
272
  /* delete stdin temporary file */
271
  if (delstdin) {
273
  if (delstdin) {
272
    const char *fname = redir->stdinfile;
274
    const char *fname = redir->stdinfile;
273
    unsigned short doserr = 0;
275
    unsigned short doserr = 0;
274
    _asm {
276
    _asm {
275
      push ax
277
      push ax
276
      push dx
278
      push dx
277
      mov ah, 0x41  /* delete a file */
279
      mov ah, 0x41  /* delete a file */
278
      mov dx, fname /* DS:DX - filename to delete */
280
      mov dx, fname /* DS:DX - filename to delete */
279
      int 0x21
281
      int 0x21
280
      jnc DONE
282
      jnc DONE
281
      mov doserr, ax
283
      mov doserr, ax
282
      DONE:
284
      DONE:
283
      pop dx
285
      pop dx
284
      pop ax
286
      pop ax
285
    }
287
    }
286
    if (doserr) {
288
    if (doserr) {
287
      output(fname);
289
      output(fname);
288
      output(": ");
290
      output(": ");
289
      nls_outputnl_doserr(doserr);
291
      nls_outputnl_doserr(doserr);
290
    }
292
    }
291
  }
293
  }
292
 
294
 
293
  return(cmdres);
295
  return(cmdres);
294
}
296
}
295
 
297