Subversion Repositories SvarDOS

Rev

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

Rev 372 Rev 376
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
  if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) {
9
  if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) {
10
    output("Changes the DOS command prompt.\r\n"
10
    output("Changes the DOS command prompt.\r\n"
11
           "\r\n"
11
           "\r\n"
12
           "PROMPT [new command prompt specification]\r\n"
12
           "PROMPT [new command prompt specification]\r\n");
13
           "\r\n");
-
 
14
    return(-1);
13
    return(-1);
15
  }
14
  }
16
 
15
 
17
  /* no parameter - restore default prompt path */
16
  /* no parameter - restore default prompt path */
18
  if (p->argc == 0) {
17
  if (p->argc == 0) {
19
    env_dropvar(p->env_seg, "PROMPT");
18
    env_dropvar(p->env_seg, "PROMPT");
20
    return(-1);
19
    return(-1);
21
  }
20
  }
22
 
21
 
23
  /* otherwise set PROMPT to whatever is passed on command-line */
22
  /* otherwise set PROMPT to whatever is passed on command-line */
24
  {
23
  {
25
    unsigned short i;
24
    unsigned short i;
26
    char *buff = p->BUFFER;
25
    char *buff = p->BUFFER;
27
    strcpy(buff, "PROMPT=");
26
    strcpy(buff, "PROMPT=");
28
    for (i = 0;; i++) {
27
    for (i = 0;; i++) {
29
      buff[i + 7] = p->cmdline[p->argoffset + i];
28
      buff[i + 7] = p->cmdline[p->argoffset + i];
30
      if (buff[i + 7] == '\r') break;
29
      if (buff[i + 7] == '\r') break;
31
    }
30
    }
32
    buff[i + 7] = 0;
31
    buff[i + 7] = 0;
33
    env_setvar(p->env_seg, buff);
32
    env_setvar(p->env_seg, buff);
34
  }
33
  }
35
 
34
 
36
  return(-1);
35
  return(-1);
37
}
36
}
38
 
37