From 98b6f6bd7b3f0f71108dd6ac4ecb93e53deb368a Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Thu, 7 Apr 2005 11:24:38 +0000 Subject: [PATCH] Remove more hardcode string to En.rc svn path=/trunk/; revision=14534 --- reactos/subsys/system/cmd/En.rc | 64 +++++++++++++++++++- reactos/subsys/system/cmd/delay.c | 14 ++--- reactos/subsys/system/cmd/dir.c | 87 ++++++++++++---------------- reactos/subsys/system/cmd/dirstack.c | 28 +++++---- reactos/subsys/system/cmd/resource.h | 24 ++++++-- 5 files changed, 141 insertions(+), 76 deletions(-) diff --git a/reactos/subsys/system/cmd/En.rc b/reactos/subsys/system/cmd/En.rc index 40ae28a5243..74b9aaae3cd 100644 --- a/reactos/subsys/system/cmd/En.rc +++ b/reactos/subsys/system/cmd/En.rc @@ -147,10 +147,69 @@ ERASE [/%c /%c /%c /%c /%c /%c /%c] file ...\n\n \ /%c Yes. Kill even *.* without asking.\n \ /%c Zap. Delete hidden, read-only and system files).\n" +STRING_DEL_HELP2, "All files in the directory will be deleted!\nAre you sure (Y/N)?" STRING_DEL_HELP3, " %lu file deleted\n" - STRING_DEL_HELP4, " %lu files deleted\n" +STRING_DELAY_HELP, "pause for n seconds or milliseconds\n \ +DELAY [/m]n\n\n \ + /m specifiy than n are milliseconds\n \ + otherwise n are seconds" + +STRING_DIR_HELP1, "DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]\n \ + [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]\n\n \ + [drive:][path][filename]\n \ + Specifies drive, directory, and/or files to list.\n\n \ + /A Displays files with specified attributes.\n \ + attributes D Directories R Read-only files\n \ + H Hidden files A Files ready for archiving\n \ + S System files - Prefix meaning not\n \ + /B Uses bare format (no heading information or summary).\n \ + /C Display the thousand separator in file sizes. This is the\n \ + default. Use /-C to disable display of separator.\n \ + /D Same as wide but files are list sorted by column.\n \ + /L Uses lowercase.\n \ + /N New long list format where filenames are on the far right.\n \ + /O List by files in sorted order.\n \ + sortorder N By name (alphabetic) S By size (smallest first)\n \ + E By extension (alphabetic) D By date/time (oldest first)\n \ + G Group directories first - Prefix to reverse order\n \ + /P Pauses after each screenful of information.\n \ + /Q Display the owner of the file.\n \ + /S Displays files in specified directory and all subdirectories.\n \ + /T Controls which time field displayed or used for sorting\n \ + timefield C Creation\n \ + A Last Access\n \ + W Last Written\n \ + /W Uses wide list format.\n \ + /X This displays the short names generated for non-8dot3 file\n \ + names. The format is that of /N with the short name inserted\n \ + before the long name. If no short name is present, blanks are\n \ + displayed in its place.\n \ + /4 Displays four-digit years\n\n \ +Switches may be preset in the DIRCMD environment variable. Override\n \ +preset switches by prefixing any switch with - (hyphen)--for example, /-W.\n " + +STRING_DIR_HELP2, " Volume in drive %c is %s" +STRING_DIR_HELP3, " Volume in drive %c has no label" +STRING_DIR_HELP4, " Volume Serial Number is %04X-%04X\n" +STRING_DIR_HELP5, "\n Total Files Listed:\n%16i File(s)% 14s bytes\n" +STRING_DIR_HELP6, "%16i Dir(s)% 15s bytes\n" +STRING_DIR_HELP7, "\n Directory of %s\n\n" +STRING_DIR_HELP8, "%16i Dir(s)% 14s bytes\n" + +STRING_DIRSTACK_HELP1, "Stores the current directory for use by the POPD command, then\n \ +changes to the specified directory.\n\n \ +PUSHD [path | ..]\n\n \ + path Specifies the directory to make the current directory" + +STRING_DIRSTACK_HELP2, "Changes to the directory stored by the PUSHD command.\n\nPOPD" + +STRING_DIRSTACK_HELP3, "Prints the contents of the directory stack.\n\nDIRS" + +STRING_DIRSTACK_HELP4, "Directory stack empty" + + STRING_EXIT_HELP, "Exits the command line interpreter.\n\nEXIT" STRING_MKDIR_HELP, "Creates a directory.\n\n \ @@ -161,7 +220,7 @@ RMDIR [drive:]path\nRD [drive:]path" STRING_REM_HELP, "Starts a comment line in a batch file.\n\nREM [Comment]" -STRING_DEL_HELP2, "All files in the directory will be deleted!\nAre you sure (Y/N)?" + @@ -170,6 +229,7 @@ STRING_DEL_HELP2, "All files in the directory will be deleted!\nAre you sure (Y/ + STRING_CHOICE_OPTION, "YN" STRING_COPY_OPTION, "YNA" STRING_DEL_OPTION, "AENPQSTWXYZ" diff --git a/reactos/subsys/system/cmd/delay.c b/reactos/subsys/system/cmd/delay.c index 241baa991e2..6848f29e136 100644 --- a/reactos/subsys/system/cmd/delay.c +++ b/reactos/subsys/system/cmd/delay.c @@ -10,6 +10,7 @@ */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_DELAY @@ -18,17 +19,14 @@ INT CommandDelay (LPTSTR cmd, LPTSTR param) { DWORD val; DWORD mul=1000; + WCHAR szMsg[RC_STRING_MAX_SIZE]; if (_tcsncmp (param, _T("/?"), 2) == 0) { - ConOutPuts(_T( - "pause for n seconds or milliseconds" - "\n" - "DELAY [/m]n\n" - "\n" - " /m specifiy than n are milliseconds\n" - " otherwise n are seconds")); - return 0; + LoadString( GetModuleHandle(NULL), STRING_DELAY_HELP, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); + + return 0; } if (*param==0) diff --git a/reactos/subsys/system/cmd/dir.c b/reactos/subsys/system/cmd/dir.c index e2bf115c16a..84fd5296ac3 100644 --- a/reactos/subsys/system/cmd/dir.c +++ b/reactos/subsys/system/cmd/dir.c @@ -129,6 +129,7 @@ */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_DIR @@ -209,44 +210,9 @@ static ULARGE_INTEGER recurse_bytes; static VOID DirHelp (VOID) { - ConOutPuts(_T( - "DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]\n" - " [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]\n" - "\n" - " [drive:][path][filename]\n" - " Specifies drive, directory, and/or files to list.\n" - "\n" - " /A Displays files with specified attributes.\n" - " attributes D Directories R Read-only files\n" - " H Hidden files A Files ready for archiving\n" - " S System files - Prefix meaning not\n" - " /B Uses bare format (no heading information or summary).\n" - " /C Display the thousand separator in file sizes. This is the\n" - " default. Use /-C to disable display of separator.\n" - " /D Same as wide but files are list sorted by column.\n" - " /L Uses lowercase.\n" - " /N New long list format where filenames are on the far right.\n" - " /O List by files in sorted order.\n" - " sortorder N By name (alphabetic) S By size (smallest first)\n" - " E By extension (alphabetic) D By date/time (oldest first)\n" - " G Group directories first - Prefix to reverse order\n" - " /P Pauses after each screenful of information.\n" - " /Q Display the owner of the file.\n" - " /S Displays files in specified directory and all subdirectories.\n" - " /T Controls which time field displayed or used for sorting\n" - " timefield C Creation\n" - " A Last Access\n" - " W Last Written\n" - " /W Uses wide list format.\n" - " /X This displays the short names generated for non-8dot3 file\n" - " names. The format is that of /N with the short name inserted\n" - " before the long name. If no short name is present, blanks are\n" - " displayed in its place.\n" - " /4 Displays four-digit years\n" - " \n" - "Switches may be preset in the DIRCMD environment variable. Override\n" - "preset switches by prefixing any switch with - (hyphen)--for example, /-W.\n" - )); + WCHAR szMsg[RC_STRING_MAX_SIZE]; + LoadString( GetModuleHandle(NULL), STRING_DIR_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); } @@ -807,6 +773,7 @@ PrintDirectoryHeader (LPTSTR szPath, LPINT pLine, LPDIRSWITCHFLAGS lpFlags) TCHAR szVolName[80]; DWORD dwSerialNr; LPTSTR p; + WCHAR szMsg[RC_STRING_MAX_SIZE]; if (lpFlags->bBareFormat) return(TRUE); @@ -858,17 +825,27 @@ PrintDirectoryHeader (LPTSTR szPath, LPINT pLine, LPDIRSWITCHFLAGS lpFlags) } /* print drive info */ - ConOutPrintf(_T(" Volume in drive %c"), szRootName[0]); - + if (szVolName[0] != _T('\0')) - ConOutPrintf(_T(" is %s\n"), szVolName); + { + LoadString( GetModuleHandle(NULL), STRING_DIR_HELP2, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPrintf (_T((LPTSTR)szMsg), szRootName[0], szVolName); + } else - ConOutPrintf(_T(" has no label\n")); + { + LoadString( GetModuleHandle(NULL), STRING_DIR_HELP3, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPrintf (_T((LPTSTR)szMsg), szRootName[0]); + } + + + /* print the volume serial number if the return was successful */ - ConOutPrintf(_T(" Volume Serial Number is %04X-%04X\n"), - HIWORD(dwSerialNr), - LOWORD(dwSerialNr)); + + LoadString( GetModuleHandle(NULL), STRING_DIR_HELP4, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPrintf (_T((LPTSTR)szMsg), + HIWORD(dwSerialNr), + LOWORD(dwSerialNr)); return(TRUE); } @@ -1079,6 +1056,7 @@ PrintSummary(LPTSTR szPath, TCHAR szBuffer[64]; ULARGE_INTEGER uliFree; TCHAR szRoot[] = _T("A:\\"); +WCHAR szMsg[RC_STRING_MAX_SIZE]; /* Here we check if we didn't find anything */ @@ -1095,15 +1073,17 @@ TCHAR szRoot[] = _T("A:\\"); if (lpFlags->bRecursive) { ConvertULargeInteger (u64Bytes, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator); - ConOutPrintf (_T("\n Total Files Listed:\n")); - ConOutPrintf(_T("%16i File(s)% 14s bytes\n"),ulFiles, szBuffer); + + LoadString( GetModuleHandle(NULL), STRING_DIR_HELP5, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPrintf (_T((LPTSTR)szMsg),ulFiles, szBuffer); } /* Print total directories and freespace */ szRoot[0] = szPath[0]; GetUserDiskFreeSpace(szRoot, &uliFree); ConvertULargeInteger (uliFree, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator); - ConOutPrintf (_T("%16i Dir(s)% 15s bytes\n"),ulDirs, szBuffer); + LoadString( GetModuleHandle(NULL), STRING_DIR_HELP6, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPrintf (_T((LPTSTR)szMsg),ulDirs, szBuffer); return 0; } @@ -1408,6 +1388,7 @@ DirPrintFiles(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */ LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */ { TCHAR szTemp[MAX_PATH]; /* A buffer to format the directory header */ +WCHAR szMsg[RC_STRING_MAX_SIZE]; /* Print directory header */ _tcscpy(szTemp, szCurPath); @@ -1417,7 +1398,10 @@ TCHAR szTemp[MAX_PATH]; /* A buffer to format the directory header */ We are not printing in bare format and if we are in recursive mode... we must have results */ if (!(lpFlags->bBareFormat ) && !((lpFlags->bRecursive) && (dwCount <= 0))) - ConOutPrintf("\n Directory of %s\n\n", szTemp); + { + LoadString( GetModuleHandle(NULL), STRING_DIR_HELP7, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPrintf (_T( (LPTSTR)szMsg), szTemp); + } /* Bare format */ if (lpFlags->bBareFormat) @@ -1626,6 +1610,7 @@ DWORD dwCountFiles; /* Counter for files */ DWORD dwCountDirs; /* Counter for directories */ ULARGE_INTEGER u64CountBytes; /* Counter for bytes */ ULARGE_INTEGER u64Temp; /* A temporary counter */ +WCHAR szMsg[RC_STRING_MAX_SIZE]; /* Initialize Variables */ ptrStartNode = NULL; @@ -1743,8 +1728,8 @@ ULARGE_INTEGER u64Temp; /* A temporary counter */ if (!(lpFlags->bBareFormat) && (dwCount > 0)) { ConvertULargeInteger(u64CountBytes, szBytes, 20, lpFlags->bTSeperator); - ConOutPrintf(_T("%16i File(s) %14s bytes\n"), - dwCountFiles, szBytes); + LoadString( GetModuleHandle(NULL), STRING_DIR_HELP8, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPrintf (_T((LPTSTR)szMsg),dwCountFiles, szBytes); } /* Add statistics to recursive statistics*/ diff --git a/reactos/subsys/system/cmd/dirstack.c b/reactos/subsys/system/cmd/dirstack.c index 8d5b7a885fd..abe60d24694 100644 --- a/reactos/subsys/system/cmd/dirstack.c +++ b/reactos/subsys/system/cmd/dirstack.c @@ -15,6 +15,7 @@ */ #include "precomp.h" +#include "resource.h" #ifdef FEATURE_DIRECTORY_STACK @@ -139,13 +140,13 @@ INT CommandPushd (LPTSTR first, LPTSTR rest) TCHAR curPath[MAX_PATH]; TCHAR newPath[MAX_PATH]; BOOL bChangePath = FALSE; + WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp (rest, _T("/?"), 2)) { - ConOutPuts (_T("Stores the current directory for use by the POPD command, then\n" - "changes to the specified directory.\n\n" - "PUSHD [path | ..]\n\n" - " path Specifies the directory to make the current directory")); + LoadString( GetModuleHandle(NULL), STRING_DIRSTACK_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); + return 0; } @@ -172,11 +173,13 @@ INT CommandPushd (LPTSTR first, LPTSTR rest) INT CommandPopd (LPTSTR first, LPTSTR rest) { TCHAR szPath[MAX_PATH]; + WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp(rest, _T("/?"), 2)) - { - ConOutPuts (_T("Changes to the directory stored by the PUSHD command.\n\n" - "POPD")); + { + LoadString( GetModuleHandle(NULL), STRING_DIRSTACK_HELP2, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); + return 0; } @@ -198,12 +201,13 @@ INT CommandPopd (LPTSTR first, LPTSTR rest) INT CommandDirs (LPTSTR first, LPTSTR rest) { LPDIRENTRY lpDir; + WCHAR szMsg[RC_STRING_MAX_SIZE]; if (!_tcsncmp(rest, _T("/?"), 2)) { - ConOutPuts (_T("Prints the contents of the directory stack.\n" - "\n" - "DIRS")); + LoadString( GetModuleHandle(NULL), STRING_DIRSTACK_HELP3, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); + return 0; } @@ -212,7 +216,9 @@ INT CommandDirs (LPTSTR first, LPTSTR rest) if (lpDir == NULL) { - ConOutPuts (_T("Directory stack empty")); + LoadString( GetModuleHandle(NULL), STRING_DIRSTACK_HELP4, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts (_T((LPTSTR)szMsg)); + return 0; } diff --git a/reactos/subsys/system/cmd/resource.h b/reactos/subsys/system/cmd/resource.h index 7977bba84b9..5a8814c55f2 100644 --- a/reactos/subsys/system/cmd/resource.h +++ b/reactos/subsys/system/cmd/resource.h @@ -65,10 +65,26 @@ #define STRING_DEL_HELP2 424 #define STRING_DEL_HELP3 425 #define STRING_DEL_HELP4 426 -#define STRING_EXIT_HELP 427 -#define STRING_MKDIR_HELP 428 -#define STRING_RMDIR_HELP 429 -#define STRING_REM_HELP 430 +#define STRING_DELAY_HELP 427 + +#define STRING_DIR_HELP1 428 +#define STRING_DIR_HELP2 429 +#define STRING_DIR_HELP3 430 +#define STRING_DIR_HELP4 431 +#define STRING_DIR_HELP5 432 +#define STRING_DIR_HELP6 433 +#define STRING_DIR_HELP7 434 +#define STRING_DIR_HELP8 435 + +#define STRING_DIRSTACK_HELP1 436 +#define STRING_DIRSTACK_HELP2 437 +#define STRING_DIRSTACK_HELP3 438 +#define STRING_DIRSTACK_HELP4 439 + +#define STRING_EXIT_HELP 440 +#define STRING_MKDIR_HELP 441 +#define STRING_RMDIR_HELP 442 +#define STRING_REM_HELP 443