Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 989 → Rev 990

/svarcom/trunk/cmd/copy.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"),
168,20 → 168,19
struct DTA *dta = (void *)0x80; /* use DTA at default location in PSP */
 
if (cmd_ishlp(p)) {
outputnl("Copies one or more files to another location.");
nls_outputnl(38,0); /* "Copies one or more files to another location." */
outputnl("");
outputnl("COPY [/A|/B] source [/A|/B] [+source [/A|/B] [+...]] [destination [/A|/B]] [/V]");
nls_outputnl(38,1); /* "COPY [/A|/B] source [/A|/B] [+source [/A|/B] [+...]] [destination [/A|/B]] [/V]" */
outputnl("");
outputnl("source Specifies the file or files to be copied");
outputnl("/A Indicates an ASCII text file");
outputnl("/B Indicates a binary file");
outputnl("destination Specifies the directory and/or filename for the new file(s)");
outputnl("/V Verifies that new files are written correctly");
nls_outputnl(38,2); /* "source Specifies the file or files to be copied" */
nls_outputnl(38,3); /* "/A Indicates an ASCII text file" */
nls_outputnl(38,4); /* "/B Indicates a binary file" */
nls_outputnl(38,5); /* "destination Specifies the directory and/or filename for the new file(s)" */
nls_outputnl(38,6); /* "/V Verifies that new files are written correctly" */
outputnl("");
outputnl("To append files, specify a single file for destination, but multiple files");
outputnl("for source (using wildcards or file1+file2+file3 format).");
nls_outputnl(38,7); /* "To append files, specify a single file for destination, but multiple (...)" */
outputnl("");
outputnl("NOTE: /A and /B are no-ops (ignored), provided only for compatibility reasons.");
nls_outputnl(38,8); /* "NOTE: /A and /B are no-ops, provided only for compatibility reasons" */
return(CMD_OK);
}
 
206,7 → 205,7
} else if (imatch(p->argv[i], "/v")) {
setup->verifyflag = 1;
} else {
outputnl("Invalid switch");
nls_outputnl(0,2); /* "Invalid switch" */
return(CMD_FAIL);
}
continue;
216,7 → 215,7
if (p->argv[i][0] == '+') {
/* a plus cannot appear after destination or before first source */
if ((setup->dst[0] != 0) || (setup->src_count == 0)) {
outputnl("Invalid syntax");
nls_outputnl(0,1); /* "Invalid syntax" */
return(CMD_FAIL);
}
setup->lastitemwasplus = 1;
240,11 → 239,11
 
/* must be a dst then */
if (setup->dst[0] != 0) {
outputnl("Invalid syntax");
nls_outputnl(0,1); /* "Invalid syntax" */
return(CMD_FAIL);
}
if (file_truename(p->argv[i], setup->dst) != 0) {
outputnl("Invalid destination");
nls_outputnl(0,8); /* "Invalid destination" */
return(CMD_FAIL);
}
setup->dst_asciimode = setup->last_asciimode;
266,7 → 265,7
 
/* must have at least one source */
if (setup->src_count == 0) {
outputnl("Required parameter missing");
nls_outputnl(0,7); /* "Required parameter missing" */
return(CMD_FAIL);
}
 
356,7 → 355,7
 
}
 
sprintf(setup->databuf, "%u file(s) copied", copiedcount_out);
sprintf(setup->databuf, svarlang_str(38,9)/*"%u file(s) copied"*/, copiedcount_out);
outputnl(setup->databuf);
 
return(CMD_OK);
/svarcom/trunk/cmd/del.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"),
38,18 → 38,18
char *fname = dta->fname;
 
if (cmd_ishlp(p)) {
outputnl("Deletes one or more files.");
nls_outputnl(36,0); /* "Deletes one or more files." */
outputnl("");
outputnl("DEL [drive:][path]filename [/P]");
outputnl("ERASE [drive:][path]filename [/P]");
nls_outputnl(36,1); /* "DEL [drive:][path]filename [/P]" */
nls_outputnl(36,2); /* "ERASE [drive:][path]filename [/P]" */
outputnl("");
outputnl("[drive:][path]filename Specifies the file(s) to delete.");
outputnl("/P Prompts for confirmation before deleting each file.");
nls_outputnl(36,3); /* "[drive:][path]filename Specifies the file(s) to delete." */
nls_outputnl(36,4); /* "/P Prompts for confirmation before deleting each file." */
return(CMD_OK);
}
 
if (p->argc == 0) {
outputnl("Required parameter missing");
nls_outputnl(0,7); /* "Required parameter missing" */
return(CMD_FAIL);
}
 
60,13 → 60,13
if (imatch(p->argv[i], "/p")) {
confirmflag = 1;
} else {
output("Invalid switch:");
output(" ");
nls_output(0,2); /* "Invalid switch" */
output(": ");
outputnl(p->argv[i]);
return(CMD_FAIL);
}
} else if (delspec != NULL) { /* otherwise its a delspec */
outputnl("Too many parameters");
nls_outputnl(0,4); /* "Too many parameters" */
return(CMD_FAIL);
} else {
delspec = p->argv[i];
86,8 → 86,8
/* is this about deleting all content inside a directory? if no per-file
* confirmation set, ask for a global confirmation */
if ((confirmflag == 0) && (imatch(buff + pathlimit, "????????.???"))) {
outputnl("All files in directory will be deleted!");
if (askchoice("Are you sure (Y/N)?", "YN") != 0) return(CMD_FAIL);
nls_outputnl(36,5); /* "All files in directory will be deleted!" */
if (askchoice(svarlang_str(36,6)/*"Are you sure (Y/N)?"*/, svarlang_str(0,10)/*"YN"*/) != 0) return(CMD_FAIL);
}
 
for (i = 0;; i = 1) {
113,7 → 113,7
if (confirmflag) {
output(buff);
output(" \t");
if (askchoice("Delete (Y/N)?", "YN") != 0) continue;
if (askchoice(svarlang_str(36,7)/*"Delete (Y/N)?"*/, svarlang_str(0,10)) != 0) continue;
}
 
/* del found file */
/svarcom/trunk/cmd/dir.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"),
185,24 → 185,24
unsigned char format = DIR_OUTPUT_NORM;
 
if (cmd_ishlp(p)) {
outputnl("Displays a list of files and subdirectories in a directory");
nls_outputnl(37,0); /* "Displays a list of files and subdirectories in a directory" */
outputnl("");
outputnl("DIR [drive:][path][filename] [/P] [/W] [/A[:]attributes] [/O[[:]sortorder]] [/S] [/B] [/L]");
nls_outputnl(37,1); /* "DIR [drive:][path][filename] [/P] [/W] [/A[:]attributes] [/O[[:]sortorder]] [/S] [/B] [/L]" */
outputnl("");
outputnl("/P Pauses after each screenful of information");
outputnl("/W Uses wide list format");
nls_outputnl(37,2); /* "/P Pauses after each screenful of information" */
nls_outputnl(37,3); /* "/W Uses wide list format" */
outputnl("");
outputnl("/A Displays files with specified attributes:");
outputnl(" D Directories R Read-only files H Hidden files");
outputnl(" A Ready for archiving S System files - prefix meaning \"not\"");
nls_outputnl(37,4); /* "/A Displays files with specified attributes:" */
nls_outputnl(37,5); /* " D Directories R Read-only files H Hidden files" */
nls_outputnl(37,6); /* " A Ready for archiving S System files - prefix meaning "not"" */
outputnl("");
outputnl("/O List files in sorted order:");
outputnl(" N by name S by size E by extension");
outputnl(" D by date G group dirs first - prefix to reverse order");
nls_outputnl(37,7); /* "/O List files in sorted order:" */
nls_outputnl(37,8); /* " N by name S by size E by extension" */
nls_outputnl(37,9); /* " D by date G group dirs first - prefix to reverse order" */
outputnl("");
outputnl("/S Displays files in specified directory and all subdirectories");
outputnl("/B Uses bare format (no heading information or summary)");
outputnl("/L Uses lowercases");
nls_outputnl(37,10); /* "/S Displays files in specified directory and all subdirectories" */
nls_outputnl(37,11); /* "/B Uses bare format (no heading information or summary)" */
nls_outputnl(37,12); /* "/L Uses lowercases" */
return(CMD_OK);
}
 
312,7 → 312,7
drv -= 'A';
}
cmd_vol_internal(drv, buff2);
sprintf(buff2, "Directory of %s", p->BUFFER);
sprintf(buff2, svarlang_str(37,20)/*"Directory of %s"*/, p->BUFFER);
/* trim at first '?', if any */
for (i = 0; buff2[i] != 0; i++) if (buff2[i] == '?') buff2[i] = 0;
outputnl(buff2);
365,7 → 365,7
/* either <DIR> or right aligned 10-chars byte size */
memset(buff2, ' ', 10);
if (dta->attr & DOS_ATTR_DIR) {
strcpy(buff2 + 10, "<DIR>");
strcpy(buff2 + 10, svarlang_str(37,21));
} else {
_ultoa(dta->size, buff2 + 10, 10); /* OpenWatcom extension */
}
420,13 → 420,13
/* x file(s) */
memset(buff2, ' ', 13); /* 13 is the max len of a 32 bit number with thousand separators (4'000'000'000) */
i = nls_format_number(buff2 + 13, summary_fcount, nls);
alignpos = sprintf(buff2 + 13 + i, " %s ", "file(s)");
alignpos = sprintf(buff2 + 13 + i, " %s ", svarlang_str(37,22)/*"file(s)"*/);
output(buff2 + i);
/* xxxx bytes */
i = nls_format_number(buff2 + 13, summary_totsz, nls);
output(buff2 + i);
output(" ");
outputnl("bytes");
nls_outputnl(37,23); /* "bytes" */
if (flags & DIR_FLAG_PAUSE) dir_pagination(&availrows);
/* xxxx bytes free */
i = cmd_dir_df(&summary_totsz, drv);
436,7 → 436,7
i = nls_format_number(buff2 + alignpos, summary_totsz, nls);
output(buff2 + i);
output(" ");
outputnl("bytes free");
nls_outputnl(37,24); /* "bytes free" */
if (flags & DIR_FLAG_PAUSE) dir_pagination(&availrows);
}
 
/svarcom/trunk/cmd/if.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"),
45,17 → 45,17
/* help screen ONLY if /? is the only argument - I do not want to output
* help for ex. for "if %1 == /? echo ..." */
if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) {
outputnl("Performs conditional processing in batch programs.");
nls_outputnl(35,0); /* "Performs conditional processing in batch programs." */
outputnl("");
outputnl("IF [NOT] ERRORLEVEL num command");
outputnl("IF [NOT] string1==string2 command");
outputnl("IF [NOT] EXIST filename command");
nls_outputnl(35,1); /* "IF [NOT] ERRORLEVEL num command" */
nls_outputnl(35,2); /* "IF [NOT] string1==string2 command" */
nls_outputnl(35,3); /* "IF [NOT] EXIST filename command" */
outputnl("");
outputnl("NOT command is executed only if condition is NOT met");
outputnl("ERRORLEVEL num condition: last program returned an exit code >= num");
outputnl("string1==string2 condition: both strings must be equal");
outputnl("EXIST filename condition: filename exists (wildcards accepted)");
outputnl("command command to carry out if condition is met.");
nls_outputnl(35,4); /* "NOT command is executed only if condition is NOT met" */
nls_outputnl(35,5); /* "ERRORLEVEL num condition: last program returned an exit code >= num" */
nls_outputnl(35,6); /* "string1==string2 condition: both strings must be equal" */
nls_outputnl(35,7); /* "EXIST filename condition: filename exists (wildcards accepted)" */
nls_outputnl(35,8); /* "command command to carry out if condition is met" */
return(CMD_OK);
}
 
126,7 → 126,7
 
/* invalid syntax */
SYNTAX_ERR:
outputnl("Syntax error");
nls_outputnl(0,1); /* "Invalid syntax" */
return(CMD_FAIL);
 
/* let's exec command (write it to start of cmdline and parse again) */
/svarcom/trunk/cmd/rename.c
72,7 → 72,7
case ':':
case '\\':
case '/':
nls_outputnl(25,4); /* "Invalid destination" */
nls_outputnl(0,8); /* "Invalid destination" */
return(CMD_FAIL);
}
buff1[fnameoffset + i] = p->argv[1][i];
/svarcom/trunk/cmd/vol.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"),
53,11 → 53,11
}
 
if (err != 0) {
sprintf(buff, "Volume in drive %c has no label", drv + 'A');
sprintf(buff, svarlang_str(34,2)/*"Volume in drive %c has no label"*/, drv + 'A');
} else {
/* if label > 8 chars then drop the dot (DRIVE_LA.BEL -> DRIVE_LABEL) */
if (strlen(dta->fname) > 8) memmove(dta->fname + 8, dta->fname + 9, 4);
sprintf(buff, "Volume in drive %c is %s", drv + 'A', dta->fname);
sprintf(buff, svarlang_str(34,3)/*"Volume in drive %c is %s"*/, drv + 'A', dta->fname);
}
outputnl(buff);
 
87,7 → 87,7
06h 11 BYTEs volume label or "NO NAME " if none present
11h 8 BYTEs filesystem type */
if ((err == 0) && (buff16[1] | buff16[2])) {
sprintf(buff + 64, "Volume Serial Number is %04X-%04X", buff16[2], buff16[1]);
sprintf(buff + 64, svarlang_str(34,4)/*"Volume Serial Number is %04X-%04X"*/, buff16[2], buff16[1]);
outputnl(buff + 64);
}
}
99,23 → 99,23
unsigned short i;
 
if (cmd_ishlp(p)) {
outputnl("Displays the disk volume label and serial number, if they exist.");
nls_outputnl(34,0); /* "Displays the disk volume label and serial number, if they exist." */
outputnl("");
outputnl("VOL [drive:]");
nls_outputnl(34,1); /* "VOL [drive:]" */
return(CMD_OK);
}
 
for (i = 0; i < p->argc; i++) {
if (p->argv[i][0] == '/') {
outputnl("Invalid switch");
nls_outputnl(0,2); /* "Invalid switch" */
return(CMD_FAIL);
}
if (drv != 0) {
outputnl("Too many parameters");
nls_outputnl(0,4); /* "Too many parameters" */
return(CMD_FAIL);
}
if ((p->argv[i][0] == 0) || (p->argv[i][1] != ':') || (p->argv[i][2] != 0)) {
outputnl("Invalid parameter format");
nls_outputnl(0,3); /* "Invalid parameter format" */
return(CMD_FAIL);
}
drv = p->argv[i][0];
140,7 → 140,7
if (drv == 0) {
drv = curdrv;
} else if (!isdrivevalid(drv)) { /* is specified drive valid? */
outputnl("Invalid drive");
nls_outputnl(255,15); /* "Invalid drive" */
return(CMD_FAIL);
}
 
/svarcom/trunk/history.txt
12,8 → 12,8
- 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)
- made all SvarCOM strings localizable
- added partial German translations (kindly provided by Robert Riebisch)
 
 
=== ver 2022.0 (01.02.2022) ==================================================
/svarcom/trunk/lang/en-utf8.txt
13,7 → 13,12
0.5:Bad command or file name
0.6:Invalid parameter
0.7:Required parameter missing
0.8:Invalid destination
 
# the message below MUST be a two-letter upper-case string for "Yes/No" keys
# that user can press to answer interactive "Yes/No" questions
0.10:YN
 
# SVARCOM HELP SCREEN
1.0:Starts the SvarCOM command interpreter
1.1:COMMAND /E:nnn [/[C|K] [/P] [/D] command]
129,7 → 134,6
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
177,6 → 181,66
33.0:Changes the DOS command prompt.
33.1:PROMPT [new command prompt specification]
 
# VOL
34.0:Displays the disk volume label and serial number, if they exist.
34.1:VOL [drive:]
34.2:Volume in drive %c has no label
34.3:Volume in drive %c is %s
34.4:Volume Serial Number is %04X-%04X
 
# IF
35.0:Performs conditional processing in batch programs.
35.1:IF [NOT] ERRORLEVEL num command
35.2:IF [NOT] string1==string2 command
35.3:IF [NOT] EXIST filename command
35.4:NOT command is executed only if condition is NOT met
35.5:ERRORLEVEL num condition: last program returned an exit code >= num
35.6:string1==string2 condition: both strings must be equal
35.7:EXIST filename condition: filename exists (wildcards accepted)
35.8:command command to carry out if condition is met
 
# DEL
36.0:Deletes one or more files.
36.1:DEL [drive:][path]filename [/P]
36.2:ERASE [drive:][path]filename [/P]
36.3:[drive:][path]filename Specifies the file(s) to delete.
36.4:/P Prompts for confirmation before deleting each file.
36.5:All files in directory will be deleted!
36.6:Are you sure (Y/N)?
36.7:Delete (Y/N)?
 
# DIR
37.0:Displays a list of files and subdirectories in a directory.
37.1:DIR [drive:][path][filename] [/P] [/W] [/A[:]attributes] [/O[[:]sortorder]] [/S] [/B] [/L]
37.2:/P Pauses after each screenful of information
37.3:/W Uses wide list format
37.4:/A Displays files with specified attributes:
37.5: D Directories R Read-only files H Hidden files
37.6: A Ready for archiving S System files - prefix meaning "not"
37.7:/O List files in sorted order:
37.8: N by name S by size E by extension
37.9: D by date G group dirs first - prefix to reverse order"
37.10:/S Displays files in specified directory and all subdirectories
37.11:/B Uses bare format (no heading information or summary)
37.12:/L Uses lowercases
37.20:Directory of %s
37.21:<DIR>
37.22:file(s)
37.23:bytes
37.24:bytes free
 
# COPY
38.0:Copies one or more files to another location.
38.1:COPY [/A|/B] source [/A|/B] [+source [/A|/B] [+...]] [destination [/A|/B]] [/V]
38.2:source Specifies the file or files to be copied
38.3:/A Indicates an ASCII text file
38.4:/B Indicates a binary file
38.5:destination Specifies the directory and/or filename for the new file(s)
38.6:/V Verifies that new files are written correctly
38.7:To append files, specify a single file for destination, but multiple files\r\nfor source (using wildcards or file1+file2+file3 format).
38.8:NOTE: /A and /B are no-ops (ignored), provided only for compatibility reasons.
38.9:%u file(s) copied
 
# DOS ERRORS
255.1:Function number invalid
255.2:File not found
/svarcom/trunk/lang/pl-utf8.txt
11,7 → 11,14
0.3:Nieprawidłowy format parametru
0.4:Zbyt duża ilość parametrów
0.5:Złe polecenie lub nazwa pliku
0.6:Nieprawidłowy parametr
0.7:Brak wymaganego parametru
0.8:Nieprawidłowy cel
 
# the message below MUST be a two-letter upper-case string for "Yes/No" keys
# that user can press to answer interactive "Yes/No" questions
0.10:TN
 
# SVARCOM HELP SCREEN
1.0:Uruchamia interpreter poleceń SvarCOM
1.1:COMMAND /E:nnn [/[C|K] [/P] [/D] polecenie]
26,6 → 33,9
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)
 
# CLS
10.0:Czyści ekran
 
# PAUSE
15.0:Wstrzymuje przetwarzanie pliku wsadowego
15.1:Naciśnij dowolny klawisz aby kontynuować...
/svarcom/trunk/svarcom.lsm
1,2 → 1,2
Description: the SvarDOS command line interpreter (COMMAND.COM)
Description: the SvarDOS command line interpreter (COMMAND.COM shell)
Version: 2022.1
/svarcom/trunk/svarcom.txt
7,25 → 7,17
"COMMAND.COM". It is designed and maintained by Mateusz Viste, and distributed
under the terms of the MIT license.
 
The goal is to make SvarCOM the default SvarDOS shell, replacing FreeCOM.
Why replacing FreeCOM, you ask? See FREECOM.TXT for details.
 
SvarCOM is a work-in-progress effort. As such, it still lacks a few things:
- a few internal commands missing: CALL, CTTY, GOTO, LH
- DIR misses two switches: /S, /O
 
SvarCOM is minimalist and I'd like to keep it that way. It aims to be
functionaly equivalent to COMMAND.COM from MS-DOS 5.x/6.x. No LFN support.
 
As of version 2022.0, SvarCOM's resident footprint is under 2 KiB.
SvarCOM's resident footprint is under 2 KiB.
 
Translation strings are stored in the file SVARCOM.LNG, which should be
placed in a directory pointed at by %NLSPATH% for SvarCOM to be able to output
messages in non-english languages. SvarCOM's language is controlled by the
%LANG% environment variable. NOTE: at this time translations aren't available
yet, with the proof-of-concept exceptions of the 'PAUSE' and 'SHIFT' commands.
%LANG% environment variable.
 
Latest version available here: http://svardos.osdn.io/svarcom
Latest version available here: http://svardos.org/svarcom
 
 
=== INTERNAL COMMANDS ========================================================
/svarcom/trunk/todo.txt
11,12 → 11,12
"FOR" command
IF EXIST on an empty drive should not lead to the 'Abort, Retry, Fail' prompt
CTRL+C should allow to abort a BAT file running in an infinite loop
Step-by-step execution of batch programs
 
 
=== MEDIUM PRIORITY ==========================================================
 
provide unopened FCBs to launched applications
complete EN translation strings
if translations reloading fails, do not retry after every command
DIR /O
DIR /S (must use multiple DTAs recursively)
34,7 → 34,6
"notify pending command" support (INT 2F,AX=AE00)
INT 2F,AX=5500 support
COMSPEC self-setting does not work under MS-DOS 5/6 (no exepath in env block)
compression of NLS strings and rmod core (lz4?)
dynamic resizing of environment space
CTTY
LOADHIGH/LH