Subversion Repositories SvarDOS

Rev

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

Rev 368 Rev 371
Line 6... Line 6...
6
#include <i86.h>
6
#include <i86.h>
7
#include <stdio.h>
7
#include <stdio.h>
8
#include <stdlib.h>
8
#include <stdlib.h>
9
 
9
 
10
#include "doserr.h"
10
#include "doserr.h"
-
 
11
#include "env.h"
11
#include "helpers.h"
12
#include "helpers.h"
12
 
13
 
13
struct cmd_funcparam {
14
struct cmd_funcparam {
14
  int argc;
15
  int argc;                 /* number of arguments */
15
  const char *argv[256];
16
  const char *argv[256];    /* pointers to each argument */
16
  unsigned short env_seg;
17
  unsigned short env_seg;   /* segment of environment block */
-
 
18
  unsigned short argoffset; /* offset of cmdline where first argument starts */
17
  const char far *cmdline;
19
  const char far *cmdline;  /* original cmdline (terminated by \r) */
18
};
20
};
19
 
21
 
20
#include "cmd/cd.c"
22
#include "cmd/cd.c"
21
#include "cmd/dir.c"
23
#include "cmd/dir.c"
22
#include "cmd/exit.c"
24
#include "cmd/exit.c"
-
 
25
#include "cmd/prompt.c"
23
#include "cmd/set.c"
26
#include "cmd/set.c"
24
 
27
 
25
#include "cmd.h"
28
#include "cmd.h"
26
 
29
 
27
 
30
 
Line 33... Line 36...
33
const struct CMD_ID INTERNAL_CMDS[] = {
36
const struct CMD_ID INTERNAL_CMDS[] = {
34
  {"CD",      cmd_cd},
37
  {"CD",      cmd_cd},
35
  {"CHDIR",   cmd_cd},
38
  {"CHDIR",   cmd_cd},
36
  {"DIR",     cmd_dir},
39
  {"DIR",     cmd_dir},
37
  {"EXIT",    cmd_exit},
40
  {"EXIT",    cmd_exit},
-
 
41
  {"PROMPT",  cmd_prompt},
38
  {"SET",     cmd_set},
42
  {"SET",     cmd_set},
39
  {NULL,      NULL}
43
  {NULL,      NULL}
40
};
44
};
41
 
45
 
42
 
46
 
Line 140... Line 144...
140
  /* printf("recognized internal command: '%s', tail of command at offset %u\r\n", cmdptr->cmd, argoffset); */
144
  /* printf("recognized internal command: '%s', tail of command at offset %u\r\n", cmdptr->cmd, argoffset); */
141
 
145
 
142
  /* prepare function parameters and feed it to the cmd handling function */
146
  /* prepare function parameters and feed it to the cmd handling function */
143
  p.argc = cmd_explode(cmdbuff, cmdline + argoffset, p.argv);
147
  p.argc = cmd_explode(cmdbuff, cmdline + argoffset, p.argv);
144
  p.env_seg = env_seg;
148
  p.env_seg = env_seg;
-
 
149
  p.argoffset = argoffset;
145
  p.cmdline = cmdline;
150
  p.cmdline = cmdline;
146
 
151
 
147
  return((cmdptr->func_ptr)(&p));
152
  return((cmdptr->func_ptr)(&p));
148
}
153
}