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);
}