/svarcom/cmd/cd.c |
---|
44,14 → 44,8 |
static int cmd_cd(struct cmd_funcparam *p) { |
char *buffptr = p->BUFFER; |
/* two arguments max */ |
if (p->argc > 1) { |
outputnl("Too many parameters"); |
return(-1); |
} |
/* CD /? */ |
if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) { |
if (cmd_ishlp(p)) { |
outputnl("Displays the name of or changes the current directory."); |
outputnl(""); |
outputnl("CHDIR [drive:][path]"); |
66,6 → 60,12 |
return(-1); |
} |
/* one argument max */ |
if (p->argc > 1) { |
outputnl("Too many parameters"); |
return(-1); |
} |
/* no argument? display current drive and dir ("CWD") */ |
if (p->argc == 0) { |
unsigned char drv = 0; |
/svarcom/cmd/exit.c |
---|
6,7 → 6,7 |
*/ |
static int cmd_exit(struct cmd_funcparam *p) { |
if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) { |
if (cmd_ishlp(p)) { |
outputnl("EXIT\r\n"); |
outputnl("Quits the COMMAND.COM program (command interpreter)"); |
} else { |
/svarcom/cmd/mkdir.c |
---|
6,7 → 6,7 |
const char *dname = p->argv[0]; |
unsigned short err = 0; |
if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) { |
if (cmd_ishlp(p)) { |
outputnl("Creates a directory"); |
outputnl(""); |
outputnl("MKDIR [drive:]path"); |
/svarcom/cmd/path.c |
---|
7,6 → 7,20 |
static int cmd_path(struct cmd_funcparam *p) { |
char *buff = p->BUFFER; |
/* help screen (/?) */ |
if (cmd_ishlp(p)) { |
output("Displays or sets a search path for executable files.\r\n" |
"\r\n" |
"PATH [[drive:]path[;...]]\r\n" |
"PATH ;\r\n" |
"\r\n" |
"Type PATH ; to clear all search-path settings and direct DOS to search\r\n" |
"only in the current directory.\r\n" |
"\r\n" |
"Type PATH without parameters to display the current path.\r\n"); |
return(-1); |
} |
/* no parameter - display current path */ |
if (p->argc == 0) { |
char far *curpath = env_lookup(p->env_seg, "PATH"); |
31,20 → 45,6 |
/* IF HERE: THERE IS EXACTLY 1 ARGUMENT (argc == 1) */ |
/* help screen (/?) */ |
if (imatch(p->argv[0], "/?")) { |
output("Displays or sets a search path for executable files.\r\n" |
"\r\n" |
"PATH [[drive:]path[;...]]\r\n" |
"PATH ;\r\n" |
"\r\n" |
"Type PATH ; to clear all search-path settings and direct DOS to search\r\n" |
"only in the current directory.\r\n" |
"\r\n" |
"Type PATH without parameters to display the current path.\r\n"); |
return(-1); |
} |
/* reset the PATH string (PATH ;) */ |
if (imatch(p->argv[0], ";")) { |
env_dropvar(p->env_seg, "PATH"); |
/svarcom/cmd/prompt.c |
---|
6,10 → 6,11 |
*/ |
static int cmd_prompt(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"); |
if (cmd_ishlp(p)) { |
outputnl("Changes the DOS command prompt."); |
outputnl(""); |
outputnl("PROMPT [new command prompt specification]"); |
return(-1); |
} |
/svarcom/cmd/rmdir.c |
---|
6,7 → 6,7 |
const char *dname = p->argv[0]; |
unsigned short err = 0; |
if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) { |
if (cmd_ishlp(p)) { |
outputnl("Removes (deletes) a directory"); |
outputnl(""); |
outputnl("RMDIR [drive:]path"); |
/svarcom/cmd/set.c |
---|
9,6 → 9,18 |
static int cmd_set(struct cmd_funcparam *p) { |
char far *env = MK_FP(p->env_seg, 0); |
char *buff = p->BUFFER; |
if (cmd_ishlp(p)) { |
outputnl("Displays, sets, or removes DOS environment variables"); |
outputnl(""); |
outputnl("SET [variable=[string]]"); |
outputnl(""); |
outputnl("variable Specifies the environment-variable name"); |
outputnl("string Specifies a series of characters to assign to the variable"); |
outputnl(""); |
outputnl("Type SET without parameters to display the current environment variables."); |
} |
/* no arguments - display content */ |
if (p->argc == 0) { |
while (*env != 0) { |
21,15 → 33,6 |
} |
outputnl(buff); |
} |
} else if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) { |
outputnl("Displays, sets, or removes DOS environment variables"); |
outputnl(""); |
outputnl("SET [variable=[string]]"); |
outputnl(""); |
outputnl("variable Specifies the environment-variable name"); |
outputnl("string Specifies a series of characters to assign to the variable"); |
outputnl(""); |
outputnl("Type SET without parameters to display the current environment variables."); |
} else { /* set variable (do not rely on argv, SET has its own rules...) */ |
const char far *ptr; |
unsigned short i; |
/svarcom/cmd/type.c |
---|
7,12 → 7,7 |
const char *fname = p->argv[0]; |
unsigned short err = 0; |
if (p->argc == 0) { |
outputnl("Required parameter missing"); |
return(-1); |
} |
if ((p->argc > 0) && (imatch(p->argv[0], "/?"))) { |
if (cmd_ishlp(p)) { |
outputnl("Displays the contents of a text file."); |
outputnl(""); |
outputnl("TYPE [drive:][path]filename"); |
19,6 → 14,11 |
return(-1); |
} |
if (p->argc == 0) { |
outputnl("Required parameter missing"); |
return(-1); |
} |
if (p->argc > 1) { |
outputnl("Too many parameters"); |
return(-1); |
/svarcom/cmd/ver.c |
---|
9,7 → 9,7 |
unsigned char maj = 0, min = 0; |
/* help screen */ |
if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) { |
if (cmd_ishlp(p)) { |
outputnl("Displays the DOS version."); |
return(-1); |
} |
/svarcom/cmd/verify.c |
---|
4,7 → 4,7 |
static int cmd_verify(struct cmd_funcparam *p) { |
if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) { |
if (cmd_ishlp(p)) { |
outputnl("Tells DOS whether to verify that files are written correctly to disk."); |
outputnl("\r\nVERIFY [ON | OFF]\r\n"); |
outputnl("Type VERIFY without a parameter to display its current setting."); |
/svarcom/cmd.c |
---|
21,6 → 21,15 |
char BUFFER[1024]; /* a buffer for whatever is needed */ |
}; |
/* scans argv for the presence of a "/?" parameter. returns 1 if found, 0 otherwise */ |
static int cmd_ishlp(const struct cmd_funcparam *p) { |
int i; |
for (i = 0; i < p->argc; i++) { |
if ((p->argv[i][0] == '/') && (p->argv[i][1] == '?')) return(1); |
} |
return(0); |
} |
#include "cmd/_notimpl.c" |
#include "cmd/cd.c" |
#include "cmd/dir.c" |