Subversion Repositories SvarDOS

Rev

Rev 387 | Rev 421 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 387 Rev 397
1
/*
1
/*
2
 * prompt
2
 * prompt
3
 *
3
 *
4
 * Changes the DOS command prompt.
4
 * Changes the DOS command prompt.
5
 *
5
 *
6
 */
6
 */
7
 
7
 
8
static int cmd_prompt(struct cmd_funcparam *p) {
8
static int cmd_prompt(struct cmd_funcparam *p) {
9
 
9
 
10
  if (cmd_ishlp(p)) {
10
  if (cmd_ishlp(p)) {
11
    outputnl("Changes the DOS command prompt.");
11
    outputnl("Changes the DOS command prompt.");
12
    outputnl("");
12
    outputnl("");
13
    outputnl("PROMPT [new command prompt specification]");
13
    outputnl("PROMPT [new command prompt specification]");
14
    return(-1);
14
    return(-1);
15
  }
15
  }
16
 
16
 
17
  /* no parameter - restore default prompt path */
17
  /* no parameter - restore default prompt path */
18
  if (p->argc == 0) {
18
  if (p->argc == 0) {
19
    env_dropvar(p->env_seg, "PROMPT");
19
    env_dropvar(p->env_seg, "PROMPT");
20
    return(-1);
20
    return(-1);
21
  }
21
  }
22
 
22
 
23
  /* otherwise set PROMPT to whatever is passed on command-line */
23
  /* otherwise set PROMPT to whatever is passed on command-line */
24
  {
24
  {
25
    unsigned short i;
25
    unsigned short i;
26
    char *buff = p->BUFFER;
26
    char *buff = p->BUFFER;
27
    strcpy(buff, "PROMPT=");
27
    strcpy(buff, "PROMPT=");
28
    for (i = 0;; i++) {
28
    for (i = 0;; i++) {
29
      buff[i + 7] = p->cmdline[p->argoffset + i];
29
      buff[i + 7] = p->cmdline[p->argoffset + i];
30
      if (buff[i + 7] == '\r') break;
30
      if (buff[i + 7] == '\r') break;
31
    }
31
    }
32
    buff[i + 7] = 0;
32
    buff[i + 7] = 0;
33
    env_setvar(p->env_seg, buff);
33
    env_setvar(p->env_seg, buff);
34
  }
34
  }
35
 
35
 
36
  return(-1);
36
  return(-1);
37
}
37
}
38
 
38