/svarcom/cmd/prompt.c |
---|
0,0 → 1,36 |
/* |
* prompt |
* |
* Changes the DOS command prompt. |
* |
*/ |
static int cmd_prompt(const struct cmd_funcparam *p) { |
if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) { |
output("Changes the DOS command prompt.\r\n" |
"\r\n" |
"PROMPT [new command prompt specification]\r\n" |
"\r\n"); |
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 */ |
{ |
char buff[256] = "PROMPT="; |
unsigned short i; |
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); |
} |
/svarcom/cmd/set.c |
---|
5,7 → 5,6 |
* varname can also contain spaces |
*/ |
#include "env.h" |
static int cmd_set(const struct cmd_funcparam *p) { |
char far *env = MK_FP(p->env_seg, 0); |
/svarcom/cmd.c |
---|
8,18 → 8,21 |
#include <stdlib.h> |
#include "doserr.h" |
#include "env.h" |
#include "helpers.h" |
struct cmd_funcparam { |
int argc; |
const char *argv[256]; |
unsigned short env_seg; |
const char far *cmdline; |
int argc; /* number of arguments */ |
const char *argv[256]; /* pointers to each argument */ |
unsigned short env_seg; /* segment of environment block */ |
unsigned short argoffset; /* offset of cmdline where first argument starts */ |
const char far *cmdline; /* original cmdline (terminated by \r) */ |
}; |
#include "cmd/cd.c" |
#include "cmd/dir.c" |
#include "cmd/exit.c" |
#include "cmd/prompt.c" |
#include "cmd/set.c" |
#include "cmd.h" |
35,6 → 38,7 |
{"CHDIR", cmd_cd}, |
{"DIR", cmd_dir}, |
{"EXIT", cmd_exit}, |
{"PROMPT", cmd_prompt}, |
{"SET", cmd_set}, |
{NULL, NULL} |
}; |
142,6 → 146,7 |
/* prepare function parameters and feed it to the cmd handling function */ |
p.argc = cmd_explode(cmdbuff, cmdline + argoffset, p.argv); |
p.env_seg = env_seg; |
p.argoffset = argoffset; |
p.cmdline = cmdline; |
return((cmdptr->func_ptr)(&p)); |