Subversion Repositories SvarDOS

Rev

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

Rev 400 Rev 403
Line 10... Line 10...
10
 
10
 
11
#include "doserr.h"
11
#include "doserr.h"
12
#include "env.h"
12
#include "env.h"
13
#include "helpers.h"
13
#include "helpers.h"
14
 
14
 
-
 
15
#define BUFFER_SIZE 2048    /* make sure this is not bigger than the static buffer in command.c */
-
 
16
 
15
struct cmd_funcparam {
17
struct cmd_funcparam {
16
  int argc;                 /* number of arguments */
18
  int argc;                 /* number of arguments */
17
  const char *argv[256];    /* pointers to each argument */
19
  const char *argv[256];    /* pointers to each argument */
18
  unsigned short env_seg;   /* segment of environment block */
20
  unsigned short env_seg;   /* segment of environment block */
19
  unsigned short argoffset; /* offset of cmdline where first argument starts */
21
  unsigned short argoffset; /* offset of cmdline where first argument starts */
20
  const char far *cmdline;  /* original cmdline (terminated by \r) */
22
  const char far *cmdline;  /* original cmdline (terminated by \r) */
21
  char BUFFER[1024];        /* a buffer for whatever is needed */
23
  char BUFFER[BUFFER_SIZE]; /* a buffer for whatever is needed */
22
};
24
};
23
 
25
 
24
/* scans argv for the presence of a "/?" parameter. returns 1 if found, 0 otherwise */
26
/* scans argv for the presence of a "/?" parameter. returns 1 if found, 0 otherwise */
25
static int cmd_ishlp(const struct cmd_funcparam *p) {
27
static int cmd_ishlp(const struct cmd_funcparam *p) {
26
  int i;
28
  int i;
Line 30... Line 32...
30
  return(0);
32
  return(0);
31
}
33
}
32
 
34
 
33
#include "cmd/_notimpl.c"
35
#include "cmd/_notimpl.c"
34
#include "cmd/cd.c"
36
#include "cmd/cd.c"
-
 
37
#include "cmd/copy.c"
35
#include "cmd/del.c"
38
#include "cmd/del.c"
36
#include "cmd/vol.c"     /* must be included before dir.c due to dependency */
39
#include "cmd/vol.c"     /* must be included before dir.c due to dependency */
37
#include "cmd/dir.c"
40
#include "cmd/dir.c"
38
#include "cmd/exit.c"
41
#include "cmd/exit.c"
39
#include "cmd/mkdir.c"
42
#include "cmd/mkdir.c"
Line 59... Line 62...
59
  {"BREAK",   cmd_notimpl},
62
  {"BREAK",   cmd_notimpl},
60
  {"CD",      cmd_cd},
63
  {"CD",      cmd_cd},
61
  {"CHCP",    cmd_notimpl},
64
  {"CHCP",    cmd_notimpl},
62
  {"CHDIR",   cmd_cd},
65
  {"CHDIR",   cmd_cd},
63
  {"CLS",     cmd_notimpl},
66
  {"CLS",     cmd_notimpl},
64
  {"COPY",    cmd_notimpl},
67
  {"COPY",    cmd_copy},
65
  {"CTTY",    cmd_notimpl},
68
  {"CTTY",    cmd_notimpl},
66
  {"DATE",    cmd_notimpl},
69
  {"DATE",    cmd_notimpl},
67
  {"DEL",     cmd_del},
70
  {"DEL",     cmd_del},
68
  {"DIR",     cmd_dir},
71
  {"DIR",     cmd_dir},
69
  {"ECHO",    cmd_notimpl},
72
  {"ECHO",    cmd_notimpl},
Line 136... Line 139...
136
    while (s[si] == ' ') si++;
139
    while (s[si] == ' ') si++;
137
    /* end of string? */
140
    /* end of string? */
138
    if (s[si] == 0) break;
141
    if (s[si] == 0) break;
139
    /* set argv ptr */
142
    /* set argv ptr */
140
    argvlist[argc++] = buff + i;
143
    argvlist[argc++] = buff + i;
141
    /* find next space while copying arg to local buffer */
144
    /* find next arg delimiter (spc, null, slash or plus) while copying arg to local buffer */
142
    do {
145
    do {
143
      buff[i++] = s[si++];
146
      buff[i++] = s[si++];
144
    } while (s[si] != ' ' && s[si] != 0 && s[si] != '/');
147
    } while (s[si] != ' ' && s[si] != 0 && s[si] != '/' && s[si] != '+');
145
    buff[i++] = 0;
148
    buff[i++] = 0;
146
    /* is this end of string? */
149
    /* is this end of string? */
147
    if (s[si] == 0) break;
150
    if (s[si] == 0) break;
148
  }
151
  }
149
  argvlist[argc] = NULL;
152
  argvlist[argc] = NULL;