From 5cc492c78324067a9efbdc8c886aea16ae88bc46 Mon Sep 17 00:00:00 2001 From: Jason Edmeades Date: Sun, 3 Jun 2007 22:07:39 +0100 Subject: [PATCH] cmd.exe: Move English constants into NLS files. --- programs/cmd/Cs.rc | 24 +++++++- programs/cmd/De.rc | 24 +++++++- programs/cmd/En.rc | 24 +++++++- programs/cmd/Es.rc | 24 +++++++- programs/cmd/Fr.rc | 24 +++++++- programs/cmd/Ja.rc | 24 +++++++- programs/cmd/Ko.rc | 24 +++++++- programs/cmd/Nl.rc | 24 +++++++- programs/cmd/No.rc | 24 +++++++- programs/cmd/Pl.rc | 24 +++++++- programs/cmd/Pt.rc | 24 +++++++- programs/cmd/Ru.rc | 24 +++++++- programs/cmd/Si.rc | 24 +++++++- programs/cmd/Tr.rc | 24 +++++++- programs/cmd/batch.c | 21 +++---- programs/cmd/builtins.c | 141 +++++++++++++++++++++++++---------------------- programs/cmd/directory.c | 6 +- programs/cmd/wcmd.h | 40 +++++++++++--- programs/cmd/wcmdmain.c | 23 ++++++-- 19 files changed, 460 insertions(+), 107 deletions(-) diff --git a/programs/cmd/Cs.rc b/programs/cmd/Cs.rc index 7c72f6f7549..82bf49be146 100644 --- a/programs/cmd/Cs.rc +++ b/programs/cmd/Cs.rc @@ -239,6 +239,28 @@ Zadejte HELP

for further information on any of the above commands\n" WCMD_NO, "N" WCMD_NOASSOC, "File association missing for extension %s\n" WCMD_NOFTYPE, "No open command associated with file type '%s'\n" - WCMD_OVERWRITE, "Overwrite" + WCMD_OVERWRITE, "Overwrite %s" WCMD_MORESTR, "More..." + WCMD_TRUNCATEDLINE, "Line in Batch processing possibly truncated. Using:\n" + WCMD_NYI, "Not Yet Implemented\n\n" + WCMD_NOARG, "Argument missing\n" + WCMD_SYNTAXERR, "Syntax error\n" + WCMD_FILENOTFOUND, "%s : File Not Found\n" + WCMD_NOCMDHELP, "No help available for %s\n" + WCMD_NOTARGET, "Target to GOTO not found\n" + WCMD_CURRENTDATE, "Current Date is %s\n" + WCMD_CURRENTTIME, "Current Time is %s\n" + WCMD_NEWDATE, "Enter new date: " + WCMD_NEWTIME, "Enter new time: " + WCMD_MISSINGENV, "Environment variable %s not defined\n" + WCMD_READFAIL, "Failed to open '%s'\n" + WCMD_CALLINSCRIPT, "Cannot call batch label outside of a batch script\n" + WCMD_ALL, "A" + WCMD_DELPROMPT, "%s, Delete" + WCMD_ECHOPROMPT, "Echo is %s\n" + WCMD_VERIFYPROMPT, "Verify is %s\n" + WCMD_VERIFYERR, "Verify must be ON or OFF\n"; + WCMD_ARGERR, "Parameter error\n" + WCMD_VOLUMEDETAIL, "Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n" + WCMD_VOLUMEPROMPT, "Volume label (11 characters, ENTER for none)?" } diff --git a/programs/cmd/Es.rc b/programs/cmd/Es.rc index 0f1a8a2351c..7363f949de8 100644 --- a/programs/cmd/Es.rc +++ b/programs/cmd/Es.rc @@ -260,6 +260,28 @@ Introduzca HELP para m WCMD_NO, "N" WCMD_NOASSOC, "Falta una asociación de archivo para la extensión %s\n" WCMD_NOFTYPE, "Ningún comando de apertura asociado con el tipo de archivo '%s'\n" - WCMD_OVERWRITE, "Sobreescribir" + WCMD_OVERWRITE, "Overwrite %s" WCMD_MORESTR, "Más..." + WCMD_TRUNCATEDLINE, "Line in Batch processing possibly truncated. Using:\n" + WCMD_NYI, "Not Yet Implemented\n\n" + WCMD_NOARG, "Argument missing\n" + WCMD_SYNTAXERR, "Syntax error\n" + WCMD_FILENOTFOUND, "%s : File Not Found\n" + WCMD_NOCMDHELP, "No help available for %s\n" + WCMD_NOTARGET, "Target to GOTO not found\n" + WCMD_CURRENTDATE, "Current Date is %s\n" + WCMD_CURRENTTIME, "Current Time is %s\n" + WCMD_NEWDATE, "Enter new date: " + WCMD_NEWTIME, "Enter new time: " + WCMD_MISSINGENV, "Environment variable %s not defined\n" + WCMD_READFAIL, "Failed to open '%s'\n" + WCMD_CALLINSCRIPT, "Cannot call batch label outside of a batch script\n" + WCMD_ALL, "A" + WCMD_DELPROMPT, "%s, Delete" + WCMD_ECHOPROMPT, "Echo is %s\n" + WCMD_VERIFYPROMPT, "Verify is %s\n" + WCMD_VERIFYERR, "Verify must be ON or OFF\n"; + WCMD_ARGERR, "Parameter error\n" + WCMD_VOLUMEDETAIL, "Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n" + WCMD_VOLUMEPROMPT, "Volume label (11 characters, ENTER for none)?" } diff --git a/programs/cmd/Fr.rc b/programs/cmd/Fr.rc index 51a35b65219..78b39de051f 100644 --- a/programs/cmd/Fr.rc +++ b/programs/cmd/Fr.rc @@ -233,6 +233,28 @@ Entrez HELP pour plus d'informations sur les commandes ci-dessus\n" WCMD_NO, "N" WCMD_NOASSOC, "File association missing for extension %s\n" WCMD_NOFTYPE, "No open command associated with file type '%s'\n" - WCMD_OVERWRITE, "Overwrite" + WCMD_OVERWRITE, "Overwrite %s" WCMD_MORESTR, "More..." + WCMD_TRUNCATEDLINE, "Line in Batch processing possibly truncated. Using:\n" + WCMD_NYI, "Not Yet Implemented\n\n" + WCMD_NOARG, "Argument missing\n" + WCMD_SYNTAXERR, "Syntax error\n" + WCMD_FILENOTFOUND, "%s : File Not Found\n" + WCMD_NOCMDHELP, "No help available for %s\n" + WCMD_NOTARGET, "Target to GOTO not found\n" + WCMD_CURRENTDATE, "Current Date is %s\n" + WCMD_CURRENTTIME, "Current Time is %s\n" + WCMD_NEWDATE, "Enter new date: " + WCMD_NEWTIME, "Enter new time: " + WCMD_MISSINGENV, "Environment variable %s not defined\n" + WCMD_READFAIL, "Failed to open '%s'\n" + WCMD_CALLINSCRIPT, "Cannot call batch label outside of a batch script\n" + WCMD_ALL, "A" + WCMD_DELPROMPT, "%s, Delete" + WCMD_ECHOPROMPT, "Echo is %s\n" + WCMD_VERIFYPROMPT, "Verify is %s\n" + WCMD_VERIFYERR, "Verify must be ON or OFF\n"; + WCMD_ARGERR, "Parameter error\n" + WCMD_VOLUMEDETAIL, "Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n" + WCMD_VOLUMEPROMPT, "Volume label (11 characters, ENTER for none)?" } diff --git a/programs/cmd/Ja.rc b/programs/cmd/Ja.rc index fa38df435fd..5cbd1194ab2 100644 --- a/programs/cmd/Ja.rc +++ b/programs/cmd/Ja.rc @@ -237,6 +237,28 @@ EXIT\t\tCMD WCMD_NO, "N" WCMD_NOASSOC, "File association missing for extension %s\n" WCMD_NOFTYPE, "No open command associated with file type '%s'\n" - WCMD_OVERWRITE, "Overwrite" + WCMD_OVERWRITE, "Overwrite %s" WCMD_MORESTR, "More..." + WCMD_TRUNCATEDLINE, "Line in Batch processing possibly truncated. Using:\n" + WCMD_NYI, "Not Yet Implemented\n\n" + WCMD_NOARG, "Argument missing\n" + WCMD_SYNTAXERR, "Syntax error\n" + WCMD_FILENOTFOUND, "%s : File Not Found\n" + WCMD_NOCMDHELP, "No help available for %s\n" + WCMD_NOTARGET, "Target to GOTO not found\n" + WCMD_CURRENTDATE, "Current Date is %s\n" + WCMD_CURRENTTIME, "Current Time is %s\n" + WCMD_NEWDATE, "Enter new date: " + WCMD_NEWTIME, "Enter new time: " + WCMD_MISSINGENV, "Environment variable %s not defined\n" + WCMD_READFAIL, "Failed to open '%s'\n" + WCMD_CALLINSCRIPT, "Cannot call batch label outside of a batch script\n" + WCMD_ALL, "A" + WCMD_DELPROMPT, "%s, Delete" + WCMD_ECHOPROMPT, "Echo is %s\n" + WCMD_VERIFYPROMPT, "Verify is %s\n" + WCMD_VERIFYERR, "Verify must be ON or OFF\n"; + WCMD_ARGERR, "Parameter error\n" + WCMD_VOLUMEDETAIL, "Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n" + WCMD_VOLUMEPROMPT, "Volume label (11 characters, ENTER for none)?" } diff --git a/programs/cmd/Ko.rc b/programs/cmd/Ko.rc index ebad6ce41c2..43395b974fb 100644 --- a/programs/cmd/Ko.rc +++ b/programs/cmd/Ko.rc @@ -235,6 +235,28 @@ HELP < WCMD_NO, "¾Æ´Ï¿À" WCMD_NOASSOC, "ÀÌ ÆÄÀÏÈ®ÀåÀÚ %s¿¡ ¿¬°áµÈ Ç®±×¸²ÀÌ ¾ø½À´Ï´Ù. \n" WCMD_NOFTYPE, "ÀÌ ÆÄÀÏ Çü½Ä '%s'°ú ¿¬°áµÈ ¾î¶°ÇÑ ¸í·Éµµ ¾ø½À´Ï´Ù.'\n" - WCMD_OVERWRITE, "µ¤¾î¾²±â" + WCMD_OVERWRITE, "Overwrite %s" WCMD_MORESTR, "´õ ¸¹ÀÌ..." + WCMD_TRUNCATEDLINE, "Line in Batch processing possibly truncated. Using:\n" + WCMD_NYI, "Not Yet Implemented\n\n" + WCMD_NOARG, "Argument missing\n" + WCMD_SYNTAXERR, "Syntax error\n" + WCMD_FILENOTFOUND, "%s : File Not Found\n" + WCMD_NOCMDHELP, "No help available for %s\n" + WCMD_NOTARGET, "Target to GOTO not found\n" + WCMD_CURRENTDATE, "Current Date is %s\n" + WCMD_CURRENTTIME, "Current Time is %s\n" + WCMD_NEWDATE, "Enter new date: " + WCMD_NEWTIME, "Enter new time: " + WCMD_MISSINGENV, "Environment variable %s not defined\n" + WCMD_READFAIL, "Failed to open '%s'\n" + WCMD_CALLINSCRIPT, "Cannot call batch label outside of a batch script\n" + WCMD_ALL, "A" + WCMD_DELPROMPT, "%s, Delete" + WCMD_ECHOPROMPT, "Echo is %s\n" + WCMD_VERIFYPROMPT, "Verify is %s\n" + WCMD_VERIFYERR, "Verify must be ON or OFF\n"; + WCMD_ARGERR, "Parameter error\n" + WCMD_VOLUMEDETAIL, "Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n" + WCMD_VOLUMEPROMPT, "Volume label (11 characters, ENTER for none)?" } diff --git a/programs/cmd/Nl.rc b/programs/cmd/Nl.rc index 8d90b6b2411..5a121235b01 100644 --- a/programs/cmd/Nl.rc +++ b/programs/cmd/Nl.rc @@ -236,6 +236,28 @@ type HELP voor meer informatie over bovengenoemde opdrachten\n" WCMD_NO, "N" WCMD_NOASSOC, "File association missing for extension %s\n" WCMD_NOFTYPE, "No open command associated with file type '%s'\n" - WCMD_OVERWRITE, "Overwrite" + WCMD_OVERWRITE, "Overwrite %s" WCMD_MORESTR, "More..." + WCMD_TRUNCATEDLINE, "Line in Batch processing possibly truncated. Using:\n" + WCMD_NYI, "Not Yet Implemented\n\n" + WCMD_NOARG, "Argument missing\n" + WCMD_SYNTAXERR, "Syntax error\n" + WCMD_FILENOTFOUND, "%s : File Not Found\n" + WCMD_NOCMDHELP, "No help available for %s\n" + WCMD_NOTARGET, "Target to GOTO not found\n" + WCMD_CURRENTDATE, "Current Date is %s\n" + WCMD_CURRENTTIME, "Current Time is %s\n" + WCMD_NEWDATE, "Enter new date: " + WCMD_NEWTIME, "Enter new time: " + WCMD_MISSINGENV, "Environment variable %s not defined\n" + WCMD_READFAIL, "Failed to open '%s'\n" + WCMD_CALLINSCRIPT, "Cannot call batch label outside of a batch script\n" + WCMD_ALL, "A" + WCMD_DELPROMPT, "%s, Delete" + WCMD_ECHOPROMPT, "Echo is %s\n" + WCMD_VERIFYPROMPT, "Verify is %s\n" + WCMD_VERIFYERR, "Verify must be ON or OFF\n"; + WCMD_ARGERR, "Parameter error\n" + WCMD_VOLUMEDETAIL, "Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n" + WCMD_VOLUMEPROMPT, "Volume label (11 characters, ENTER for none)?" } diff --git a/programs/cmd/No.rc b/programs/cmd/No.rc index aff4ffa37e7..e4e7c5cce5b 100644 --- a/programs/cmd/No.rc +++ b/programs/cmd/No.rc @@ -241,6 +241,28 @@ Skriv WCMD_NO, "N" WCMD_NOASSOC, "Manglende filtilknytning for etternavnet %s\n" WCMD_NOFTYPE, "Ingen åpnekommando er tilknyttet filtypene '%s'\n" - WCMD_OVERWRITE, "Overskriv" + WCMD_OVERWRITE, "Overwrite %s" WCMD_MORESTR, "Mer . . ." + WCMD_TRUNCATEDLINE, "Line in Batch processing possibly truncated. Using:\n" + WCMD_NYI, "Not Yet Implemented\n\n" + WCMD_NOARG, "Argument missing\n" + WCMD_SYNTAXERR, "Syntax error\n" + WCMD_FILENOTFOUND, "%s : File Not Found\n" + WCMD_NOCMDHELP, "No help available for %s\n" + WCMD_NOTARGET, "Target to GOTO not found\n" + WCMD_CURRENTDATE, "Current Date is %s\n" + WCMD_CURRENTTIME, "Current Time is %s\n" + WCMD_NEWDATE, "Enter new date: " + WCMD_NEWTIME, "Enter new time: " + WCMD_MISSINGENV, "Environment variable %s not defined\n" + WCMD_READFAIL, "Failed to open '%s'\n" + WCMD_CALLINSCRIPT, "Cannot call batch label outside of a batch script\n" + WCMD_ALL, "A" + WCMD_DELPROMPT, "%s, Delete" + WCMD_ECHOPROMPT, "Echo is %s\n" + WCMD_VERIFYPROMPT, "Verify is %s\n" + WCMD_VERIFYERR, "Verify must be ON or OFF\n"; + WCMD_ARGERR, "Parameter error\n" + WCMD_VOLUMEDETAIL, "Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n" + WCMD_VOLUMEPROMPT, "Volume label (11 characters, ENTER for none)?" } diff --git a/programs/cmd/Pl.rc b/programs/cmd/Pl.rc index 3203c070fec..67c659c1551 100644 --- a/programs/cmd/Pl.rc +++ b/programs/cmd/Pl.rc @@ -238,6 +238,28 @@ Wpisz HELP dla dok WCMD_NO, "N" WCMD_NOASSOC, "File association missing for extension %s\n" WCMD_NOFTYPE, "No open command associated with file type '%s'\n" - WCMD_OVERWRITE, "Overwrite" + WCMD_OVERWRITE, "Overwrite %s" WCMD_MORESTR, "More..." + WCMD_TRUNCATEDLINE, "Line in Batch processing possibly truncated. Using:\n" + WCMD_NYI, "Not Yet Implemented\n\n" + WCMD_NOARG, "Argument missing\n" + WCMD_SYNTAXERR, "Syntax error\n" + WCMD_FILENOTFOUND, "%s : File Not Found\n" + WCMD_NOCMDHELP, "No help available for %s\n" + WCMD_NOTARGET, "Target to GOTO not found\n" + WCMD_CURRENTDATE, "Current Date is %s\n" + WCMD_CURRENTTIME, "Current Time is %s\n" + WCMD_NEWDATE, "Enter new date: " + WCMD_NEWTIME, "Enter new time: " + WCMD_MISSINGENV, "Environment variable %s not defined\n" + WCMD_READFAIL, "Failed to open '%s'\n" + WCMD_CALLINSCRIPT, "Cannot call batch label outside of a batch script\n" + WCMD_ALL, "A" + WCMD_DELPROMPT, "%s, Delete" + WCMD_ECHOPROMPT, "Echo is %s\n" + WCMD_VERIFYPROMPT, "Verify is %s\n" + WCMD_VERIFYERR, "Verify must be ON or OFF\n"; + WCMD_ARGERR, "Parameter error\n" + WCMD_VOLUMEDETAIL, "Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n" + WCMD_VOLUMEPROMPT, "Volume label (11 characters, ENTER for none)?" } diff --git a/programs/cmd/Pt.rc b/programs/cmd/Pt.rc index af023d324a7..17090dd14ba 100644 --- a/programs/cmd/Pt.rc +++ b/programs/cmd/Pt.rc @@ -446,6 +446,28 @@ Digite HELP para mais informa WCMD_NO, "N" WCMD_NOASSOC, "File association missing for extension %s\n" WCMD_NOFTYPE, "No open command associated with file type '%s'\n" - WCMD_OVERWRITE, "Overwrite" + WCMD_OVERWRITE, "Overwrite %s" WCMD_MORESTR, "More..." + WCMD_TRUNCATEDLINE, "Line in Batch processing possibly truncated. Using:\n" + WCMD_NYI, "Not Yet Implemented\n\n" + WCMD_NOARG, "Argument missing\n" + WCMD_SYNTAXERR, "Syntax error\n" + WCMD_FILENOTFOUND, "%s : File Not Found\n" + WCMD_NOCMDHELP, "No help available for %s\n" + WCMD_NOTARGET, "Target to GOTO not found\n" + WCMD_CURRENTDATE, "Current Date is %s\n" + WCMD_CURRENTTIME, "Current Time is %s\n" + WCMD_NEWDATE, "Enter new date: " + WCMD_NEWTIME, "Enter new time: " + WCMD_MISSINGENV, "Environment variable %s not defined\n" + WCMD_READFAIL, "Failed to open '%s'\n" + WCMD_CALLINSCRIPT, "Cannot call batch label outside of a batch script\n" + WCMD_ALL, "A" + WCMD_DELPROMPT, "%s, Delete" + WCMD_ECHOPROMPT, "Echo is %s\n" + WCMD_VERIFYPROMPT, "Verify is %s\n" + WCMD_VERIFYERR, "Verify must be ON or OFF\n"; + WCMD_ARGERR, "Parameter error\n" + WCMD_VOLUMEDETAIL, "Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n" + WCMD_VOLUMEPROMPT, "Volume label (11 characters, ENTER for none)?" } diff --git a/programs/cmd/Ru.rc b/programs/cmd/Ru.rc index dfb805546b6..d3860c40cfe 100644 --- a/programs/cmd/Ru.rc +++ b/programs/cmd/Ru.rc @@ -249,6 +249,28 @@ EXIT\t\t WCMD_NO, "N" WCMD_NOASSOC, "File association missing for extension %s\n" WCMD_NOFTYPE, "No open command associated with file type '%s'\n" - WCMD_OVERWRITE, "Overwrite" + WCMD_OVERWRITE, "Overwrite %s" WCMD_MORESTR, "More..." + WCMD_TRUNCATEDLINE, "Line in Batch processing possibly truncated. Using:\n" + WCMD_NYI, "Not Yet Implemented\n\n" + WCMD_NOARG, "Argument missing\n" + WCMD_SYNTAXERR, "Syntax error\n" + WCMD_FILENOTFOUND, "%s : File Not Found\n" + WCMD_NOCMDHELP, "No help available for %s\n" + WCMD_NOTARGET, "Target to GOTO not found\n" + WCMD_CURRENTDATE, "Current Date is %s\n" + WCMD_CURRENTTIME, "Current Time is %s\n" + WCMD_NEWDATE, "Enter new date: " + WCMD_NEWTIME, "Enter new time: " + WCMD_MISSINGENV, "Environment variable %s not defined\n" + WCMD_READFAIL, "Failed to open '%s'\n" + WCMD_CALLINSCRIPT, "Cannot call batch label outside of a batch script\n" + WCMD_ALL, "A" + WCMD_DELPROMPT, "%s, Delete" + WCMD_ECHOPROMPT, "Echo is %s\n" + WCMD_VERIFYPROMPT, "Verify is %s\n" + WCMD_VERIFYERR, "Verify must be ON or OFF\n"; + WCMD_ARGERR, "Parameter error\n" + WCMD_VOLUMEDETAIL, "Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n" + WCMD_VOLUMEPROMPT, "Volume label (11 characters, ENTER for none)?" } diff --git a/programs/cmd/Si.rc b/programs/cmd/Si.rc index 1c120b45647..8060fad3ff2 100644 --- a/programs/cmd/Si.rc +++ b/programs/cmd/Si.rc @@ -235,6 +235,28 @@ Enter HELP for further information on any of the above commands\n" WCMD_NO, "N" WCMD_NOASSOC, "File association missing for extension %s\n" WCMD_NOFTYPE, "No open command associated with file type '%s'\n" - WCMD_OVERWRITE, "Overwrite" + WCMD_OVERWRITE, "Overwrite %s" WCMD_MORESTR, "More..." + WCMD_TRUNCATEDLINE, "Line in Batch processing possibly truncated. Using:\n" + WCMD_NYI, "Not Yet Implemented\n\n" + WCMD_NOARG, "Argument missing\n" + WCMD_SYNTAXERR, "Syntax error\n" + WCMD_FILENOTFOUND, "%s : File Not Found\n" + WCMD_NOCMDHELP, "No help available for %s\n" + WCMD_NOTARGET, "Target to GOTO not found\n" + WCMD_CURRENTDATE, "Current Date is %s\n" + WCMD_CURRENTTIME, "Current Time is %s\n" + WCMD_NEWDATE, "Enter new date: " + WCMD_NEWTIME, "Enter new time: " + WCMD_MISSINGENV, "Environment variable %s not defined\n" + WCMD_READFAIL, "Failed to open '%s'\n" + WCMD_CALLINSCRIPT, "Cannot call batch label outside of a batch script\n" + WCMD_ALL, "A" + WCMD_DELPROMPT, "%s, Delete" + WCMD_ECHOPROMPT, "Echo is %s\n" + WCMD_VERIFYPROMPT, "Verify is %s\n" + WCMD_VERIFYERR, "Verify must be ON or OFF\n"; + WCMD_ARGERR, "Parameter error\n" + WCMD_VOLUMEDETAIL, "Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n" + WCMD_VOLUMEPROMPT, "Volume label (11 characters, ENTER for none)?" } diff --git a/programs/cmd/Tr.rc b/programs/cmd/Tr.rc index 50a00d0bac7..69e707e6528 100644 --- a/programs/cmd/Tr.rc +++ b/programs/cmd/Tr.rc @@ -237,6 +237,28 @@ Yukar WCMD_NO, "N" WCMD_NOASSOC, "File association missing for extension %s\n" WCMD_NOFTYPE, "No open command associated with file type '%s'\n" - WCMD_OVERWRITE, "Overwrite" + WCMD_OVERWRITE, "Overwrite %s" WCMD_MORESTR, "More..." + WCMD_TRUNCATEDLINE, "Line in Batch processing possibly truncated. Using:\n" + WCMD_NYI, "Not Yet Implemented\n\n" + WCMD_NOARG, "Argument missing\n" + WCMD_SYNTAXERR, "Syntax error\n" + WCMD_FILENOTFOUND, "%s : File Not Found\n" + WCMD_NOCMDHELP, "No help available for %s\n" + WCMD_NOTARGET, "Target to GOTO not found\n" + WCMD_CURRENTDATE, "Current Date is %s\n" + WCMD_CURRENTTIME, "Current Time is %s\n" + WCMD_NEWDATE, "Enter new date: " + WCMD_NEWTIME, "Enter new time: " + WCMD_MISSINGENV, "Environment variable %s not defined\n" + WCMD_READFAIL, "Failed to open '%s'\n" + WCMD_CALLINSCRIPT, "Cannot call batch label outside of a batch script\n" + WCMD_ALL, "A" + WCMD_DELPROMPT, "%s, Delete" + WCMD_ECHOPROMPT, "Echo is %s\n" + WCMD_VERIFYPROMPT, "Verify is %s\n" + WCMD_VERIFYERR, "Verify must be ON or OFF\n"; + WCMD_ARGERR, "Parameter error\n" + WCMD_VOLUMEDETAIL, "Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n" + WCMD_VOLUMEPROMPT, "Volume label (11 characters, ENTER for none)?" } diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c index 0824c27ef8a..9824fe500bc 100644 --- a/programs/cmd/batch.c +++ b/programs/cmd/batch.c @@ -106,9 +106,9 @@ void WCMD_batch (char *file, char *command, int called, char *startLabel, HANDLE while (context -> skip_rest == FALSE && WCMD_fgets (string, sizeof(string), h)) { if (strlen(string) == MAXSTRING -1) { - WCMD_output_asis( "Line in Batch processing possibly truncated. Using:\n"); + WCMD_output_asis( WCMD_LoadMessage(WCMD_TRUNCATEDLINE)); WCMD_output_asis( string); - WCMD_output_asis( "\n"); + WCMD_output_asis( newline); } if (string[0] != ':') { /* Skip over labels */ WCMD_process_command (string); @@ -323,6 +323,7 @@ void WCMD_HandleTildaModifiers(char **start, char *forVariable) { const char validmodifiers[NUMMODIFIERS] = { '~', 'f', 'd', 'p', 'n', 'x', 's', 'a', 't', 'z', '$' }; + const char space[] = " "; WIN32_FILE_ATTRIBUTE_DATA fileInfo; char outputparam[MAX_PATH]; @@ -479,13 +480,13 @@ void WCMD_HandleTildaModifiers(char **start, char *forVariable) { int datelen; doneModifier = TRUE; - if (finaloutput[0] != 0x00) strcat(finaloutput, " "); + if (finaloutput[0] != 0x00) strcat(finaloutput, space); /* Format the time */ FileTimeToSystemTime(&fileInfo.ftLastWriteTime, &systime); GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &systime, NULL, thisoutput, MAX_PATH); - strcat(thisoutput, " "); + strcat(thisoutput, space); datelen = strlen(thisoutput); GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &systime, NULL, (thisoutput+datelen), MAX_PATH-datelen); @@ -500,14 +501,14 @@ void WCMD_HandleTildaModifiers(char **start, char *forVariable) { fileInfo.nFileSizeLow; doneModifier = TRUE; - if (finaloutput[0] != 0x00) strcat(finaloutput, " "); + if (finaloutput[0] != 0x00) strcat(finaloutput, space); sprintf(thisoutput, "%u", fullsize); strcat(finaloutput, thisoutput); } /* 4. Handle 's' : Use short paths (File doesn't have to exist) */ if (memchr(firstModifier, 's', modifierLen) != NULL) { - if (finaloutput[0] != 0x00) strcat(finaloutput, " "); + if (finaloutput[0] != 0x00) strcat(finaloutput, space); /* Don't flag as doneModifier - %~s on its own is processed later */ GetShortPathName(outputparam, outputparam, sizeof(outputparam)); } @@ -516,7 +517,7 @@ void WCMD_HandleTildaModifiers(char **start, char *forVariable) { /* Note this overrides d,p,n,x */ if (memchr(firstModifier, 'f', modifierLen) != NULL) { doneModifier = TRUE; - if (finaloutput[0] != 0x00) strcat(finaloutput, " "); + if (finaloutput[0] != 0x00) strcat(finaloutput, space); strcat(finaloutput, fullfilename); } else { @@ -526,7 +527,7 @@ void WCMD_HandleTildaModifiers(char **start, char *forVariable) { char ext[MAX_PATH]; BOOL doneFileModifier = FALSE; - if (finaloutput[0] != 0x00) strcat(finaloutput, " "); + if (finaloutput[0] != 0x00) strcat(finaloutput, space); /* Split into components */ WCMD_splitpath(fullfilename, drive, dir, fname, ext); @@ -563,7 +564,7 @@ void WCMD_HandleTildaModifiers(char **start, char *forVariable) { if (!doneFileModifier && memchr(firstModifier, 's', modifierLen) != NULL) { doneModifier = TRUE; - if (finaloutput[0] != 0x00) strcat(finaloutput, " "); + if (finaloutput[0] != 0x00) strcat(finaloutput, space); strcat(finaloutput, outputparam); } } @@ -611,7 +612,7 @@ void WCMD_call (char *command) { SetFilePointer(context -> h, li.u.LowPart, &li.u.HighPart, FILE_BEGIN); } else { - printf("Cannot call batch label outside of a batch script\n"); + WCMD_output_asis( WCMD_LoadMessage(WCMD_CALLINSCRIPT)); } } } diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 53aa74219a0..5c6510f342d 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -89,7 +89,7 @@ void WCMD_clear_screen (void) { void WCMD_change_tty (void) { - WCMD_output (nyi); + WCMD_output (WCMD_LoadMessage(WCMD_NYI)); } @@ -102,16 +102,14 @@ void WCMD_change_tty (void) { void WCMD_copy (void) { - DWORD count; WIN32_FIND_DATA fd; HANDLE hff; BOOL force, status; - static const char overwrite[] = "Overwrite file (Y/N)?"; - char string[8], outpath[MAX_PATH], inpath[MAX_PATH], *infile, copycmd[3]; + char outpath[MAX_PATH], inpath[MAX_PATH], *infile, copycmd[3]; DWORD len; if (param1[0] == 0x00) { - WCMD_output ("Argument missing\n"); + WCMD_output (WCMD_LoadMessage(WCMD_NOARG)); return; } @@ -151,10 +149,12 @@ void WCMD_copy (void) { if (!force) { hff = FindFirstFile (outpath, &fd); if (hff != INVALID_HANDLE_VALUE) { + char buffer[MAXSTRING]; + FindClose (hff); - WCMD_output (overwrite); - ReadFile (GetStdHandle(STD_INPUT_HANDLE), string, sizeof(string), &count, NULL); - if (toupper(string[0]) == 'Y') force = TRUE; + + sprintf(buffer, WCMD_LoadMessage(WCMD_OVERWRITE), outpath); + force = WCMD_ask_confirm(buffer, FALSE, NULL); } else force = TRUE; } @@ -220,7 +220,7 @@ static BOOL create_full_path(CHAR* path) void WCMD_create_dir (void) { if (param1[0] == 0x00) { - WCMD_output ("Argument missing\n"); + WCMD_output (WCMD_LoadMessage(WCMD_NOARG)); return; } if (!create_full_path(param1)) WCMD_print_error (); @@ -291,7 +291,7 @@ BOOL WCMD_delete (char *command, BOOL expectDir) { /* Ask for confirmation */ sprintf(question, "%s, ", fpath); - ok = WCMD_ask_confirm(question, TRUE); + ok = WCMD_ask_confirm(question, TRUE, NULL); /* Abort if answer is 'N' */ if (!ok) continue; @@ -364,7 +364,7 @@ BOOL WCMD_delete (char *command, BOOL expectDir) { case 'A': attribute = (fd.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE); break; default: - WCMD_output ("Syntax error\n"); + WCMD_output (WCMD_LoadMessage(WCMD_SYNTAXERR)); } /* Now check result, keeping a running boolean about whether it @@ -392,8 +392,8 @@ BOOL WCMD_delete (char *command, BOOL expectDir) { char question[MAXSTRING]; /* Ask for confirmation */ - sprintf(question, "%s, Delete", fpath); - ok = WCMD_ask_confirm(question, FALSE); + sprintf(question, WCMD_LoadMessage(WCMD_DELPROMPT), fpath); + ok = WCMD_ask_confirm(question, FALSE, NULL); } /* Only proceed if ok to */ @@ -494,7 +494,7 @@ BOOL WCMD_delete (char *command, BOOL expectDir) { if (expectDir) { if (!found) { errorlevel = 1; - WCMD_output ("%s : File Not Found\n", argCopy); + WCMD_output (WCMD_LoadMessage(WCMD_FILENOTFOUND), argCopy); } } foundAny |= found; @@ -503,7 +503,7 @@ BOOL WCMD_delete (char *command, BOOL expectDir) { /* Handle no valid args */ if (argsProcessed == 0) { - WCMD_output ("Argument missing\n"); + WCMD_output (WCMD_LoadMessage(WCMD_NOARG)); } return foundAny; @@ -518,7 +518,6 @@ BOOL WCMD_delete (char *command, BOOL expectDir) { void WCMD_echo (const char *command) { - static const char eon[] = "Echo is ON\n", eoff[] = "Echo is OFF\n"; int count; if ((command[0] == '.') && (command[1] == 0)) { @@ -529,8 +528,8 @@ void WCMD_echo (const char *command) { command++; count = strlen(command); if (count == 0) { - if (echo_mode) WCMD_output (eon); - else WCMD_output (eoff); + if (echo_mode) WCMD_output (WCMD_LoadMessage(WCMD_ECHOPROMPT), "ON"); + else WCMD_output (WCMD_LoadMessage(WCMD_ECHOPROMPT), "OFF"); return; } if (lstrcmpi(command, "ON") == 0) { @@ -565,7 +564,7 @@ void WCMD_for (char *p) { if (lstrcmpi (WCMD_parameter (p, 1, NULL), "in") || lstrcmpi (WCMD_parameter (p, 3, NULL), "do") || (param1[0] != '%')) { - WCMD_output ("Syntax error\n"); + WCMD_output (WCMD_LoadMessage(WCMD_SYNTAXERR)); return; } lstrcpyn (set, WCMD_parameter (p, 2, NULL), sizeof(set)); @@ -651,7 +650,7 @@ void WCMD_give_help (char *command) { return; } } - WCMD_output ("No help available for %s\n", param1); + WCMD_output (WCMD_LoadMessage(WCMD_NOCMDHELP), param1); } return; } @@ -670,7 +669,7 @@ void WCMD_goto (void) { char string[MAX_PATH]; if (param1[0] == 0x00) { - WCMD_output ("Argument missing\n"); + WCMD_output (WCMD_LoadMessage(WCMD_NOARG)); return; } if (context != NULL) { @@ -689,7 +688,7 @@ void WCMD_goto (void) { while (WCMD_fgets (string, sizeof(string), context -> h)) { if ((string[0] == ':') && (lstrcmpi (&string[1], paramStart) == 0)) return; } - WCMD_output ("Target to GOTO not found\n"); + WCMD_output (WCMD_LoadMessage(WCMD_NOTARGET)); } return; } @@ -715,7 +714,7 @@ void WCMD_pushd (char *command) { if( !curdir || !thisdir ) { LocalFree(curdir); LocalFree(thisdir); - WCMD_output ("out of memory\n"); + WINE_ERR ("out of memory\n"); return; } @@ -801,7 +800,7 @@ void WCMD_if (char *p) { WCMD_parameter (s, 1, &command); } else { - WCMD_output ("Syntax error\n"); + WCMD_output (WCMD_LoadMessage(WCMD_SYNTAXERR)); return; } if (test != negate) { @@ -830,7 +829,7 @@ void WCMD_move (void) { char ext[MAX_PATH]; if (param1[0] == 0x00) { - WCMD_output ("Argument missing\n"); + WCMD_output (WCMD_LoadMessage(WCMD_NOARG)); return; } @@ -904,13 +903,13 @@ void WCMD_move (void) { /* Prompt if overwriting */ if (!force) { char question[MAXSTRING]; - char overwrite[MAXSTRING]; + char yesChar[10]; - LoadString (hinst, WCMD_OVERWRITE, overwrite, sizeof(overwrite)); + strcpy(yesChar, WCMD_LoadMessage(WCMD_YES)); /* Ask for confirmation */ - sprintf(question, "%s %s? ", overwrite, dest); - ok = WCMD_ask_confirm(question, TRUE); + sprintf(question, WCMD_LoadMessage(WCMD_OVERWRITE), dest); + ok = WCMD_ask_confirm(question, FALSE, NULL); /* So delete the destination prior to the move */ if (ok) { @@ -995,7 +994,7 @@ void WCMD_remove_dir (char *command) { /* Ask for confirmation */ sprintf(question, "%s, ", thisArg); - ok = WCMD_ask_confirm(question, TRUE); + ok = WCMD_ask_confirm(question, TRUE, NULL); /* Abort if answer is 'N' */ if (!ok) return; @@ -1014,7 +1013,7 @@ void WCMD_remove_dir (char *command) { /* Handle no valid args */ if (argsProcessed == 0) { - WCMD_output ("Argument missing\n"); + WCMD_output (WCMD_LoadMessage(WCMD_NOARG)); return; } @@ -1043,7 +1042,7 @@ void WCMD_rename (void) { /* Must be at least two args */ if (param1[0] == 0x00 || param2[0] == 0x00) { - WCMD_output ("Argument missing\n"); + WCMD_output (WCMD_LoadMessage(WCMD_NOARG)); errorlevel = 1; return; } @@ -1151,7 +1150,7 @@ static WCHAR *WCMD_dupenv( const WCHAR *env ) env_copy = LocalAlloc (LMEM_FIXED, (len+1) * sizeof (WCHAR) ); if (!env_copy) { - WCMD_output ("out of memory\n"); + WINE_ERR("out of memory\n"); return env_copy; } memcpy (env_copy, env, len*sizeof (WCHAR)); @@ -1176,7 +1175,7 @@ void WCMD_setlocal (const char *s) { env_copy = LocalAlloc (LMEM_FIXED, sizeof (struct env_stack)); if( !env_copy ) { - WCMD_output ("out of memory\n"); + WINE_ERR ("out of memory\n"); return; } @@ -1299,7 +1298,7 @@ void WCMD_setshow_attrib (void) { char flags[9] = {" "}; if (param1[0] == '-') { - WCMD_output (nyi); + WCMD_output (WCMD_LoadMessage(WCMD_NYI)); return; } @@ -1310,7 +1309,7 @@ void WCMD_setshow_attrib (void) { hff = FindFirstFile (param1, &fd); if (hff == INVALID_HANDLE_VALUE) { - WCMD_output ("%s: File Not Found\n",param1); + WCMD_output (WCMD_LoadMessage(WCMD_FILENOTFOUND), param1); } else { do { @@ -1368,7 +1367,7 @@ void WCMD_setshow_default (char *command) { GetCurrentDirectory (sizeof(cwd), cwd); if (strlen(command) == 0) { - strcat (cwd, "\n"); + strcat (cwd, newline); WCMD_output (cwd); } else { @@ -1461,19 +1460,19 @@ void WCMD_setshow_date (void) { if (lstrlen(param1) == 0) { if (GetDateFormat (LOCALE_USER_DEFAULT, 0, NULL, NULL, curdate, sizeof(curdate))) { - WCMD_output ("Current Date is %s\n", curdate); + WCMD_output (WCMD_LoadMessage(WCMD_CURRENTDATE), curdate); if (strstr (quals, "/T") == NULL) { - WCMD_output("Enter new date: "); + WCMD_output (WCMD_LoadMessage(WCMD_NEWDATE)); ReadFile (GetStdHandle(STD_INPUT_HANDLE), buffer, sizeof(buffer), &count, NULL); if (count > 2) { - WCMD_output (nyi); + WCMD_output (WCMD_LoadMessage(WCMD_NYI)); } } } else WCMD_print_error (); } else { - WCMD_output (nyi); + WCMD_output (WCMD_LoadMessage(WCMD_NYI)); } } @@ -1530,7 +1529,7 @@ static int WCMD_setshow_sortenv(const char *s, const char *stub) /* Don't display special internal variables */ if (str[i][0] != '=') { WCMD_output_asis(str[i]); - WCMD_output_asis("\n"); + WCMD_output_asis(newline); displayedcount++; } } @@ -1571,7 +1570,7 @@ void WCMD_setshow_env (char *s) { /* If no parameter, or no '=' sign, return an error */ if (!(*s) || ((p = strchr (s, '=')) == NULL )) { - WCMD_output ("Argument missing\n"); + WCMD_output (WCMD_LoadMessage(WCMD_NOARG)); return; } @@ -1594,7 +1593,7 @@ void WCMD_setshow_env (char *s) { if (p == NULL) { env = GetEnvironmentStrings (); if (WCMD_setshow_sortenv( env, s ) == 0) { - WCMD_output ("Environment variable %s not defined\n", s); + WCMD_output (WCMD_LoadMessage(WCMD_MISSINGENV), s); errorlevel = 1; } return; @@ -1626,7 +1625,7 @@ void WCMD_setshow_path (char *command) { if (status != 0) { WCMD_output_asis ( "PATH="); WCMD_output_asis ( string); - WCMD_output_asis ( "\n"); + WCMD_output_asis ( newline); } else { WCMD_output ("PATH not found\n"); @@ -1679,19 +1678,19 @@ void WCMD_setshow_time (void) { GetLocalTime(&st); if (GetTimeFormat (LOCALE_USER_DEFAULT, 0, &st, NULL, curtime, sizeof(curtime))) { - WCMD_output ("Current Time is %s\n", curtime); + WCMD_output (WCMD_LoadMessage(WCMD_CURRENTDATE), curtime); if (strstr (quals, "/T") == NULL) { - WCMD_output ("Enter new time: ", curtime); + WCMD_output (WCMD_LoadMessage(WCMD_NEWTIME)); ReadFile (GetStdHandle(STD_INPUT_HANDLE), buffer, sizeof(buffer), &count, NULL); if (count > 2) { - WCMD_output (nyi); + WCMD_output (WCMD_LoadMessage(WCMD_NYI)); } } } else WCMD_print_error (); } else { - WCMD_output (nyi); + WCMD_output (WCMD_LoadMessage(WCMD_NYI)); } } @@ -1750,7 +1749,7 @@ void WCMD_type (char *command) { BOOL writeHeaders = FALSE; if (param1[0] == 0x00) { - WCMD_output ("Argument missing\n"); + WCMD_output (WCMD_LoadMessage(WCMD_NOARG)); return; } @@ -1772,7 +1771,7 @@ void WCMD_type (char *command) { FILE_ATTRIBUTE_NORMAL, NULL); if (h == INVALID_HANDLE_VALUE) { WCMD_print_error (); - WCMD_output ("%s :Failed\n", thisArg); + WCMD_output (WCMD_LoadMessage(WCMD_READFAIL), thisArg); errorlevel = 1; } else { if (writeHeaders) { @@ -1867,7 +1866,7 @@ void WCMD_more (char *command) { FILE_ATTRIBUTE_NORMAL, NULL); if (h == INVALID_HANDLE_VALUE) { WCMD_print_error (); - WCMD_output ("%s :Failed\n", thisArg); + WCMD_output (WCMD_LoadMessage(WCMD_READFAIL), thisArg); errorlevel = 1; } else { ULONG64 curPos = 0; @@ -1907,13 +1906,12 @@ void WCMD_more (char *command) { void WCMD_verify (char *command) { - static const char von[] = "Verify is ON\n", voff[] = "Verify is OFF\n"; int count; count = strlen(command); if (count == 0) { - if (verify_mode) WCMD_output (von); - else WCMD_output (voff); + if (verify_mode) WCMD_output (WCMD_LoadMessage(WCMD_VERIFYPROMPT), "ON"); + else WCMD_output (WCMD_LoadMessage(WCMD_VERIFYPROMPT), "OFF"); return; } if (lstrcmpi(command, "ON") == 0) { @@ -1924,7 +1922,7 @@ void WCMD_verify (char *command) { verify_mode = 0; return; } - else WCMD_output ("Verify must be ON or OFF\n"); + else WCMD_output (WCMD_LoadMessage(WCMD_VERIFYERR)); } /**************************************************************************** @@ -1962,7 +1960,7 @@ int WCMD_volume (int mode, char *path) { } else { if ((path[1] != ':') || (lstrlen(path) != 2)) { - WCMD_output_asis("Syntax Error\n\n"); + WCMD_output (WCMD_LoadMessage(WCMD_SYNTAXERR)); return 0; } wsprintf (curdir, "%s\\", path); @@ -1973,10 +1971,10 @@ int WCMD_volume (int mode, char *path) { WCMD_print_error (); return 0; } - WCMD_output ("Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n", + WCMD_output (WCMD_LoadMessage(WCMD_VOLUMEDETAIL), curdir[0], label, HIWORD(serial), LOWORD(serial)); if (mode) { - WCMD_output ("Volume label (11 characters, ENTER for none)?"); + WCMD_output (WCMD_LoadMessage(WCMD_VOLUMEPROMPT)); ReadFile (GetStdHandle(STD_INPUT_HANDLE), string, sizeof(string), &count, NULL); if (count > 1) { string[count-1] = '\0'; /* ReadFile output is not null-terminated! */ @@ -2017,21 +2015,25 @@ void WCMD_exit (void) { * Issue a message and ask 'Are you sure (Y/N)', waiting on a valid * answer. * - * Returns True if Y answer is selected + * Returns True if Y (or A) answer is selected + * If optionAll contains a pointer, ALL is allowed, and if answered + * set to TRUE * */ -BOOL WCMD_ask_confirm (char *message, BOOL showSureText) { +BOOL WCMD_ask_confirm (char *message, BOOL showSureText, BOOL *optionAll) { char msgbuffer[MAXSTRING]; char Ybuffer[MAXSTRING]; char Nbuffer[MAXSTRING]; + char Abuffer[MAXSTRING]; char answer[MAX_PATH] = ""; DWORD count = 0; /* Load the translated 'Are you sure', plus valid answers */ LoadString (hinst, WCMD_CONFIRM, msgbuffer, sizeof(msgbuffer)); LoadString (hinst, WCMD_YES, Ybuffer, sizeof(Ybuffer)); - LoadString (hinst, WCMD_NO, Nbuffer, sizeof(Nbuffer)); + LoadString (hinst, WCMD_NO, Nbuffer, sizeof(Nbuffer)); + LoadString (hinst, WCMD_ALL, Abuffer, sizeof(Abuffer)); /* Loop waiting on a Y or N */ while (answer[0] != Ybuffer[0] && answer[0] != Nbuffer[0]) { @@ -2043,6 +2045,10 @@ BOOL WCMD_ask_confirm (char *message, BOOL showSureText) { WCMD_output_asis (Ybuffer); WCMD_output_asis ("/"); WCMD_output_asis (Nbuffer); + if (optionAll) { + WCMD_output_asis ("/"); + WCMD_output_asis (Abuffer); + } WCMD_output_asis (")?"); ReadFile (GetStdHandle(STD_INPUT_HANDLE), answer, sizeof(answer), &count, NULL); @@ -2050,7 +2056,8 @@ BOOL WCMD_ask_confirm (char *message, BOOL showSureText) { } /* Return the answer */ - return (answer[0] == Ybuffer[0]); + return ((answer[0] == Ybuffer[0]) || + (optionAll && (answer[0] == Abuffer[0]))); } /***************************************************************************** @@ -2120,7 +2127,7 @@ void WCMD_assoc (char *command, BOOL assoc) { if (rc == ERROR_SUCCESS) { WCMD_output_asis(keyValue); } - WCMD_output_asis("\n"); + WCMD_output_asis(newline); } } } @@ -2152,7 +2159,7 @@ void WCMD_assoc (char *command, BOOL assoc) { WCMD_output_asis("="); /* If no default value found, leave line empty after '=' */ if (rc == ERROR_SUCCESS) WCMD_output_asis(keyValue); - WCMD_output_asis("\n"); + WCMD_output_asis(newline); RegCloseKey(readKey); } else { @@ -2226,7 +2233,7 @@ void WCMD_assoc (char *command, BOOL assoc) { WCMD_output_asis(command); WCMD_output_asis("="); WCMD_output_asis(newValue); - WCMD_output_asis("\n"); + WCMD_output_asis(newline); } } } @@ -2250,7 +2257,7 @@ void WCMD_color (void) { HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); if (param1[0] != 0x00 && strlen(param1) > 2) { - WCMD_output ("Argument invalid\n"); + WCMD_output (WCMD_LoadMessage(WCMD_ARGERR)); return; } diff --git a/programs/cmd/directory.c b/programs/cmd/directory.c index 24c7c6c6191..49c2c1a004c 100644 --- a/programs/cmd/directory.c +++ b/programs/cmd/directory.c @@ -490,7 +490,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le fd = HeapReAlloc(GetProcessHeap(),0,fd,(entry_count+1)*sizeof(WIN32_FIND_DATA)); if (fd == NULL) { FindClose (hff); - WCMD_output ("Memory Allocation Error"); + WINE_ERR ("Out of memory"); errorlevel = 1; return parms->next; } @@ -504,7 +504,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le /* Output the results */ if (!bare) { - if (level != 0 && (entry_count > 0)) WCMD_output ("\n"); + if (level != 0 && (entry_count > 0)) WCMD_output (newline); if (!recurse || ((entry_count > 0) && done_header==FALSE)) { WCMD_output ("Directory of %s\n\n", real_path); done_header = TRUE; @@ -629,7 +629,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le } } } - if (addNewLine) WCMD_output ("\n"); + if (addNewLine) WCMD_output (newline); cur_width = 0; } diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h index 76cd22b2f48..78db85840c9 100644 --- a/programs/cmd/wcmd.h +++ b/programs/cmd/wcmd.h @@ -83,9 +83,10 @@ char *WCMD_strtrim_leading_spaces (char *string); void WCMD_strtrim_trailing_spaces (char *string); void WCMD_opt_s_strip_quotes(char *cmd); void WCMD_HandleTildaModifiers(char **start, char *forVariable); -BOOL WCMD_ask_confirm (char *message, BOOL showSureText); +BOOL WCMD_ask_confirm (char *message, BOOL showSureText, BOOL *optionAll); void WCMD_splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext); +char *WCMD_LoadMessage(UINT id); /* Data structure to hold context when executing batch files */ @@ -179,19 +180,40 @@ typedef struct _DIRECTORY_STACK #define WCMD_EXIT 44 /* Some standard messages */ -extern const char nyi[]; extern const char newline[]; extern const char version_string[]; extern const char anykey[]; /* Translated messages */ -#define WCMD_CONFIRM 1001 -#define WCMD_YES 1002 -#define WCMD_NO 1003 -#define WCMD_NOASSOC 1004 -#define WCMD_NOFTYPE 1005 -#define WCMD_OVERWRITE 1006 -#define WCMD_MORESTR 1007 +#define WCMD_CONFIRM 1001 +#define WCMD_YES 1002 +#define WCMD_NO 1003 +#define WCMD_NOASSOC 1004 +#define WCMD_NOFTYPE 1005 +#define WCMD_OVERWRITE 1006 +#define WCMD_MORESTR 1007 +#define WCMD_TRUNCATEDLINE 1008 +#define WCMD_NYI 1009 +#define WCMD_NOARG 1010 +#define WCMD_SYNTAXERR 1011 +#define WCMD_FILENOTFOUND 1012 +#define WCMD_NOCMDHELP 1013 +#define WCMD_NOTARGET 1014 +#define WCMD_CURRENTDATE 1015 +#define WCMD_CURRENTTIME 1016 +#define WCMD_NEWDATE 1017 +#define WCMD_NEWTIME 1018 +#define WCMD_MISSINGENV 1019 +#define WCMD_READFAIL 1020 +#define WCMD_CALLINSCRIPT 1021 +#define WCMD_ALL 1022 +#define WCMD_DELPROMPT 1023 +#define WCMD_ECHOPROMPT 1024 +#define WCMD_VERIFYPROMPT 1025 +#define WCMD_VERIFYERR 1026 +#define WCMD_ARGERR 1027 +#define WCMD_VOLUMEDETAIL 1028 +#define WCMD_VOLUMEPROMPT 1029 /* msdn specified max for Win XP */ #define MAXSTRING 8192 diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index a74b0852f3b..32b70f4d895 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -42,7 +42,6 @@ HINSTANCE hinst; DWORD errorlevel; int echo_mode = 1, verify_mode = 0, defaultColor = 7; static int opt_c, opt_k, opt_s; -const char nyi[] = "Not Yet Implemented\n\n"; const char newline[] = "\n"; const char version_string[] = "CMD Version " PACKAGE_VERSION "\n\n"; const char anykey[] = "Press Return key to continue: "; @@ -466,7 +465,7 @@ void WCMD_process_command (char *command) if (echo_mode && (cmd[0] != '@')) { WCMD_show_prompt(); WCMD_output_asis ( cmd); - WCMD_output_asis ( "\n"); + WCMD_output_asis ( newline); } } @@ -1129,7 +1128,7 @@ void WCMD_print_error (void) { status = FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, error_code, 0, (LPTSTR) &lpMsgBuf, 0, NULL); if (!status) { - WCMD_output ("FIXME: Cannot display message for error %d, status %d\n", + WINE_FIXME ("Cannot display message for error %d, status %d\n", error_code, GetLastError()); return; } @@ -1208,7 +1207,7 @@ void WCMD_output (const char *format, ...) { ret = vsnprintf (string, sizeof( string), format, ap); va_end(ap); if( ret >= sizeof( string)) { - WCMD_output_asis("ERR: output truncated in WCMD_output\n" ); + WINE_ERR("Output truncated in WCMD_output\n" ); string[sizeof( string) -1] = '\0'; } WCMD_output_asis(string); @@ -1603,3 +1602,19 @@ static char *WCMD_expand_envvar(char *start) { } return start+1; } + +/************************************************************************* + * WCMD_LoadMessage + * Load a string from the resource file, handling any error + * Returns string retrieved from resource file + */ +char *WCMD_LoadMessage(UINT id) { + static char msg[2048]; + const char failedMsg[] = "Failed!"; + + if (!LoadString(GetModuleHandle(NULL), id, msg, sizeof(msg))) { + WINE_FIXME("LoadString failed with %d\n", GetLastError()); + lstrcpy(msg, failedMsg); + } + return msg; +} -- 2.11.4.GIT