Subversion Repositories SvarDOS

Rev

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

Rev 378 Rev 387
Line 7... Line 7...
7
 
7
 
8
 
8
 
9
static int cmd_set(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 = p->BUFFER;
11
  char *buff = p->BUFFER;
-
 
12
 
-
 
13
  if (cmd_ishlp(p)) {
-
 
14
    outputnl("Displays, sets, or removes DOS environment variables");
-
 
15
    outputnl("");
-
 
16
    outputnl("SET [variable=[string]]");
-
 
17
    outputnl("");
-
 
18
    outputnl("variable  Specifies the environment-variable name");
-
 
19
    outputnl("string    Specifies a series of characters to assign to the variable");
-
 
20
    outputnl("");
-
 
21
    outputnl("Type SET without parameters to display the current environment variables.");
-
 
22
  }
-
 
23
 
12
  /* no arguments - display content */
24
  /* no arguments - display content */
13
  if (p->argc == 0) {
25
  if (p->argc == 0) {
14
    while (*env != 0) {
26
    while (*env != 0) {
15
      unsigned short i;
27
      unsigned short i;
16
      /* copy string to local buff for display */
28
      /* copy string to local buff for display */
Line 19... Line 31...
19
        env++;
31
        env++;
20
        if (buff[i] == 0) break;
32
        if (buff[i] == 0) break;
21
      }
33
      }
22
      outputnl(buff);
34
      outputnl(buff);
23
    }
35
    }
24
  } else if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) {
-
 
25
    outputnl("Displays, sets, or removes DOS environment variables");
-
 
26
    outputnl("");
-
 
27
    outputnl("SET [variable=[string]]");
-
 
28
    outputnl("");
-
 
29
    outputnl("variable  Specifies the environment-variable name");
-
 
30
    outputnl("string    Specifies a series of characters to assign to the variable");
-
 
31
    outputnl("");
-
 
32
    outputnl("Type SET without parameters to display the current environment variables.");
-
 
33
  } else { /* set variable (do not rely on argv, SET has its own rules...) */
36
  } else { /* set variable (do not rely on argv, SET has its own rules...) */
34
    const char far *ptr;
37
    const char far *ptr;
35
    unsigned short i;
38
    unsigned short i;
36
    /* locate the first space */
39
    /* locate the first space */
37
    for (ptr = p->cmdline; *ptr != ' '; ptr++);
40
    for (ptr = p->cmdline; *ptr != ' '; ptr++);