Subversion Repositories SvarDOS

Rev

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

Rev 371 Rev 372
Line 4... Line 4...
4
 * value cannot contain any '=' character, but it can contain spaces
4
 * value cannot contain any '=' character, but it can contain spaces
5
 * varname can also contain spaces
5
 * varname can also contain spaces
6
 */
6
 */
7
 
7
 
8
 
8
 
9
static int cmd_set(const struct cmd_funcparam *p) {
9
static int cmd_set(struct cmd_funcparam *p) {
10
  char far *env = MK_FP(p->env_seg, 0);
10
  char far *env = MK_FP(p->env_seg, 0);
11
  char buff[256];
11
  char *buff = p->BUFFER;
12
  int i;
-
 
13
  /* no arguments - display content */
12
  /* no arguments - display content */
14
  if (p->argc == 0) {
13
  if (p->argc == 0) {
15
    while (*env != 0) {
14
    while (*env != 0) {
-
 
15
      unsigned short i;
16
      /* copy string to local buff for display */
16
      /* copy string to local buff for display */
17
      for (i = 0;; i++) {
17
      for (i = 0;; i++) {
18
        buff[i] = *env;
18
        buff[i] = *env;
19
        env++;
19
        env++;
20
        if (buff[i] == 0) break;
20
        if (buff[i] == 0) break;
21
      }
21
      }
22
      puts(buff);
22
      outputnl(buff);
23
    }
23
    }
24
  } else if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) {
24
  } else if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) {
25
    outputnl("TODO: help screen"); /* TODO */
25
    outputnl("TODO: help screen"); /* TODO */
26
  } else { /* set variable (do not rely on argv, SET has its own rules...) */
26
  } else { /* set variable (do not rely on argv, SET has its own rules...) */
27
    const char far *ptr;
27
    const char far *ptr;
28
    char buff[256];
-
 
29
    unsigned short i;
28
    unsigned short i;
30
    /* locate the first space */
29
    /* locate the first space */
31
    for (ptr = p->cmdline; *ptr != ' '; ptr++);
30
    for (ptr = p->cmdline; *ptr != ' '; ptr++);
32
    /* now locate the first non-space: that's where the variable name begins */
31
    /* now locate the first non-space: that's where the variable name begins */
33
    for (; *ptr == ' '; ptr++);
32
    for (; *ptr == ' '; ptr++);