mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
svn path=/trunk/; revision=14457
This commit is contained in:
parent
93ccc29d64
commit
cc05ff6eb8
6 changed files with 154 additions and 51 deletions
63
reactos/subsys/system/cmd/En.rc
Normal file
63
reactos/subsys/system/cmd/En.rc
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
#include "resource.h"
|
||||||
|
/* Start move all hard code string to En.rc
|
||||||
|
* By Magnus Olsen 2005
|
||||||
|
*/
|
||||||
|
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
{
|
||||||
|
STRING_ATTRIB_HELP, "Displays or changes file attributes.\n\n \
|
||||||
|
ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] file ...\n \
|
||||||
|
[/S [/D]]\n\n \
|
||||||
|
+ Sets an attribute\n \
|
||||||
|
- Clears an attribute\n \
|
||||||
|
R Read-only file attribute\n \
|
||||||
|
A Archive file attribute\n \
|
||||||
|
S System file attribute\n \
|
||||||
|
H Hidden file attribute\n \
|
||||||
|
/S Processes matching files in the current directory\n \
|
||||||
|
and all subdirectories\n \
|
||||||
|
/D Processes direcories as well\n\n \
|
||||||
|
Type ATTRIB without a parameter to display the attributes of all files."
|
||||||
|
|
||||||
|
STRING_CD_HELP, "Changes the current directory or displays it's name\n\n \
|
||||||
|
CHDIR [drive:][path]\n \
|
||||||
|
CHDIR[..|-]\n \
|
||||||
|
CD [drive:][path]\n \
|
||||||
|
CD[..|-]\n\n \
|
||||||
|
.. parent directory\n \
|
||||||
|
- previous directory\n\n \
|
||||||
|
Type CD drive: to display the current directory on the specified drive.\n \
|
||||||
|
Type CD without a parameter to display the current drive and directory. "
|
||||||
|
|
||||||
|
STRING_CHOICE_HELP, "Waits for the user to choose one of a set of choices.\n\n \
|
||||||
|
CHOICE [/C[:]choices][/N][/S][/T[:]c,nn][text]\n\n \
|
||||||
|
/C[:]choices Specifies allowable keys. Default is YN.\n \
|
||||||
|
/N Do not display choices and ? at the end of the prompt string.\n \
|
||||||
|
/S Treat choice keys as case sensitive.\n \
|
||||||
|
/T[:]c,nn Default choice to c after nn seconds.\n \
|
||||||
|
text Prompt string to display.\n\n \
|
||||||
|
ERRORLEVEL is set to offset of key user presses in choices."
|
||||||
|
|
||||||
|
STRING_EXIT_HELP, "Exits the command line interpreter.\n\nEXIT"
|
||||||
|
|
||||||
|
STRING_MKDIR_HELP, "Creates a directory.\n\n \
|
||||||
|
MKDIR [drive:]path\nMD [drive:]path"
|
||||||
|
|
||||||
|
STRING_RMDIR_HELP, "Removes a directory.\n\n \
|
||||||
|
RMDIR [drive:]path\nRD [drive:]path"
|
||||||
|
|
||||||
|
STRING_REM_HELP, "Starts a comment line in a batch file.\n\nREM [Comment]"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
STRING_CHOICE_OPTION "YN"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
STRING_CHOICE_ERROR, "Invalid option. Expected format: /C[:]options"
|
||||||
|
STRING_CHOICE_ERROR_TXT, "Invalid option. Expected format: /T[:]c,nn"
|
||||||
|
STRING_CHOICE_ERROR_OPTION, "Illegal Option: %s"
|
||||||
|
STRING_PARAM_ERROR, "Required parameter missing\n"
|
||||||
|
|
||||||
|
}
|
|
@ -30,6 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
#ifdef INCLUDE_CMD_ATTRIB
|
#ifdef INCLUDE_CMD_ATTRIB
|
||||||
|
|
||||||
|
@ -116,6 +117,7 @@ ChangeAttribute (LPTSTR pszPath, LPTSTR pszFile, DWORD dwMask,
|
||||||
TCHAR szFullName[MAX_PATH];
|
TCHAR szFullName[MAX_PATH];
|
||||||
LPTSTR pszFileName;
|
LPTSTR pszFileName;
|
||||||
|
|
||||||
|
|
||||||
/* prepare full file name buffer */
|
/* prepare full file name buffer */
|
||||||
_tcscpy (szFullName, pszPath);
|
_tcscpy (szFullName, pszPath);
|
||||||
pszFileName = szFullName + _tcslen (szFullName);
|
pszFileName = szFullName + _tcslen (szFullName);
|
||||||
|
@ -192,6 +194,7 @@ INT CommandAttrib (LPTSTR cmd, LPTSTR param)
|
||||||
BOOL bDirectories = FALSE;
|
BOOL bDirectories = FALSE;
|
||||||
DWORD dwAttrib = 0;
|
DWORD dwAttrib = 0;
|
||||||
DWORD dwMask = 0;
|
DWORD dwMask = 0;
|
||||||
|
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||||
|
|
||||||
/* initialize strings */
|
/* initialize strings */
|
||||||
szPath[0] = _T('\0');
|
szPath[0] = _T('\0');
|
||||||
|
@ -200,19 +203,8 @@ INT CommandAttrib (LPTSTR cmd, LPTSTR param)
|
||||||
/* print help */
|
/* print help */
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
ConOutPuts (_T("Displays or changes file attributes.\n\n"
|
LoadString( GetModuleHandle(NULL), STRING_ATTRIB_HELP, (LPTSTR) szMsg,sizeof(szMsg));
|
||||||
"ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] file ...\n"
|
ConOutPuts (_T((LPTSTR)szMsg));
|
||||||
" [/S [/D]]\n\n"
|
|
||||||
" + Sets an attribute\n"
|
|
||||||
" - Clears an attribute\n"
|
|
||||||
" R Read-only file attribute\n"
|
|
||||||
" A Archive file attribute\n"
|
|
||||||
" S System file attribute\n"
|
|
||||||
" H Hidden file attribute\n"
|
|
||||||
" /S Processes matching files in the current directory\n"
|
|
||||||
" and all subdirectories\n"
|
|
||||||
" /D Processes direcories as well\n\n"
|
|
||||||
"Type ATTRIB without a parameter to display the attributes of all files."));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,14 @@
|
||||||
*
|
*
|
||||||
* 26 Sep 1999 (Paolo Pantaleo)
|
* 26 Sep 1999 (Paolo Pantaleo)
|
||||||
* Fixed timeout.
|
* Fixed timeout.
|
||||||
|
*
|
||||||
|
* 02 Apr 2005 (Magnus Olsen
|
||||||
|
* Remove Hardcode string so
|
||||||
|
* they can be translate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
#ifdef INCLUDE_CMD_CHOICE
|
#ifdef INCLUDE_CMD_CHOICE
|
||||||
|
|
||||||
|
@ -97,7 +102,8 @@ IsKeyInString (LPTSTR lpString, TCHAR cKey, BOOL bCaseSensitive)
|
||||||
INT
|
INT
|
||||||
CommandChoice (LPTSTR cmd, LPTSTR param)
|
CommandChoice (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
LPTSTR lpOptions = _T("YN");
|
LPTSTR lpOptions;
|
||||||
|
TCHAR Options[2];
|
||||||
LPTSTR lpText = NULL;
|
LPTSTR lpText = NULL;
|
||||||
BOOL bNoPrompt = FALSE;
|
BOOL bNoPrompt = FALSE;
|
||||||
BOOL bCaseSensitive = FALSE;
|
BOOL bCaseSensitive = FALSE;
|
||||||
|
@ -114,21 +120,17 @@ CommandChoice (LPTSTR cmd, LPTSTR param)
|
||||||
INT GCret;
|
INT GCret;
|
||||||
TCHAR Ch;
|
TCHAR Ch;
|
||||||
DWORD amount,clk;
|
DWORD amount,clk;
|
||||||
|
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||||
|
|
||||||
|
LoadString( GetModuleHandle(NULL), STRING_CHOICE_OPTION, (LPTSTR) Options,sizeof(lpOptions));
|
||||||
|
lpOptions = _T(Options);
|
||||||
|
|
||||||
if (_tcsncmp (param, _T("/?"), 2) == 0)
|
if (_tcsncmp (param, _T("/?"), 2) == 0)
|
||||||
{
|
{
|
||||||
ConOutPuts (_T("Waits for the user to choose one of a set of choices.\n"
|
LoadString( GetModuleHandle(NULL), STRING_CHOICE_HELP, (LPTSTR) szMsg,sizeof(szMsg));
|
||||||
"\n"
|
ConOutPuts (_T((LPTSTR)szMsg));
|
||||||
"CHOICE [/C[:]choices][/N][/S][/T[:]c,nn][text]\n"
|
|
||||||
"\n"
|
return 0;
|
||||||
" /C[:]choices Specifies allowable keys. Default is YN.\n"
|
|
||||||
" /N Do not display choices and ? at the end of the prompt string.\n"
|
|
||||||
" /S Treat choice keys as case sensitive.\n"
|
|
||||||
" /T[:]c,nn Default choice to c after nn seconds.\n"
|
|
||||||
" text Prompt string to display.\n"
|
|
||||||
"\n"
|
|
||||||
"ERRORLEVEL is set to offset of key user presses in choices."));
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* retrieve text */
|
/* retrieve text */
|
||||||
|
@ -167,7 +169,9 @@ CommandChoice (LPTSTR cmd, LPTSTR param)
|
||||||
|
|
||||||
if (_tcslen (lpOptions) == 0)
|
if (_tcslen (lpOptions) == 0)
|
||||||
{
|
{
|
||||||
ConErrPuts (_T("Invalid option. Expected format: /C[:]options"));
|
|
||||||
|
LoadString( GetModuleHandle(NULL), STRING_CHOICE_ERROR, (LPTSTR) szMsg,sizeof(szMsg));
|
||||||
|
ConErrPuts (_T((LPTSTR)szMsg));
|
||||||
freep (arg);
|
freep (arg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +201,8 @@ CommandChoice (LPTSTR cmd, LPTSTR param)
|
||||||
|
|
||||||
if (*s != _T(','))
|
if (*s != _T(','))
|
||||||
{
|
{
|
||||||
ConErrPuts (_T("Invalid option. Expected format: /T[:]c,nn"));
|
LoadString( GetModuleHandle(NULL), STRING_CHOICE_ERROR_TXT, (LPTSTR) szMsg,sizeof(szMsg));
|
||||||
|
ConErrPuts (_T((LPTSTR)szMsg));
|
||||||
freep (arg);
|
freep (arg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +213,8 @@ CommandChoice (LPTSTR cmd, LPTSTR param)
|
||||||
}
|
}
|
||||||
else if (arg[i][0] == _T('/'))
|
else if (arg[i][0] == _T('/'))
|
||||||
{
|
{
|
||||||
ConErrPrintf (_T("Illegal Option: %s"), arg[i]);
|
LoadString( GetModuleHandle(NULL), STRING_CHOICE_ERROR_OPTION, (LPTSTR) szMsg,sizeof(szMsg));
|
||||||
|
ConErrPrintf (_T((LPTSTR)szMsg), arg[i]);
|
||||||
freep (arg);
|
freep (arg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,13 @@
|
||||||
#define REACTOS_STR_ORIGINAL_COPYRIGHT "Copyright (C) 1994-1998 Tim Norman and others\0"
|
#define REACTOS_STR_ORIGINAL_COPYRIGHT "Copyright (C) 1994-1998 Tim Norman and others\0"
|
||||||
#define REACTOS_STR_LEGAL_COPYRIGHT "Copyright (C) 1998-2001 Eric Kohl and others\0"
|
#define REACTOS_STR_LEGAL_COPYRIGHT "Copyright (C) 1998-2001 Eric Kohl and others\0"
|
||||||
#include <reactos/version.rc>
|
#include <reactos/version.rc>
|
||||||
|
#include "En.rc"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
1 ICON DISCARDABLE res/terminal.ico
|
1 ICON DISCARDABLE res/terminal.ico
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -122,10 +122,14 @@
|
||||||
*
|
*
|
||||||
* 23-Feb-2001 (Carl Nettelblad <cnettel@hem.passagen.se>)
|
* 23-Feb-2001 (Carl Nettelblad <cnettel@hem.passagen.se>)
|
||||||
* Improved chdir/cd command.
|
* Improved chdir/cd command.
|
||||||
|
*
|
||||||
|
* 02-Apr-2004 (Magnus Olsen <magnus@greatlord.com>)
|
||||||
|
Remove all hard code string so they can be
|
||||||
|
translate to other langues.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
#ifdef INCLUDE_CMD_CHDIR
|
#ifdef INCLUDE_CMD_CHDIR
|
||||||
|
|
||||||
|
@ -154,21 +158,15 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
|
||||||
LPTSTR lpOldPath;
|
LPTSTR lpOldPath;
|
||||||
LPTSTR endofstring; /* pointer to the null character in the directory to change to */
|
LPTSTR endofstring; /* pointer to the null character in the directory to change to */
|
||||||
LPTSTR lastquote; /* pointer to the last quotation mark in the directory to change to */
|
LPTSTR lastquote; /* pointer to the last quotation mark in the directory to change to */
|
||||||
|
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||||
|
|
||||||
/*Should we better declare a variable containing _tsclen(dir) ? It's used a few times,
|
/*Should we better declare a variable containing _tsclen(dir) ? It's used a few times,
|
||||||
but on the other hand paths are generally not very long*/
|
but on the other hand paths are generally not very long*/
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
ConOutPuts (_T("Changes the current directory or displays it's name\n\n"
|
LoadString( GetModuleHandle(NULL), STRING_CD_HELP, (LPTSTR) szMsg,sizeof(szMsg));
|
||||||
"CHDIR [drive:][path]\n"
|
ConOutPuts (_T((LPTSTR)szMsg));
|
||||||
"CHDIR[..|-]\n"
|
|
||||||
"CD [drive:][path]\n"
|
|
||||||
"CD[..|-]\n\n"
|
|
||||||
" .. parent directory\n"
|
|
||||||
" - previous directory\n\n"
|
|
||||||
"Type CD drive: to display the current directory on the specified drive.\n"
|
|
||||||
"Type CD without a parameter to display the current drive and directory."));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,12 +279,13 @@ INT cmd_mkdir (LPTSTR cmd, LPTSTR param)
|
||||||
LPTSTR place; /* used to search for the \ when no space is used */
|
LPTSTR place; /* used to search for the \ when no space is used */
|
||||||
LPTSTR *p = NULL;
|
LPTSTR *p = NULL;
|
||||||
INT argc;
|
INT argc;
|
||||||
|
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
ConOutPuts (_T("Creates a directory.\n\n"
|
LoadString( GetModuleHandle(NULL), STRING_MKDIR_HELP, (LPTSTR) szMsg,sizeof(szMsg));
|
||||||
"MKDIR [drive:]path\nMD [drive:]path"));
|
ConOutPuts (_T((LPTSTR)szMsg));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +320,8 @@ INT cmd_mkdir (LPTSTR cmd, LPTSTR param)
|
||||||
|
|
||||||
if (!dir)
|
if (!dir)
|
||||||
{
|
{
|
||||||
ConErrPrintf (_T("Required parameter missing\n"));
|
LoadString( GetModuleHandle(NULL), STRING_PARAM_ERROR, (LPTSTR) szMsg,sizeof(szMsg));
|
||||||
|
ConErrPrintf (_T((LPTSTR)szMsg));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,10 +357,15 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
|
||||||
LPTSTR *p = NULL;
|
LPTSTR *p = NULL;
|
||||||
INT argc;
|
INT argc;
|
||||||
|
|
||||||
|
|
||||||
|
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
ConOutPuts (_T("Removes a directory.\n\n"
|
LoadString( GetModuleHandle(NULL), STRING_RMDIR_HELP, (LPTSTR) szMsg,sizeof(szMsg));
|
||||||
"RMDIR [drive:]path\nRD [drive:]path"));
|
|
||||||
|
ConOutPuts (_T((LPTSTR)szMsg));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +399,9 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
|
||||||
|
|
||||||
if (!dir)
|
if (!dir)
|
||||||
{
|
{
|
||||||
ConErrPrintf (_T("Required parameter missing\n"));
|
LoadString( GetModuleHandle(NULL), STRING_PARAM_ERROR, (LPTSTR) szMsg,sizeof(szMsg));
|
||||||
|
ConErrPrintf (_T((LPTSTR)szMsg));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,9 +430,12 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
|
||||||
*/
|
*/
|
||||||
INT CommandExit (LPTSTR cmd, LPTSTR param)
|
INT CommandExit (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
|
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
ConOutPuts (_T("Exits the command line interpreter.\n\nEXIT"));
|
LoadString( GetModuleHandle(NULL), STRING_EXIT_HELP, (LPTSTR) szMsg,sizeof(szMsg));
|
||||||
|
ConOutPuts (_T((LPTSTR)szMsg));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,10 +451,12 @@ INT CommandExit (LPTSTR cmd, LPTSTR param)
|
||||||
*/
|
*/
|
||||||
INT CommandRem (LPTSTR cmd, LPTSTR param)
|
INT CommandRem (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
|
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
ConOutPuts (_T("Starts a comment line in a batch file.\n\n"
|
LoadString( GetModuleHandle(NULL), STRING_REM_HELP, (LPTSTR) szMsg,sizeof(szMsg));
|
||||||
"REM [Comment]"));
|
ConOutPuts (_T((LPTSTR)szMsg));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
22
reactos/subsys/system/cmd/resource.h
Normal file
22
reactos/subsys/system/cmd/resource.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#define RC_STRING_MAX_SIZE 2048
|
||||||
|
|
||||||
|
#define STRING_CHOICE_OPTION 200
|
||||||
|
|
||||||
|
#define STRING_PARAM_ERROR 300
|
||||||
|
#define STRING_CHOICE_ERROR 301
|
||||||
|
#define STRING_CHOICE_ERROR_TXT 302
|
||||||
|
#define STRING_CHOICE_ERROR_OPTION 303
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define STRING_ATTRIB_HELP 400
|
||||||
|
#define STRING_CD_HELP 401
|
||||||
|
#define STRING_CHOICE_HELP 402
|
||||||
|
#define STRING_EXIT_HELP 403
|
||||||
|
#define STRING_MKDIR_HELP 404
|
||||||
|
#define STRING_RMDIR_HELP 405
|
||||||
|
#define STRING_REM_HELP 406
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue