Subversion Repositories SvarDOS

Rev

Rev 451 | Rev 989 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 451 Rev 533
Line 28... Line 28...
28
 * value cannot contain any '=' character, but it can contain spaces
28
 * value cannot contain any '=' character, but it can contain spaces
29
 * varname can also contain spaces
29
 * varname can also contain spaces
30
 */
30
 */
31
 
31
 
32
 
32
 
33
static int cmd_set(struct cmd_funcparam *p) {
33
static enum cmd_result cmd_set(struct cmd_funcparam *p) {
34
  char far *env = MK_FP(p->env_seg, 0);
34
  char far *env = MK_FP(p->env_seg, 0);
35
  char *buff = p->BUFFER;
35
  char *buff = p->BUFFER;
36
 
36
 
37
  if (cmd_ishlp(p)) {
37
  if (cmd_ishlp(p)) {
38
    outputnl("Displays, sets, or removes DOS environment variables");
38
    outputnl("Displays, sets, or removes DOS environment variables");
Line 41... Line 41...
41
    outputnl("");
41
    outputnl("");
42
    outputnl("variable  Specifies the environment-variable name");
42
    outputnl("variable  Specifies the environment-variable name");
43
    outputnl("string    Specifies a series of characters to assign to the variable");
43
    outputnl("string    Specifies a series of characters to assign to the variable");
44
    outputnl("");
44
    outputnl("");
45
    outputnl("Type SET without parameters to display the current environment variables.");
45
    outputnl("Type SET without parameters to display the current environment variables.");
46
    return(-1);
46
    return(CMD_OK);
47
  }
47
  }
48
 
48
 
49
  /* no arguments - display content */
49
  /* no arguments - display content */
50
  if (p->argc == 0) {
50
  if (p->argc == 0) {
51
    while (*env != 0) {
51
    while (*env != 0) {
Line 84... Line 84...
84
    buff[i] = 0;
84
    buff[i] = 0;
85
 
85
 
86
    /* commit variable to environment */
86
    /* commit variable to environment */
87
    i = env_setvar(p->env_seg, buff);
87
    i = env_setvar(p->env_seg, buff);
88
    if (i == ENV_INVSYNT) goto syntax_err;
88
    if (i == ENV_INVSYNT) goto syntax_err;
-
 
89
    if (i == ENV_NOTENOM) {
89
    if (i == ENV_NOTENOM) outputnl("Not enough available space within the environment block");
90
      outputnl("Not enough available space within the environment block");
-
 
91
      return(CMD_FAIL);
90
  }
92
    }
-
 
93
  }
91
  return(-1);
94
  return(CMD_OK);
92
 
95
 
93
  syntax_err:
96
  syntax_err:
94
 
97
 
95
  outputnl("Syntax error");
98
  outputnl("Syntax error");
96
  return(-1);
99
  return(CMD_FAIL);
97
}
100
}