Subversion Repositories SvarDOS

Rev

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

/*
 * prompt
 *
 * Changes the DOS command prompt.
 *
 */

static int cmd_prompt(struct cmd_funcparam *p) {

  if (cmd_ishlp(p)) {
    outputnl("Changes the DOS command prompt.");
    outputnl("");
    outputnl("PROMPT [new command prompt specification]");
    return(-1);
  }

  /* no parameter - restore default prompt path */
  if (p->argc == 0) {
    env_dropvar(p->env_seg, "PROMPT");
    return(-1);
  }

  /* otherwise set PROMPT to whatever is passed on command-line */
  {
    unsigned short i;
    char *buff = p->BUFFER;
    strcpy(buff, "PROMPT=");
    for (i = 0;; i++) {
      buff[i + 7] = p->cmdline[p->argoffset + i];
      if (buff[i + 7] == '\r') break;
    }
    buff[i + 7] = 0;
    env_setvar(p->env_seg, buff);
  }

  return(-1);
}