Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 988 → Rev 989

/svarcom/trunk/cmd/break.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
30,11 → 30,11
unsigned char brkflag = 0;
 
if (cmd_ishlp(p)) {
outputnl("Sets or clears extended CTRL+C checking");
nls_outputnl(14,0); /* "Sets or clears extended CTRL+C checking" */
outputnl("");
outputnl("BREAK [ON | OFF]");
outputnl("");
outputnl("Type BREAK without a parameter to display the current BREAK setting.");
nls_outputnl(14,1); /* "Type BREAK without a parameter to display the current BREAK setting." */
return(CMD_OK);
}
 
52,9 → 52,9
pop ax
}
if (brkflag == 0) {
outputnl("BREAK is off");
nls_outputnl(14,2); /* "BREAK is off" */
} else {
outputnl("BREAK is on");
nls_outputnl(14,3); /* "BREAK is on" */
}
return(CMD_OK);
}
61,7 → 61,7
 
/* too many params? */
if (p->argc > 1) {
outputnl("Too many parameters");
nls_outputnl(0,4);
return(CMD_FAIL);
}
 
69,7 → 69,7
if (imatch(p->argv[0], "on")) {
brkflag = 1;
} else if (!imatch(p->argv[0], "off")) {
outputnl("Invalid parameter");
nls_outputnl(0,6); /* "Invalid parameter" */
return(CMD_FAIL);
}
 
/svarcom/trunk/cmd/call.c
33,9 → 33,9
 
static enum cmd_result cmd_call(struct cmd_funcparam *p) {
if (cmd_ishlp(p)) {
outputnl("Calls one batch program from another");
nls_outputnl(13,0); /* "Calls one batch program from another" */
outputnl("");
outputnl("CALL [drive:][path]filename [batch-parameters]");
nls_outputnl(13,1); /* "CALL [drive:][path]filename [batch-parameters]" */
return(CMD_OK);
}
 
/svarcom/trunk/cmd/cd.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
40,23 → 40,23
 
/* CD /? */
if (cmd_ishlp(p)) {
outputnl("Displays the name of or changes the current directory.");
nls_outputnl(12,0); /* "Displays the name of or changes the current directory." */
outputnl("");
outputnl("CHDIR [drive:][path]");
outputnl("CHDIR[..]");
outputnl("CD [drive:][path]");
outputnl("CD[..]");
nls_outputnl(12,1); /* "CHDIR [drive:][path]" */
nls_outputnl(12,2); /* "CHDIR[..]" */
nls_outputnl(12,3); /* "CD [drive:][path]" */
nls_outputnl(12,4); /* "CD[..]" */
outputnl("");
outputnl(".. Specifies that you want to change to the parent directory.");
nls_outputnl(12,5); /* ".. Specifies that you want to change to the parent directory." */
outputnl("");
outputnl("Type CD drive: to display the current directory in the specified drive.");
outputnl("Type CD without parameters to display the current drive and directory.");
nls_outputnl(12,6); /* "Type CD drive: to display the current directory in the specified drive." */
nls_outputnl(12,7); /* "Type CD without parameters to display the current drive and directory." */
return(CMD_OK);
}
 
/* one argument max */
if (p->argc > 1) {
outputnl("Too many parameters");
nls_outputnl(0,4); /* "Too many parameters" */
return(CMD_FAIL);
}
 
/svarcom/trunk/cmd/chcp.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
31,19 → 31,19
unsigned short errcode = 0;
 
if (cmd_ishlp(p)) {
outputnl("Displays or sets the active code page number");
nls_outputnl(11,0); /* "Displays or sets the active code page number" */
outputnl("");
outputnl("CHCP [nnn]");
nls_outputnl(11,1); /* "CHCP [nnn]" */
outputnl("");
outputnl("nnn Specifies a code page number");
nls_outputnl(11,2); /* "nnn Specifies a code page number" */
outputnl("");
outputnl("Type CHCP without a parameter to display the active code page number.");
nls_outputnl(11,3); /* "Type CHCP without a parameter to display the active code page number." */
return(CMD_OK);
}
 
/* too many parameters */
if (p->argc > 1) {
outputnl("Too many parameters");
nls_outputnl(0,4); /* "Too many parameters" */
return(CMD_FAIL);
}
 
51,7 → 51,7
if (p->argc == 1) {
unsigned char nlsfuncflag = 0;
if (atous(&nnn, p->argv[0]) != 0) {
outputnl("Invalid code page number");
nls_outputnl(11,4); /* "Invalid code page number" */
return(CMD_FAIL);
}
_asm {
78,9 → 78,9
pop ax
}
if (nlsfuncflag == 0) {
outputnl("NLSFUNC not installed");
nls_outputnl(11,5); /* "NLSFUNC not installed" */
} else if (errcode != 0) {
outputnl("Failed to change code page");
nls_outputnl(11,6); /* "Failed to change code page" */
return(CMD_FAIL);
}
 
103,7 → 103,9
pop ax
}
if (errcode == 0) {
sprintf(p->BUFFER, "Active code page: %d", nnn);
nls_output(11,7); /* Active code page: */
output(" ");
sprintf(p->BUFFER, "%u", nnn);
outputnl(p->BUFFER);
} else {
nls_outputnl_doserr(errcode);
/svarcom/trunk/cmd/cls.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
31,7 → 31,7
const char *ansiesc = "\x1B[2J$";
 
if (cmd_ishlp(p)) {
outputnl("Clears the screen");
nls_outputnl(10,0); /* "Clears the screen" */
outputnl("");
outputnl("CLS");
return(CMD_OK);
/svarcom/trunk/cmd/date.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
138,12 → 138,11
unsigned char mo, dy;
 
if (cmd_ishlp(p)) {
outputnl("Displays or sets the system date.");
nls_outputnl(32,0); /* "Displays or sets the system date."); */
outputnl("");
outputnl("DATE [date]");
nls_outputnl(32,1); /* "DATE [date]" */
outputnl("");
outputnl("Type DATE with no parameters to display the current date and a prompt for a");
outputnl("new one. Press ENTER to keep the same date.");
nls_outputnl(32,2); /* "Type DATE with no parameters to display the (...)" */
return(CMD_OK);
}
 
173,12 → 172,12
}
buff[0] = ' ';
nls_format_date(buff + 1, year, mo, dy, nls);
output("Current date is");
nls_output(32,4); /* "Current date is" */
outputnl(buff);
year = 0;
} else { /* parse date if provided */
if ((cmd_date_parse(p->argv[0], &year, &mo, &dy, nls) != 0) || (cmd_date_set(year, mo, dy) != 0)) {
outputnl("Invalid date");
nls_outputnl(32,3); /* "Invalid date" */
year = 0;
}
}
185,7 → 184,7
 
/* ask for date if not provided or if input was malformed */
while (year == 0) {
output("Enter new date:");
nls_output(32,5); /* "Enter new date:" */
output(" ");
/* collect user input into buff */
_asm {
219,7 → 218,7
}
if (buff[1] == 0) break; /* empty string = no date change */
if ((cmd_date_parse(buff + 2, &year, &mo, &dy, nls) == 0) && (cmd_date_set(year, mo, dy) == 0)) break;
outputnl("Invalid date");
nls_outputnl(32,3); /* "Invalid date" */
}
 
return(CMD_OK);
/svarcom/trunk/cmd/echo.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
31,12 → 31,12
 
/* display help only if /? is the only argument */
if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) {
outputnl("Displays messages, or turns command-echoing on or off");
nls_outputnl(31,0); /* "Displays messages, or turns command-echoing on or off" */
outputnl("");
outputnl("ECHO [ON | OFF]");
outputnl("ECHO [message]");
nls_outputnl(31,1); /* "ECHO [message]" */
outputnl("");
outputnl("Type ECHO without parameters to display the current echo setting.");
nls_outputnl(31,2); /* "Type ECHO without parameters to display the current setting." */
return(CMD_OK);
}
 
43,9 → 43,9
/* ECHO without any parameter: display current state */
if (p->argc == 0) {
if (p->rmod->flags & FLAG_ECHOFLAG) {
outputnl("ECHO is on");
nls_outputnl(31,3); /* "ECHO is on" */
} else {
outputnl("ECHO is off");
nls_outputnl(31,4); /* "ECHO is off" */
}
return(CMD_OK);
}
/svarcom/trunk/cmd/exit.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
32,7 → 32,7
static enum cmd_result cmd_exit(struct cmd_funcparam *p) {
if (cmd_ishlp(p)) {
outputnl("EXIT\r\n");
outputnl("Quits the COMMAND.COM program (command interpreter)");
nls_outputnl(30,0); /* "Quits the COMMAND.COM program (command interpreter)" */
} else {
sayonara(p->rmod);
}
/svarcom/trunk/cmd/ln.c
44,7 → 44,7
 
/* does EXENAME in DIRECTORY exist? */
if (lookup_cmd(buff, linkname, realdirname, &ext) != 0) {
outputnl("No matching executable found in given path.");
nls_outputnl(29,4); /* "No matching executable found in given path." */
return(CMD_FAIL);
}
 
103,7 → 103,7
/* is the argument valid? (must not contain any dot nor backslash) */
for (i = 0; linkname[i] != 0; i++) {
if ((linkname[i] == '.') || (linkname[i] == '/') || (linkname[i] == '\\')) {
outputnl("Bad link name");
nls_outputnl(0,3); /* "Invalid parameter format" */
return(CMD_OK);
}
}
151,7 → 151,7
case '.':
case '/':
case '\\':
outputnl("Invalid link pattern");
nls_outputnl(0,3); /* "Invalid parameter format" */
return(CMD_FAIL);
}
}
162,7 → 162,7
/* fetch %DOSDIR% */
pathlen = env_lookup_valcopy(buff, 128, env_seg, "DOSDIR");
if (pathlen == 0) {
outputnl("%DOSDIR% not defined");
nls_outputnl(29,5); /* "%DOSDIR% not defined" */
return(CMD_FAIL);
}
 
231,16 → 231,16
 
static enum cmd_result cmd_ln(struct cmd_funcparam *p) {
if (cmd_ishlp(p)) {
outputnl("Adds, deletes or displays executable links.");
nls_outputnl(29,0); /* "Adds, deletes or displays executable links." */
outputnl("");
outputnl("LN ADD linkname targetdir");
outputnl("LN DEL linkname");
outputnl("LN LIST [pattern]");
nls_outputnl(29,1); /* "LN ADD linkname targetdir" */
nls_outputnl(29,2); /* "LN DEL linkname" */
nls_outputnl(29,3); /* "LN LIST [pattern]" */
return(CMD_OK);
}
 
if (p->argc == 0) {
outputnl("Not enough parameters");
nls_outputnl(0,7); /* "Required parameter missing */
return(CMD_OK);
}
 
252,6 → 252,6
if (p->argc == 2) return(cmd_lnlist(p->BUFFER, p->argv[1], p->env_seg));
}
 
outputnl("Invalid argument");
nls_outputnl(0,6); /* "Invalid parameter" */
return(CMD_FAIL);
}
/svarcom/trunk/cmd/mkdir.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
31,25 → 31,25
unsigned short err = 0;
 
if (cmd_ishlp(p)) {
outputnl("Creates a directory");
nls_outputnl(28,0); /* "Creates a directory" */
outputnl("");
outputnl("MKDIR [drive:]path");
outputnl("MD [drive:]path");
nls_outputnl(28,1); /* "MKDIR [drive:]path" */
nls_outputnl(28,2); /* "MD [drive:]path" */
return(CMD_OK);
}
 
if (p->argc == 0) {
outputnl("Required parameter missing");
nls_outputnl(0,7); /* "Required parameter missing" */
return(CMD_FAIL);
}
 
if (p->argc > 1) {
outputnl("Too many parameters");
nls_outputnl(0,4); /* "Too many parameters" */
return(CMD_FAIL);
}
 
if (p->argv[0][0] == '/') {
outputnl("Invalid parameter");
nls_outputnl(0,6); /* "Invalid parameter" */
return(CMD_FAIL);
}
 
/svarcom/trunk/cmd/path.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
33,15 → 33,14
 
/* 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");
nls_outputnl(27,0); /* "Displays or sets a search path for executable files." */
outputnl("");
nls_outputnl(27,1); /* "PATH [[drive:]path[;...]]" */
outputnl("PATH ;");
outputnl("");
nls_outputnl(27,2); /* "Type PATH ; to clear all search-path settings and (...)" */
outputnl("");
nls_outputnl(27,3); /* "Type PATH without parameters to display the current path." */
return(CMD_OK);
}
 
49,7 → 48,7
if (p->argc == 0) {
char far *curpath = env_lookup(p->env_seg, "PATH");
if (curpath == NULL) {
outputnl("No Path");
nls_outputnl(27,4); /* "No Path" */
} else {
unsigned short i;
for (i = 0;; i++) {
63,7 → 62,7
 
/* more than 1 parameter */
if (p->argc > 1) {
outputnl("Too many parameters");
nls_outputnl(0,4); /* "Too many parameters" */
return(CMD_FAIL);
}
 
/svarcom/trunk/cmd/prompt.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
32,9 → 32,9
static enum cmd_result cmd_prompt(struct cmd_funcparam *p) {
 
if (cmd_ishlp(p)) {
outputnl("Changes the DOS command prompt.");
nls_outputnl(33,0); /* "Changes the DOS command prompt." */
outputnl("");
outputnl("PROMPT [new command prompt specification]");
nls_outputnl(33,1); /* "PROMPT [new command prompt specification]" */
return(CMD_OK);
}
 
/svarcom/trunk/cmd/rem.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
30,9 → 30,9
/* help screen ONLY if /? is the only argument - I do not want to output
* help for ex. for "REM mouse.com /?" */
if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) {
outputnl("Records comments (remarks) in a batch file or CONFIG.SYS");
nls_outputnl(26,0); /* "Records comments (remarks) in a batch file or CONFIG.SYS" */
outputnl("");
outputnl("REM [comment]");
nls_outputnl(26,1); /* "REM [comment]" */
}
return(CMD_OK);
}
/svarcom/trunk/cmd/rename.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
35,19 → 35,18
struct DTA *dta = (void *)0x80; /* use default DTA in PSP */
 
if (cmd_ishlp(p)) {
outputnl("Renames a file or files");
nls_outputnl(25,0); /* "Renames a file" */
outputnl("");
outputnl("RENAME [drive:][path]filename1 filename2");
outputnl("REN [drive:][path]filename1 filename2");
nls_outputnl(25,1); /* "RENAME [drive:][path]filename1 filename2" */
nls_outputnl(25,2); /* "REN [drive:][path]filename1 filename2" */
outputnl("");
outputnl("Note that you cannot specify a new drive or path for your destination file.");
outputnl("Use MOVE to rename a directory, or to move files from one directory to another.");
nls_outputnl(25,3); /* "Note that you cannot specify a new drive or (...)" */
return(CMD_OK);
}
 
/* I expect exactly two arguments */
if (p->argc != 2) {
outputnl("Invalid syntax");
nls_outputnl(0,1); /* "Invalid syntax" */
return(CMD_FAIL);
}
 
73,7 → 72,7
case ':':
case '\\':
case '/':
outputnl("Invalid destination");
nls_outputnl(25,4); /* "Invalid destination" */
return(CMD_FAIL);
}
buff1[fnameoffset + i] = p->argv[1][i];
/svarcom/trunk/cmd/rmdir.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
31,25 → 31,25
unsigned short err = 0;
 
if (cmd_ishlp(p)) {
outputnl("Removes (deletes) a directory");
nls_outputnl(24,0); /* "Removes (deletes) a directory" */
outputnl("");
outputnl("RMDIR [drive:]path");
outputnl("RD [drive:]path");
nls_outputnl(24,1);/* "RMDIR [drive:]path" */
nls_outputnl(24,2);/* "RD [drive:]path" */
return(CMD_OK);
}
 
if (p->argc == 0) {
outputnl("Required parameter missing");
nls_outputnl(0,7); /* "Required parameter missing" */
return(CMD_FAIL);
}
 
if (p->argc > 1) {
outputnl("Too many parameters");
nls_outputnl(0,4); /* "Too many parameters" */
return(CMD_FAIL);
}
 
if (p->argv[0][0] == '/') {
outputnl("Invalid parameter");
nls_outputnl(0,6); /* "Invalid parameter"); */
return(CMD_FAIL);
}
 
/svarcom/trunk/cmd/set.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
35,14 → 35,14
char *buff = p->BUFFER;
 
if (cmd_ishlp(p)) {
outputnl("Displays, sets, or removes DOS environment variables");
nls_outputnl(23,0); /* "Displays, sets, or removes DOS environment variables"); */
outputnl("");
outputnl("SET [variable=[string]]");
nls_outputnl(23,1); /* "SET [variable=[string]]" */
outputnl("");
outputnl("variable Specifies the environment-variable name");
outputnl("string Specifies a series of characters to assign to the variable");
nls_outputnl(23,2); /* "variable Specifies the environment-variable name" */
nls_outputnl(23,3); /* "string Specifies a series of characters to assign to the variable" */
outputnl("");
outputnl("Type SET without parameters to display the current environment variables.");
nls_outputnl(23,4); /* "Type SET without parameters to display the current environment variables." */
return(CMD_OK);
}
 
87,7 → 87,7
i = env_setvar(p->env_seg, buff);
if (i == ENV_INVSYNT) goto syntax_err;
if (i == ENV_NOTENOM) {
outputnl("Not enough available space within the environment block");
nls_outputnl(23,5); /* "Not enough available space within the environment block" */
return(CMD_FAIL);
}
}
95,6 → 95,6
 
syntax_err:
 
outputnl("Syntax error");
nls_outputnl(0,1); /* "Invalid syntax" */
return(CMD_FAIL);
}
/svarcom/trunk/cmd/time.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
141,12 → 141,11
signed char ho = -1, mi = -1, se = -1;
 
if (cmd_ishlp(p)) {
outputnl("Displays or sets the system time.");
nls_outputnl(22,0); /* "Displays or sets the system time." */
outputnl("");
outputnl("TIME [time]");
nls_outputnl(22,1); /* "TIME [time]" */
outputnl("");
outputnl("Type TIME with no parameters to display the current time and a prompt for a");
outputnl("new one. Press ENTER to keep the same time.");
nls_outputnl(22,2); /* "Type TIME with no parameters to display the current time and (...)" */
return(CMD_OK);
}
 
178,12 → 177,12
}
buff[0] = ' ';
nls_format_time(buff + 1, ho, mi, se, nls);
output("Current time is");
nls_output(22,3); /* "Current time is" */
outputnl(buff);
ho = -1;
} else { /* parse time if provided */
if (cmd_time_parse(p->argv[0], &ho, &mi, &se, nls) != 0) {
outputnl("Invalid time");
nls_outputnl(22,4); /* "Invalid time" */
ho = -1;
}
}
190,7 → 189,7
 
/* ask for time if not provided or if input was malformed */
while (ho < 0) {
output("Enter new time:");
nls_output(22,5); /* "Enter new time:" */
output(" ");
/* collect user input into buff */
_asm {
224,7 → 223,7
}
if (buff[1] == 0) break; /* empty string = do not change time */
if (cmd_time_parse(buff + 2, &ho, &mi, &se, nls) == 0) break;
outputnl("Invalid time");
nls_outputnl(22,4); /* "Invalid time" */
return(CMD_FAIL);
}
 
/svarcom/trunk/cmd/type.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
32,19 → 32,19
unsigned short err = 0;
 
if (cmd_ishlp(p)) {
outputnl("Displays the contents of a text file.");
nls_outputnl(21,0); /* "Displays the contents of a text file." */
outputnl("");
outputnl("TYPE [drive:][path]filename");
nls_outputnl(21,1); /* "TYPE [drive:][path]filename" */
return(CMD_OK);
}
 
if (p->argc == 0) {
outputnl("Required parameter missing");
nls_outputnl(0,7); /* "Required parameter missing" */
return(CMD_FAIL);
}
 
if (p->argc > 1) {
outputnl("Too many parameters");
nls_outputnl(0,4); /* "Too many parameters" */
return(CMD_FAIL);
}
 
/svarcom/trunk/cmd/ver.c
35,7 → 35,7
 
/* help screen */
if (cmd_ishlp(p)) {
outputnl("Displays the DOS version.");
nls_outputnl(20,0); /* "Displays the DOS version." */
outputnl("");
outputnl("ver [/about]");
#ifdef VERDBG
89,9 → 89,9
#endif
 
if ((p->argc == 1) && (imatch(p->argv[0], "/about"))) {
outputnl("SvarCOM is a shell interpreter for DOS kernels compatible with MS-DOS 5+.");
nls_outputnl(20,3); /* "SvarCOM is a shell interpreter for DOS kernels compatible with MS-DOS 5+." */
outputnl("");
outputnl("This software is distributed under the terms of the MIT license.");
nls_outputnl(20,4); /* "This software is distributed under the terms of the MIT license." */
outputnl("Copyright (C) " COPYRDATE " Mateusz Viste");
outputnl("");
outputnl("Program ten dedykuje Milenie i Mojmirowi. Zycze wam, byscie w swoim zyciu");
101,7 → 101,7
}
 
if (p->argc != 0) {
outputnl("Invalid parameter");
nls_outputnl(0,6); /* "Invalid parameter" */
return(CMD_FAIL);
}
 
118,9 → 118,10
pop ax
}
 
sprintf(buff, "DOS kernel version %u.%u", maj, min);
sprintf(buff, svarlang_str(20,1), maj, min); /* "DOS kernel version %u.%u" */
 
outputnl(buff);
outputnl("SvarCOM shell ver " PVER);
nls_output(20,2); /* "SvarCOM shell ver" */
outputnl(" " PVER);
return(CMD_OK);
}
/svarcom/trunk/cmd/verify.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021 Mateusz Viste
* Copyright (C) 2021-2022 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
29,14 → 29,16
static enum cmd_result cmd_verify(struct cmd_funcparam *p) {
 
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.");
nls_outputnl(19,0); /* "Tells DOS whether to verify that files are written correctly to disk." */
outputnl("");
outputnl("VERIFY [ON | OFF]");
outputnl("");
nls_outputnl(19,1); /* "Type VERIFY without a parameter to display its current setting." */
return(CMD_OK);
}
 
if (p->argc > 1) {
outputnl("Too many parameters");
nls_outputnl(0,4); /* "Too many parameters" */
return(CMD_FAIL);
}
 
50,9 → 52,9
pop ax
}
if (verstate == 0) {
outputnl("VERIFY is off");
nls_outputnl(19,2); /* "VERIFY is off" */
} else {
outputnl("VERIFY is on");
nls_outputnl(19,3); /* "VERIFY is on" */
}
return(CMD_OK);
}
79,7 → 81,7
pop ax
}
} else {
outputnl("Must specify ON or OFF");
nls_outputnl(19,4); /* "Must specify ON or OFF" */
return(CMD_FAIL);
}
 
/svarcom/trunk/cmd.c
38,6 → 38,8
#include <stdlib.h>
#include <string.h>
 
#include "svarlang.lib/svarlang.h"
 
#include "env.h"
#include "helpers.h"
#include "redir.h"
/svarcom/trunk/command.c
138,7 → 138,8
}
 
if (*cmdline != '/') {
output("Invalid parameter: ");
nls_output(0,6); /* "Invalid parameter" */
output(": ");
outputnl(cmdline);
goto SKIP_TO_NEXT_ARG;
}
174,20 → 175,21
break;
 
case '?':
outputnl("Starts the SvarCOM command interpreter");
nls_outputnl(1,0); /* "Starts the SvarCOM command interpreter" */
outputnl("");
outputnl("COMMAND /E:nnn [/[C|K] [/P] [/D] command]");
nls_outputnl(1,1); /* "COMMAND /E:nnn [/[C|K] [/P] [/D] command]" */
outputnl("");
outputnl("/D Skip AUTOEXEC.BAT processing (makes sense only with /P)");
outputnl("/E:nnn Sets the environment size to nnn bytes");
outputnl("/P Makes the new command interpreter permanent and run AUTOEXEC.BAT");
outputnl("/C Executes the specified command and returns");
outputnl("/K Executes the specified command and continues running");
nls_outputnl(1,2); /* "/D Skip AUTOEXEC.BAT processing (makes sense only with /P)" */
nls_outputnl(1,3); /* "/E:nnn Sets the environment size to nnn bytes" */
nls_outputnl(1,4); /* "/P Makes the new command interpreter permanent and run AUTOEXEC.BAT" */
nls_outputnl(1,5); /* "/C Executes the specified command and returns" */
nls_outputnl(1,6); /* "/K Executes the specified command and continues running" */
exit(1);
break;
 
default:
output("Invalid switch: /");
nls_output(0,2); /* invalid switch */
output(": /");
outputnl(cmdline);
break;
}
770,7 → 772,7
parse_argv(&cfg);
rmod = rmod_install(cfg.envsiz, BUFFER, BUFFER_len);
if (rmod == NULL) {
outputnl("ERROR: rmod_install() failed");
nls_outputnl_err(2,1); /* "FATAL ERROR: rmod_install() failed" */
return(1);
}
/* copy flags to rmod's storage (and enable ECHO) */
785,7 → 787,7
if (rmod->flags & FLAG_EXEC_AND_QUIT) sayonara(rmod);
/* */
if (rmod->version != BYTE_VERSION) {
outputnl("SVARCOM VERSION CHANGED. SYSTEM HALTED. PLEASE REBOOT YOUR COMPUTER.");
nls_outputnl_err(2,0);
_asm {
HALT:
hlt
879,7 → 881,7
rmod_inputbuf[2] = '\r'; /* string terminator */
rmod_inputbuf[3] = 0xCA; /* trailing signature */
rmod_inputbuf[4] = 0xFE; /* trailing signature */
outputnl("SvarCOM: stack overflow detected, command history flushed (this is not a bug)");
nls_outputnl_err(2,2); /* "stack overflow detected, command history flushed" */
}
/* interactive mode: display prompt (if echo enabled) and wait for user
* command line */
934,7 → 936,7
if ((rmod->bat != NULL) && (rmod->bat->nextline == 0)) goto SKIP_NEWLINE;
/* run_as_external() does not return on success, if I am still alive then
* external command failed to execute */
outputnl("Bad command or file name");
nls_outputnl(0,5); /* "Bad command or file name" */
continue;
}
 
/svarcom/trunk/history.txt
9,9 → 9,10
- added CALL support (calls batch files from within batch files)
- DOS errors are output to stdout, and also to stderr if stdout is redirected
- fixed batch processing with /C (was executing only first command)
- multi-lang support relies on SvarLANG.lib instead of its own routines
- stack overflow detection degrades gracefully by invalidating command-line
history (useful if a stack-hungry TSR overflows the RMOD stack)
- multi-lang support relies on SvarLANG.lib instead of its own routines
- made many more strings localizable (80% of messages ready for translation)
- added German translations (kindly provided by Robert Riebisch)
 
 
/svarcom/trunk/lang/en-utf8.txt
10,7 → 10,57
0.2:Invalid switch
0.3:Invalid parameter format
0.4:Too many parameters
0.5:Bad command or file name
0.6:Invalid parameter
0.7:Required parameter missing
 
# SVARCOM HELP SCREEN
1.0:Starts the SvarCOM command interpreter
1.1:COMMAND /E:nnn [/[C|K] [/P] [/D] command]
1.2:/D Skip AUTOEXEC.BAT processing (makes sense only with /P)
1.3:/E:nnn Sets the environment size to nnn bytes
1.4:/P Makes the new command interpreter permanent and run AUTOEXEC.BAT
1.5:/C Executes the specified command and returns
1.6:/K Executes the specified command and continues running
 
# VARIOUS SVARCOM MESSAGES
2.0:SVARCOM VERSION CHANGED. SYSTEM HALTED. PLEASE REBOOT YOUR COMPUTER.
2.1:FATAL ERROR: rmod_install() failed
2.2:SvarCOM: stack overflow detected, command history flushed (this is not a bug)
 
# CLS
10.0:Clears the screen
 
# CHCP
11.0:Displays or sets the active code page number.
11.1:CHCP [nnn]
11.2:nnn Specifies a code page number
11.3:Type CHCP without a parameter to display the active code page number.
11.4:Invalid code page number
11.5:NLSFUNC not installed
11.6:Failed to change code page
11.7:Active code page:
 
# CD / CHDIR
12.0:Displays the name of or changes the current directory.
12.1:CHDIR [drive:][path]
12.2:CHDIR[..]
12.3:CD [drive:][path]
12.4:CD[..]
12.5:.. Specifies that you want to change to the parent directory.
12.6:Type CD drive: to display the current directory in the specified drive.
12.7:Type CD without parameters to display the current drive and directory.
 
# CALL
13.0:Calls one batch program from another
13.1:CALL [drive:][path]filename [batch-parameters]
 
# BREAK
14.0:Sets or clears extended CTRL+C checking
14.1:Type BREAK without a parameter to display the current BREAK setting.
14.2:BREAK is off
14.3:BREAK is on
 
# PAUSE
15.0:Suspends the execution of a batch script
15.1:Press any key to continue...
35,6 → 85,98
18.5:parameters parameters or switches for the specified command.
18.6:To use FOR in a batch program, use %%variable instead of %variable.
 
# VERIFY
19.0:Tells DOS whether to verify that files are written correctly to disk.
19.1:Type VERIFY without a parameter to display its current setting.
19.2:VERIFY is off
19.3:VERIFY is on
19.4:Must specify ON or OFF
 
# VER
20.0:Displays the DOS version.
20.1:DOS kernel version %u.%u
20.2:SvarCOM shell ver
20.3:SvarCOM is a shell interpreter for DOS kernels compatible with MS-DOS 5+.
20.4:This software is distributed under the terms of the MIT license.
 
# TYPE
21.0:Displays the contents of a text file.
21.1:TYPE [drive:][path]filename
 
# TIME
22.0:Displays or sets the system time.
22.1:TIME [time]
22.2:Type TIME with no parameters to display the current time and a prompt for a\r\nnew one. Press ENTER to keep the same time.
22.3:Current time is
22.4:Invalid time
22.5:Enter new time:
 
# SET
23.0:Displays, sets, or removes DOS environment variables.
23.1:SET [variable=[string]]
23.2:variable Specifies the environment-variable name
23.3:string Specifies a series of characters to assign to the variable
23.4:Type SET without parameters to display the current environment variables.
23.5:Not enough available space within the environment block
 
# RD / RMDIR
24.0:Removes (deletes) a directory
24.1:RMDIR [drive:]path
24.2:RD [drive:]path
 
# REN / RENAME
25.0:Renames a file
25.1:RENAME [drive:][path]filename1 filename2
25.2:REN [drive:][path]filename1 filename2
25.3:Note that you cannot specify a new drive or path for your destination file.\r\nUse MOVE to rename a directory, or to move files from one directory to another.
25.4:Invalid destination
 
# REM
26.0:Records comments (remarks) in a batch file or CONFIG.SYS
26.1:REM [comment]
 
# PATH
27.0:Displays or sets a search path for executable files.
27.1:PATH [[drive:]path[;...]]
27.2:Type PATH ; to clear all search-path settings and direct DOS to search\r\nonly in the current directory.
27.3:Type PATH without parameters to display the current path.
27.4:No Path
 
# MD / MKDIR
28.0:Creates a directory
28.1:MKDIR [drive:]path
28.2:MD [drive:]path
 
# LN
29.0:Adds, deletes or displays executable links.
29.1:LN ADD linkname targetdir
29.2:LN DEL linkname
29.3:LN LIST [pattern]
29.4:No matching executable found in given path.
29.5:%DOSDIR% not defined
 
# EXIT
30.0:Quits the COMMAND.COM program (command interpreter)
 
# ECHO
31.0:Displays messages, or turns command-echoing on or off
31.1:ECHO [message]
31.2:Type ECHO without parameters to display the current echo setting.
31.3:ECHO is on
31.4:ECHO is off
 
# DATE
32.0:Displays or sets the system date.
32.1:DATE [date]
32.2:Type DATE with no parameters to display the current date and a prompt for a\r\nnew one. Press ENTER to keep the same date.
32.3:Invalid date
32.4:Current date is
32.5:Enter new date:
 
# PROMPT
33.0:Changes the DOS command prompt.
33.1:PROMPT [new command prompt specification]
 
# DOS ERRORS
255.1:Function number invalid
255.2:File not found
/svarcom/trunk/lang/pl-utf8.txt
10,7 → 10,22
0.2:Nieprawidłowy przełącznik
0.3:Nieprawidłowy format parametru
0.4:Zbyt duża ilość parametrów
0.5:Złe polecenie lub nazwa pliku
 
# SVARCOM HELP SCREEN
1.0:Uruchamia interpreter poleceń SvarCOM
1.1:COMMAND /E:nnn [/[C|K] [/P] [/D] polecenie]
1.2:/D Ignoruje AUTOEXEC.BAT (ma sens tylko przy /P)
1.3:/E:nnn Ustawia rozmiar środowiska na nnn bajtów
1.4:/P Ustala nowy interpreter poleceń i wykonuje AUTOEXEC.BAT
1.5:/C Wykonuje podane polecenie i kończy się
1.6:/K Wykonuje podane polecenie i działa dalej
 
# VARIOUS SVARCOM MESSAGES
2.0:WERSJA SVARCOM ULEGŁA ZMIANIE. SYSTEM ZATRZYMANY. ZRESTARTUJ KOMPUTER.
2.1:BŁĄD KRYTYCZNY: rmod_install() nie powiodło się
2.2:SvarCOM: wykryto przepełnienie stosu, usunięto historię poleceń (to nie bug)
 
# PAUSE
15.0:Wstrzymuje przetwarzanie pliku wsadowego
15.1:Naciśnij dowolny klawisz aby kontynuować...