Subversion Repositories SvarDOS

Rev

Rev 372 | Rev 387 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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