- Use fixed message buffer size.
authorEric Kohl <eric.kohl@reactos.org>
Sun, 1 May 2005 13:58:30 +0000 (13:58 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 1 May 2005 13:58:30 +0000 (13:58 +0000)
- Don't translate command options.
- Only use _one_ message buffer per function.
- Fix indentation mess.

svn path=/trunk/; revision=14912

54 files changed:
reactos/subsys/system/cmd/En.rc
reactos/subsys/system/cmd/alias.c
reactos/subsys/system/cmd/attrib.c
reactos/subsys/system/cmd/batch.c
reactos/subsys/system/cmd/beep.c
reactos/subsys/system/cmd/call.c
reactos/subsys/system/cmd/chcp.c
reactos/subsys/system/cmd/choice.c
reactos/subsys/system/cmd/cls.c
reactos/subsys/system/cmd/cmd.c
reactos/subsys/system/cmd/cmd.h
reactos/subsys/system/cmd/cmd.rc
reactos/subsys/system/cmd/cmdinput.c
reactos/subsys/system/cmd/color.c
reactos/subsys/system/cmd/console.c
reactos/subsys/system/cmd/copy.c
reactos/subsys/system/cmd/date.c
reactos/subsys/system/cmd/del.c
reactos/subsys/system/cmd/delay.c
reactos/subsys/system/cmd/dir.c
reactos/subsys/system/cmd/dirstack.c
reactos/subsys/system/cmd/echo.c
reactos/subsys/system/cmd/error.c
reactos/subsys/system/cmd/for.c
reactos/subsys/system/cmd/free.c
reactos/subsys/system/cmd/goto.c
reactos/subsys/system/cmd/history.c
reactos/subsys/system/cmd/if.c
reactos/subsys/system/cmd/internal.c
reactos/subsys/system/cmd/label.c
reactos/subsys/system/cmd/locale.c
reactos/subsys/system/cmd/memory.c
reactos/subsys/system/cmd/misc.c
reactos/subsys/system/cmd/move.c
reactos/subsys/system/cmd/msgbox.c
reactos/subsys/system/cmd/path.c
reactos/subsys/system/cmd/pause.c
reactos/subsys/system/cmd/prompt.c
reactos/subsys/system/cmd/ren.c
reactos/subsys/system/cmd/resource.h
reactos/subsys/system/cmd/screen.c
reactos/subsys/system/cmd/set.c
reactos/subsys/system/cmd/shift.c
reactos/subsys/system/cmd/start.c
reactos/subsys/system/cmd/strtoclr.c
reactos/subsys/system/cmd/time.c
reactos/subsys/system/cmd/timer.c
reactos/subsys/system/cmd/title.c
reactos/subsys/system/cmd/type.c
reactos/subsys/system/cmd/ver.c
reactos/subsys/system/cmd/verify.c
reactos/subsys/system/cmd/vol.c
reactos/subsys/system/cmd/where.c
reactos/subsys/system/cmd/window.c

index 0d03ad2..431600a 100644 (file)
@@ -1,5 +1,6 @@
 #include "resource.h"\r
-/* Start move all hard code string to En.rc \r
+/*\r
+ * Moved all hardcoded strings to En.rc.\r
  * By Magnus Olsen  2005\r
  */\r
 \r
@@ -7,60 +8,60 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
 STRINGTABLE DISCARDABLE\r
 {\r
 \r
-STRING_ATTRIB_HELP,    "Displays or changes file attributes.\n\n \\r
-ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] file ...\n \\r
-       [/S [/D]]\n\n \\r
-  +   Sets an attribute\n \\r
-  -   Clears an attribute\n \\r
-  R   Read-only file attribute\n \\r
-  A   Archive file attribute\n \\r
-  S   System file attribute\n \\r
-  H   Hidden file attribute\n \\r
-  /S  Processes matching files in the current directory\n \\r
-      and all subdirectories\n \\r
-  /D  Processes direcories as well\n\n \\r
+STRING_ATTRIB_HELP,    "Displays or changes file attributes.\n\n\\r
+ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] file ...\n\\r
+       [/S [/D]]\n\n\\r
+  +   Sets an attribute\n\\r
+  -   Clears an attribute\n\\r
+  R   Read-only file attribute\n\\r
+  A   Archive file attribute\n\\r
+  S   System file attribute\n\\r
+  H   Hidden file attribute\n\\r
+  /S  Processes matching files in the current directory\n\\r
+      and all subdirectories\n\\r
+  /D  Processes direcories as well\n\n\\r
 Type ATTRIB without a parameter to display the attributes of all files."\r
 \r
-STRING_ALIAS_HELP,  "Sets, removes or shows aliases.\n\n \\r
-ALIAS [alias=[command]]\n\n \\r
-  alias    Name for an alias.\n \\r
-  command  Text to be substituted for an alias.\n\n \\r
-To list all aliases:\n \\r
-  ALIAS\n\n \\r
-To set a new or replace an existing alias:\n \\r
-  ALIAS da=dir a:\n\n \\r
-To remove an alias from the alias list:\n \\r
+STRING_ALIAS_HELP,  "Sets, removes or shows aliases.\n\n\\r
+ALIAS [alias=[command]]\n\n\\r
+  alias    Name for an alias.\n\\r
+  command  Text to be substituted for an alias.\n\n\\r
+To list all aliases:\n\\r
+  ALIAS\n\n\\r
+To set a new or replace an existing alias:\n\\r
+  ALIAS da=dir a:\n\n\\r
+To remove an alias from the alias list:\n\\r
   ALIAS da="\r
 \r
 STRING_BEEP_HELP, "Beep the speaker.\n\nBEEP"\r
 \r
-STRING_CALL_HELP, "Calls one batch program from another.\n\n \\r
-CALL [drive:][path]filename [batch-parameter]\n\n \\r
-  batch-parameter  Specifies any command-line information required by the\n \\r
+STRING_CALL_HELP, "Calls one batch program from another.\n\n\\r
+CALL [drive:][path]filename [batch-parameter]\n\n\\r
+  batch-parameter  Specifies any command-line information required by the\n\\r
                    batch program."\r
 \r
-STRING_CD_HELP,      "Changes the current directory or displays it's name\n\n \\r
-CHDIR [drive:][path]\n \\r
-CHDIR[..|-]\n \\r
-CD [drive:][path]\n \\r
-CD[..|-]\n\n \\r
-  ..   parent directory\n \\r
-  -    previous directory\n\n \\r
-Type CD drive: to display the current directory on the specified drive.\n \\r
-Type CD without a parameter to display the current drive and directory. "\r
-\r
-STRING_CHCP_HELP,   "Displays or sets the active code page number.\n\n \\r
-CHCP [nnn]\n\n \\r
-  nnn   Specifies the active code page number.\n\n \\r
+STRING_CD_HELP,      "Changes the current directory or displays it's name\n\n\\r
+CHDIR [drive:][path]\n\\r
+CHDIR[..|-]\n\\r
+CD [drive:][path]\n\\r
+CD[..|-]\n\n\\r
+  ..   parent directory\n\\r
+  -    previous directory\n\n\\r
+Type CD drive: to display the current directory on the specified drive.\n\\r
+Type CD without a parameter to display the current drive and directory."\r
+\r
+STRING_CHCP_HELP,   "Displays or sets the active code page number.\n\n\\r
+CHCP [nnn]\n\n\\r
+  nnn   Specifies the active code page number.\n\n\\r
 Type CHCP without a parameter to display the active code page number."\r
 \r
-STRING_CHOICE_HELP, "Waits for the user to choose one of a set of choices.\n\n \\r
-CHOICE  [/C[:]choices][/N][/S][/T[:]c,nn][text]\n\n \\r
-  /C[:]choices  Specifies allowable keys. Default is YN.\n \\r
-  /N            Do not display choices and ? at the end of the prompt string.\n \\r
-  /S            Treat choice keys as case sensitive.\n \\r
-  /T[:]c,nn     Default choice to c after nn seconds.\n \\r
-  text          Prompt string to display.\n\n \\r
+STRING_CHOICE_HELP, "Waits for the user to choose one of a set of choices.\n\n\\r
+CHOICE  [/C[:]choices][/N][/S][/T[:]c,nn][text]\n\n\\r
+  /C[:]choices  Specifies allowable keys. Default is YN.\n\\r
+  /N            Do not display choices and ? at the end of the prompt string.\n\\r
+  /S            Treat choice keys as case sensitive.\n\\r
+  /T[:]c,nn     Default choice to c after nn seconds.\n\\r
+  text          Prompt string to display.\n\n\\r
 ERRORLEVEL is set to offset of key user presses in choices."\r
 \r
 STRING_CLS_HELP, "Clears the screen.\n\nCLS"\r
@@ -79,48 +80,48 @@ STRING_CMD_HELP6,"  [directory stack]"
 \r
 STRING_CMD_HELP7,"  [redirections and piping]"\r
 \r
-STRING_CMD_HELP8, "Starts a new instance of the ReactOS command line interpreter.\n\n \\r
-CMD [/[C|K] command][/P][/Q][/T:bf]\n\n \\r
-  /C command  Runs the specified command and terminates.\n \\r
-  /K command  Runs the specified command and remains.\n \\r
-  /P          CMD becomes permanent and runs autoexec.bat\n \\r
-              (cannot be terminated).\n \\r
+STRING_CMD_HELP8, "Starts a new instance of the ReactOS command line interpreter.\n\n\\r
+CMD [/[C|K] command][/P][/Q][/T:bf]\n\n\\r
+  /C command  Runs the specified command and terminates.\n\\r
+  /K command  Runs the specified command and remains.\n\\r
+  /P          CMD becomes permanent and runs autoexec.bat\n\\r
+              (cannot be terminated).\n\\r
   /T:bf       Sets the background/foreground color (see COLOR command)."\r
 \r
-STRING_COLOR_HELP1, "Sets the default foreground and background colors.\n\n \\r
-COLOR [attr [/F]] \n\n \\r
-  attr        Specifies color attribute of console output\n \\r
-  /F          fill the console with color attribute\n\n \\r
-There are three ways to specify the colors:\n \\r
-1) [bright] name on [bright] name  (only the first three letters are required)\n \\r
-2) decimal on decimal\n \\r
-3) two hex digits\n\n \\r
-Colors are:\n \\r
-dec  hex  name       dec  hex  name\n \\r
-0    0    Black       8   8    Gray(Bright black)\n \\r
-1    1    Blue        9   9    Bright Blue\n \\r
-2    2    Green      10   A    Bright Green\n \\r
-3    3    Cyan       11   B    Bright Cyan\n \\r
-4    4    Red        12   C    Bright Red\n \\r
-5    5    Magenta    13   D    Bright Magenta\n \\r
-6    6    Yellow     14   E    Bright Yellow\n \\r
+STRING_COLOR_HELP1, "Sets the default foreground and background colors.\n\n\\r
+COLOR [attr [/F]] \n\n\\r
+  attr        Specifies color attribute of console output\n\\r
+  /F          fill the console with color attribute\n\n\\r
+There are three ways to specify the colors:\n\\r
+1) [bright] name on [bright] name  (only the first three letters are required)\n\\r
+2) decimal on decimal\n\\r
+3) two hex digits\n\n\\r
+Colors are:\n\\r
+dec  hex  name       dec  hex  name\n\\r
+0    0    Black       8   8    Gray(Bright black)\n\\r
+1    1    Blue        9   9    Bright Blue\n\\r
+2    2    Green      10   A    Bright Green\n\\r
+3    3    Cyan       11   B    Bright Cyan\n\\r
+4    4    Red        12   C    Bright Red\n\\r
+5    5    Magenta    13   D    Bright Magenta\n\\r
+6    6    Yellow     14   E    Bright Yellow\n\\r
 7    7    White      15   F    Bright White"\r
 \r
 STRING_COPY_HELP1,  "Overwrite %s (Yes/No/All)? "\r
 \r
-STRING_COPY_HELP2, "Copies one or more files to another location.\n\n \\r
-COPY [/V][/Y|/-Y][/A|/B] source [/A|/B]\n \\r
-     [+ source [/A|/B] [+ ...]] [destination [/A|/B]]\n\n \\r
-  source       Specifies the file or files to be copied.\n \\r
-  /A           Indicates an ASCII text file.\n \\r
-  /B           Indicates a binary file.\n \\r
-  destination  Specifies the directory and/or filename for the new file(s).\n \\r
-  /V           Verifies that new files are written correctly.\n \\r
-  /Y           Suppresses prompting to confirm you want to overwrite an\n \\r
-               existing destination file.\n \\r
-  /-Y          Causes prompting to confirm you want to overwrite an\n \\r
-               existing destination file.\n\n \\r
-The switch /Y may be present in the COPYCMD environment variable.\n \\r
+STRING_COPY_HELP2, "Copies one or more files to another location.\n\n\\r
+COPY [/V][/Y|/-Y][/A|/B] source [/A|/B]\n\\r
+     [+ source [/A|/B] [+ ...]] [destination [/A|/B]]\n\n\\r
+  source       Specifies the file or files to be copied.\n\\r
+  /A           Indicates an ASCII text file.\n\\r
+  /B           Indicates a binary file.\n\\r
+  destination  Specifies the directory and/or filename for the new file(s).\n\\r
+  /V           Verifies that new files are written correctly.\n\\r
+  /Y           Suppresses prompting to confirm you want to overwrite an\n\\r
+               existing destination file.\n\\r
+  /-Y          Causes prompting to confirm you want to overwrite an\n\\r
+               existing destination file.\n\n\\r
+The switch /Y may be present in the COPYCMD environment variable.\n\\r
 ..."\r
 \r
 STRING_DATE_HELP1, "\nEnter new date (mm%cdd%cyyyy): "\r
@@ -129,67 +130,67 @@ STRING_DATE_HELP2, "\nEnter new date (dd%cmm%cyyyy): "
 \r
 STRING_DATE_HELP3, "\nEnter new date (yyyy%cmm%cdd): "\r
 \r
-STRING_DATE_HELP4, "Displays or sets the date.\n\n \\r
-DATE [/T][date]\n\n \\r
-  /T    display only\n\n \\r
-Type DATE without parameters to display the current date setting and\n \\r
+STRING_DATE_HELP4, "Displays or sets the date.\n\n\\r
+DATE [/T][date]\n\n\\r
+  /T    display only\n\n\\r
+Type DATE without parameters to display the current date setting and\n\\r
 a prompt for a new one.  Press ENTER to keep the same date."\r
                                \r
-STRING_DEL_HELP1,  "Deletes one or more files.\n\n \\r
-DEL [/%c /%c /%c /%c /%c /%c /%c] file ...\n \\r
-DELETE [/%c /%c /%c /%c /%c /%c /%c] file ...\n \\r
-ERASE [/%c /%c /%c /%c /%c /%c /%c] file ...\n\n \\r
-  file  Specifies the file(s) to delete.\n\n \\r
-  /%c    Nothing.\n \\r
-  /%c    Prompt. Ask before deleting each file.\n \\r
-  /%c    Total. Display total number of deleted files and freed disk space.\n \\r
-  /%c    Quiet.\n \\r
-  /%c    Wipe. Overwrite the file with random numbers before deleting it.\n \\r
-  /%c    Yes. Kill even *.* without asking.\n \\r
-  /%c    Zap. Delete hidden, read-only and system files).\n"\r
+STRING_DEL_HELP1,  "Deletes one or more files.\n\n\\r
+DEL [/N /P /T /Q /W /Y /Z] file ...\n\\r
+DELETE [/N /P /T /Q /W /Y /Z] file ...\n\\r
+ERASE [/N /P /T /Q /W /Y /Z] file ...\n\n\\r
+  file  Specifies the file(s) to delete.\n\n\\r
+  /N    Nothing.\n\\r
+  /P    Prompt. Ask before deleting each file.\n\\r
+  /T    Total. Display total number of deleted files and freed disk space.\n\\r
+  /Q    Quiet.\n\\r
+  /W    Wipe. Overwrite the file with random numbers before deleting it.\n\\r
+  /Y    Yes. Kill even *.* without asking.\n\\r
+  /Z    Zap. Delete hidden, read-only and system files.\n"\r
 \r
 STRING_DEL_HELP2, "All files in the directory will be deleted!\nAre you sure (Y/N)?"\r
 STRING_DEL_HELP3, "    %lu file deleted\n"\r
 STRING_DEL_HELP4, "    %lu files deleted\n"\r
 \r
-STRING_DELAY_HELP, "pause for n seconds or milliseconds\n \\r
-DELAY [/m]n\n\n \\r
-  /m          specifiy than n are milliseconds\n \\r
+STRING_DELAY_HELP, "pause for n seconds or milliseconds\n\\r
+DELAY [/m]n\n\n\\r
+  /m          specifiy than n are milliseconds\n\\r
               otherwise n are seconds"\r
 \r
-STRING_DIR_HELP1, "DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]\n \\r
-  [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]\n\n \\r
-  [drive:][path][filename]\n \\r
-              Specifies drive, directory, and/or files to list.\n\n \\r
-  /A          Displays files with specified attributes.\n \\r
-  attributes   D  Directories                R  Read-only files\n \\r
-               H  Hidden files               A  Files ready for archiving\n \\r
-               S  System files               -  Prefix meaning not\n \\r
-  /B          Uses bare format (no heading information or summary).\n \\r
-  /C          Display the thousand separator in file sizes.  This is the\n \\r
-              default.  Use /-C to disable display of separator.\n \\r
-  /D          Same as wide but files are list sorted by column.\n \\r
-  /L          Uses lowercase.\n \\r
-  /N          New long list format where filenames are on the far right.\n \\r
-  /O          List by files in sorted order.\n \\r
-  sortorder    N  By name (alphabetic)       S  By size (smallest first)\n \\r
-               E  By extension (alphabetic)  D  By date/time (oldest first)\n \\r
-               G  Group directories first    -  Prefix to reverse order\n \\r
-  /P          Pauses after each screenful of information.\n \\r
-  /Q          Display the owner of the file.\n \\r
-  /S          Displays files in specified directory and all subdirectories.\n \\r
-  /T          Controls which time field displayed or used for sorting\n \\r
-  timefield   C  Creation\n \\r
-              A  Last Access\n \\r
-              W  Last Written\n \\r
-  /W          Uses wide list format.\n \\r
-  /X          This displays the short names generated for non-8dot3 file\n \\r
-              names.  The format is that of /N with the short name inserted\n \\r
-              before the long name. If no short name is present, blanks are\n \\r
-              displayed in its place.\n \\r
-  /4          Displays four-digit years\n\n \\r
-Switches may be preset in the DIRCMD environment variable.  Override\n \\r
-preset switches by prefixing any switch with - (hyphen)--for example, /-W.\n "\r
+STRING_DIR_HELP1, "DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]\n\\r
+  [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]\n\n\\r
+  [drive:][path][filename]\n\\r
+              Specifies drive, directory, and/or files to list.\n\n\\r
+  /A          Displays files with specified attributes.\n\\r
+  attributes   D  Directories                R  Read-only files\n\\r
+               H  Hidden files               A  Files ready for archiving\n\\r
+               S  System files               -  Prefix meaning not\n\\r
+  /B          Uses bare format (no heading information or summary).\n\\r
+  /C          Display the thousand separator in file sizes.  This is the\n\\r
+              default.  Use /-C to disable display of separator.\n\\r
+  /D          Same as wide but files are list sorted by column.\n\\r
+  /L          Uses lowercase.\n\\r
+  /N          New long list format where filenames are on the far right.\n\\r
+  /O          List by files in sorted order.\n\\r
+  sortorder    N  By name (alphabetic)       S  By size (smallest first)\n\\r
+               E  By extension (alphabetic)  D  By date/time (oldest first)\n\\r
+               G  Group directories first    -  Prefix to reverse order\n\\r
+  /P          Pauses after each screenful of information.\n\\r
+  /Q          Display the owner of the file.\n\\r
+  /S          Displays files in specified directory and all subdirectories.\n\\r
+  /T          Controls which time field displayed or used for sorting\n\\r
+  timefield   C  Creation\n\\r
+              A  Last Access\n\\r
+              W  Last Written\n\\r
+  /W          Uses wide list format.\n\\r
+  /X          This displays the short names generated for non-8dot3 file\n\\r
+              names.  The format is that of /N with the short name inserted\n\\r
+              before the long name. If no short name is present, blanks are\n\\r
+              displayed in its place.\n\\r
+  /4          Displays four-digit years\n\n\\r
+Switches may be preset in the DIRCMD environment variable.  Override\n\\r
+preset switches by prefixing any switch with - (hyphen)--for example, /-W.\n"\r
 \r
 STRING_DIR_HELP2, " Volume in drive %c is %s"\r
 STRING_DIR_HELP3, " Volume in drive %c has no label"\r
@@ -199,9 +200,9 @@ STRING_DIR_HELP6, "%16i Dir(s)% 15s bytes\n"
 STRING_DIR_HELP7, "\n Directory of %s\n\n"\r
 STRING_DIR_HELP8, "%16i Dir(s)% 14s bytes\n"\r
 \r
-STRING_DIRSTACK_HELP1, "Stores the current directory for use by the POPD command, then\n \\r
-changes to the specified directory.\n\n \\r
-PUSHD [path | ..]\n\n \\r
+STRING_DIRSTACK_HELP1, "Stores the current directory for use by the POPD command, then\n\\r
+changes to the specified directory.\n\n\\r
+PUSHD [path | ..]\n\n\\r
   path        Specifies the directory to make the current directory"\r
 \r
 STRING_DIRSTACK_HELP2, "Changes to the directory stored by the PUSHD command.\n\nPOPD"\r
@@ -210,61 +211,61 @@ STRING_DIRSTACK_HELP3, "Prints the contents of the directory stack.\n\nDIRS"
 \r
 STRING_DIRSTACK_HELP4, "Directory stack empty"\r
 \r
-STRING_ECHO_HELP1,  "Display a messages without trailing carridge return and line feed.\n\n \\r
+STRING_ECHO_HELP1,  "Display a messages without trailing carridge return and line feed.\n\n\\r
   ECHOS message"\r
 \r
-STRING_ECHO_HELP2,  "Displays a message to the standard error.\n\n \\r
-  ECHOERR message\n \\r
+STRING_ECHO_HELP2,  "Displays a message to the standard error.\n\n\\r
+  ECHOERR message\n\\r
   ECHOERR.           prints an empty line"\r
 \r
-STRING_ECHO_HELP3, "Prints a messages to standard error output without trailing carridge return and line feed.\n\n \\r
+STRING_ECHO_HELP3, "Prints a messages to standard error output without trailing carridge return and line feed.\n\n\\r
   ECHOSERR message"\r
 \r
-STRING_ECHO_HELP4, "Displays a message or switches command echoing on or off.\n\n \\r
-  ECHO [ON | OFF]\n \\r
-  ECHO [message]\n \\r
-  ECHO.             prints an empty line\n\n \\r
+STRING_ECHO_HELP4, "Displays a message or switches command echoing on or off.\n\n\\r
+  ECHO [ON | OFF]\n\\r
+  ECHO [message]\n\\r
+  ECHO.             prints an empty line\n\n\\r
 Type ECHO without a parameter to display the current ECHO setting."\r
 \r
 STRING_ECHO_HELP5, "ECHO is %s\n"\r
 \r
 STRING_EXIT_HELP, "Exits the command line interpreter.\n\nEXIT"\r
 \r
-STRING_FOR_HELP1, "Runs a specified command for each file in a set of files\n\n \\r
-FOR %variable IN (set) DO command [parameters]\n\n \\r
-  %variable  Specifies a replaceable parameter.\n \\r
-  (set)      Specifies a set of one or more files. Wildcards may be used.\n \\r
-  command    Specifies the command to carry out for each file.\n \\r
-  parameters Specifies parameters or switches for the specified command.\n\n \\r
-To user the FOR comamnd in a batch program, specify %%variable instead of\n \\r
+STRING_FOR_HELP1, "Runs a specified command for each file in a set of files\n\n\\r
+FOR %variable IN (set) DO command [parameters]\n\n\\r
+  %variable  Specifies a replaceable parameter.\n\\r
+  (set)      Specifies a set of one or more files. Wildcards may be used.\n\\r
+  command    Specifies the command to carry out for each file.\n\\r
+  parameters Specifies parameters or switches for the specified command.\n\n\\r
+To user the FOR comamnd in a batch program, specify %%variable instead of\n\\r
 %variable."\r
 \r
-STRING_FREE_HELP1, "\n Volume in drive %s is %-11s   Serial number is %s\n \\r
-  %16s bytes total disk space\n \\r
-  %16s bytes used\n \\r
+STRING_FREE_HELP1, "\n Volume in drive %s is %-11s   Serial number is %s\n\\r
+  %16s bytes total disk space\n\\r
+  %16s bytes used\n\\r
   %16s bytes free\n"\r
 \r
 STRING_FREE_HELP2, "Displays drive information.\n\nFREE [drive: ...]"\r
 \r
-STRING_IF_HELP1, "Performs conditional processing in batch programs.\n\n \\r
-  IF [NOT] ERRORLEVEL number command\n \\r
-  IF [NOT] string1==string2 command\n \\r
-  IF [NOT] EXIST filename command\n \\r
-  IF [NOT] DEFINED variable command\n\n \\r
-NOT               Specifies that CMD should carry out the command only if\n \\r
-                  the condition is false\n \\r
-ERRORLEVEL number Specifies a true condition if the last program run returned\n \\r
-                  an exit code equal or greater than the number specified.\n \\r
-command           Specifies the command to carry out if the condition is met.\n \\r
-string1==string2  Specifies a true condition if the specified text strings\n \\r
-                  match.\n \\r
-EXIST filename    Specifies a true condition if the specified filename exists.\n \\r
-DEFINED variable  Specifies a true condition if the specified variable is\n \\r
+STRING_IF_HELP1, "Performs conditional processing in batch programs.\n\n\\r
+  IF [NOT] ERRORLEVEL number command\n\\r
+  IF [NOT] string1==string2 command\n\\r
+  IF [NOT] EXIST filename command\n\\r
+  IF [NOT] DEFINED variable command\n\n\\r
+NOT               Specifies that CMD should carry out the command only if\n\\r
+                  the condition is false\n\\r
+ERRORLEVEL number Specifies a true condition if the last program run returned\n\\r
+                  an exit code equal or greater than the number specified.\n\\r
+command           Specifies the command to carry out if the condition is met.\n\\r
+string1==string2  Specifies a true condition if the specified text strings\n\\r
+                  match.\n\\r
+EXIST filename    Specifies a true condition if the specified filename exists.\n\\r
+DEFINED variable  Specifies a true condition if the specified variable is\n\\r
                   defined."\r
-                     \r
-STRING_GOTO_HELP1,  "Directs CMD to a labeled line in a batch script.\n\n \\r
-GOTO label\n\n \\r
-  label  Specifies a text string used in a batch script as a label.\n\n \\r
+\r
+STRING_GOTO_HELP1,  "Directs CMD to a labeled line in a batch script.\n\n\\r
+GOTO label\n\n\\r
+  label  Specifies a text string used in a batch script as a label.\n\n\\r
 You type a label on a line by itself, beginning with a colon."\r
 \r
 STRING_LABEL_HELP1, "Displays or changes drive label.\n\nLABEL [drive:][label]"\r
@@ -276,74 +277,74 @@ STRING_LABEL_HELP5, "Drive label (11 Characters, ENTER if none)? "
 \r
 STRING_LOCALE_HELP1, "Current time is"\r
 \r
-STRING_MKDIR_HELP,   "Creates a directory.\n\n \\r
+STRING_MKDIR_HELP,   "Creates a directory.\n\n\\r
 MKDIR [drive:]path\nMD [drive:]path"\r
 \r
 STRING_MEMMORY_HELP1, "Displays the amount of system memory.\n\nMEMORY"\r
 \r
-STRING_MEMMORY_HELP2, "\n  %12s%% memory load.\n\n \\r
-  %13s bytes total physical RAM.\n \\r
-  %13s bytes available physical RAM.\n\n \\r
-  %13s bytes total page file.\n \\r
-  %13s bytes available page file.\n\n \\r
-  %13s bytes total virtual memory.\n \\r
+STRING_MEMMORY_HELP2, "\n  %12s%% memory load.\n\n\\r
+  %13s bytes total physical RAM.\n\\r
+  %13s bytes available physical RAM.\n\n\\r
+  %13s bytes total page file.\n\\r
+  %13s bytes available page file.\n\n\\r
+  %13s bytes total virtual memory.\n\\r
   %13s bytes available virtual memory.\n"\r
 \r
 STRING_MISC_HELP1, "Press a key to continue...\n"\r
 \r
 STRING_MOVE_HELP1, "Overwrite %s (Yes/No/All)? "\r
 \r
-STRING_MOVE_HELP2, "Moves files and renames files and directories.\n\n \\r
-To move one or more files:\n \\r
-MOVE [/N][drive:][path]filename1[,...] destination\n\n \\r
-To rename a directory:\n \\r
-MOVE [/N][drive:][path]dirname1 dirname2\n\n \\r
-  [drive:][path]filename1  Specifies the location and name of the file\n \\r
-                           or files you want to move.\n \\r
-  /N                       Nothing. Don everthing but move files or direcories.\n\n \\r
-Current limitations:\n \\r
+STRING_MOVE_HELP2, "Moves files and renames files and directories.\n\n\\r
+To move one or more files:\n\\r
+MOVE [/N][drive:][path]filename1[,...] destination\n\n\\r
+To rename a directory:\n\\r
+MOVE [/N][drive:][path]dirname1 dirname2\n\n\\r
+  [drive:][path]filename1  Specifies the location and name of the file\n\\r
+                           or files you want to move.\n\\r
+  /N                       Nothing. Do everything but move files or direcories.\n\n\\r
+Current limitations:\n\\r
   - You can't move a file or directory from one drive to another.\n"\r
 \r
-STRING_MSGBOX_HELP, "display a message box and return user responce\n\n \\r
-MSGBOX type ['title'] prompt\n\n \\r
-type          button displayed\n \\r
-              possible values are: OK, OKCANCEL,\n \\r
-              YESNO, YESNOCANCEL\n \\r
-title         title of message box\n \\r
-prompt        text displayed by the message box\n\n\n \\r
-ERRORLEVEL is set according the button pressed:\n\n \\r
-YES  :  10    |  NO      :  11\n \\r
+STRING_MSGBOX_HELP, "display a message box and return user responce\n\n\\r
+MSGBOX type ['title'] prompt\n\n\\r
+type          button displayed\n\\r
+              possible values are: OK, OKCANCEL,\n\\r
+              YESNO, YESNOCANCEL\n\\r
+title         title of message box\n\\r
+prompt        text displayed by the message box\n\n\n\\r
+ERRORLEVEL is set according the button pressed:\n\n\\r
+YES  :  10    |  NO      :  11\n\\r
 OK   :  10    |  CANCEL  :  12\n"\r
 \r
-STRING_PATH_HELP1, "Displays or sets a search path for executable files.\n\n \\r
-PATH [[drive:]path[;...]]\nPATH ;\n\n \\r
-Type PATH ; to clear all search-path settings and direct the command shell\n \\r
-to search only in the current directory.\n \\r
+STRING_PATH_HELP1, "Displays or sets a search path for executable files.\n\n\\r
+PATH [[drive:]path[;...]]\nPATH ;\n\n\\r
+Type PATH ; to clear all search-path settings and direct the command shell\n\\r
+to search only in the current directory.\n\\r
 Type PATH without parameters to display the current path.\n"\r
 \r
-STRING_PROMPT_HELP1, "Changes the command prompt.\n\n \\r
-PROMPT [text]\n\n \\r
-  text    Specifies a new command prompt.\n\n \\r
-Prompt can be made up of normal characters and the following special codes:\n\n \\r
-  $A   & (Ampersand)\n \\r
-  $B   | (pipe)\n \\r
-  $C   ( (Left parenthesis)\n \\r
-  $D   Current date\n \\r
-  $E   Escape code (ASCII code 27)\n \\r
-  $F   ) (Right parenthesis)\n \\r
-  $G   > (greater-than sign)\n \\r
-  $H   Backspace (erases previous character)\n \\r
-  $L   < (less-than sign)\n \\r
-  $N   Current drive\n \\r
-  $P   Current drive and path\n \\r
-  $Q   = (equal sign)\n \\r
-  $T   Current time\n \\r
-  $V   OS version number\n \\r
-  $_   Carriage return and linefeed\n \\r
+STRING_PROMPT_HELP1, "Changes the command prompt.\n\n\\r
+PROMPT [text]\n\n\\r
+  text    Specifies a new command prompt.\n\n\\r
+Prompt can be made up of normal characters and the following special codes:\n\n\\r
+  $A   & (Ampersand)\n\\r
+  $B   | (pipe)\n\\r
+  $C   ( (Left parenthesis)\n\\r
+  $D   Current date\n\\r
+  $E   Escape code (ASCII code 27)\n\\r
+  $F   ) (Right parenthesis)\n\\r
+  $G   > (greater-than sign)\n\\r
+  $H   Backspace (erases previous character)\n\\r
+  $L   < (less-than sign)\n\\r
+  $N   Current drive\n\\r
+  $P   Current drive and path\n\\r
+  $Q   = (equal sign)\n\\r
+  $T   Current time\n\\r
+  $V   OS version number\n\\r
+  $_   Carriage return and linefeed\n\\r
   $$   $ (dollar sign)"\r
 \r
-STRING_PAUSE_HELP1, "Stops the execution of a batch file and shows the following message:\n \\r
-'Press any key to continue...' or a user defined message.\n\n \\r
+STRING_PAUSE_HELP1, "Stops the execution of a batch file and shows the following message:\n\\r
+'Press any key to continue...' or a user defined message.\n\n\\r
 PAUSE [message]"\r
 \r
 STRING_PROMPT_HELP2, "  $+   Displays the current depth of the directory stack"\r
@@ -352,53 +353,53 @@ STRING_PROMPT_HELP3, "\nType PROMPT without parameters to reset the prompt to th
 \r
 STRING_REM_HELP, "Starts a comment line in a batch file.\n\nREM [Comment]"\r
 \r
-STRING_RMDIR_HELP,   "Removes a directory.\n\n \\r
-RMDIR [drive:]path\nRD [drive:]path"  \r
-\r
-STRING_REN_HELP1, "Renames a file/directory or files/directories.\n\n \\r
-RENAME [/E /N /P /Q /S /T] old_name ... new_name\n \\r
-REN [/E /N /P /Q /S /T] old_name ... new_name\n\n \\r
-  /E    No eror messages.\n \\r
-  /N    Nothing.\n \\r
-  /P    Prompts for confirmation before renaming each file.\n \\r
-        (Not implemented yet!)\n \\r
-  /Q    Quiet.\n \\r
-  /S    Rename subdirectories.\n \\r
-  /T    Display total number of renamed files.\n\n \\r
-Note that you cannot specify a new drive or path for your destination. Use\n \\r
+STRING_RMDIR_HELP,   "Removes a directory.\n\n\\r
+RMDIR [drive:]path\nRD [drive:]path"\r
+\r
+STRING_REN_HELP1, "Renames a file/directory or files/directories.\n\n\\r
+RENAME [/E /N /P /Q /S /T] old_name ... new_name\n\\r
+REN [/E /N /P /Q /S /T] old_name ... new_name\n\n\\r
+  /E    No eror messages.\n\\r
+  /N    Nothing.\n\\r
+  /P    Prompts for confirmation before renaming each file.\n\\r
+        (Not implemented yet!)\n\\r
+  /Q    Quiet.\n\\r
+  /S    Rename subdirectories.\n\\r
+  /T    Display total number of renamed files.\n\n\\r
+Note that you cannot specify a new drive or path for your destination. Use\n\\r
 the MOVE command for that purpose."\r
 \r
 STRING_REN_HELP2, "    %lu file renamed\n"\r
 \r
 STRING_REN_HELP3, "    %lu files renamed\n"\r
                 \r
-STRING_SHIFT_HELP, "Changes the position of replaceable parameters in a batch file.\n\n \\r
+STRING_SHIFT_HELP, "Changes the position of replaceable parameters in a batch file.\n\n\\r
 SHIFT [DOWN]"\r
 \r
-STRING_SCREEN_HELP, "move cursor and optionally print text\n\n \\r
-SCREEN row col [text]\n\n \\r
-  row         row to wich move the cursor\n \\r
+STRING_SCREEN_HELP, "move cursor and optionally print text\n\n\\r
+SCREEN row col [text]\n\n\\r
+  row         row to wich move the cursor\n\\r
   col         column to wich move the cursor"\r
 \r
-STRING_SET_HELP, "Displays, sets, or removes environment variables.\n\n \\r
-SET [variable[=][string]]\n\n \\r
-  variable  Specifies the environment-variable name.\n \\r
-  string    Specifies a series of characters to assign to the variable.\n\n \\r
+STRING_SET_HELP, "Displays, sets, or removes environment variables.\n\n\\r
+SET [variable[=][string]]\n\n\\r
+  variable  Specifies the environment-variable name.\n\\r
+  string    Specifies a series of characters to assign to the variable.\n\n\\r
 Type SET without parameters to display the current environment variables.\n"\r
 \r
-STRING_START_HELP1, "Starts a command.\n\n \\r
-START command \n\n \\r
-  command     Specifies the command to run.\n\n \\r
+STRING_START_HELP1, "Starts a command.\n\n\\r
+START command\n\n\\r
+  command     Specifies the command to run.\n\n\\r
 At the moment all commands are started asynchronously.\n"\r
 \r
-STRING_TITLE_HELP, "Sets the window title for the command prompt window.\n\n \\r
-TITLE [string]\n\n \\r
+STRING_TITLE_HELP, "Sets the window title for the command prompt window.\n\n\\r
+TITLE [string]\n\n\\r
 string       Specifies the title for the command prompt window."\r
 \r
-STRING_TIME_HELP1, "Displays or sets the system time.\n\n \\r
-TIME [/T][time]\n\n \\r
-  /T    display only\n\n \\r
-Type TIME with no parameters to display the current time setting and a prompt\n \\r
+STRING_TIME_HELP1, "Displays or sets the system time.\n\n\\r
+TIME [/T][time]\n\n\\r
+  /T    display only\n\n\\r
+Type TIME with no parameters to display the current time setting and a prompt\n\\r
 for a new one.  Press ENTER to keep the same time."\r
 \r
 STRING_TIME_HELP2, "Enter new time: "\r
@@ -407,88 +408,88 @@ STRING_TIMER_HELP1, "Elapsed %d msecs\n"
 \r
 STRING_TIMER_HELP2, "Elapsed %02d%c%02d%c%02d%c%02d\n"\r
 \r
-STRING_TIMER_HELP3, "allow the use of ten stopwaches.\n\n \\r
-TIMER  [ON|OFF] [/S] [/n] [/Fn]\n\n \\r
-  ON          set stopwach ON\n \\r
-  OFF         set stopwach OFF\n \\r
-  /S          Split time. Return stopwach split\n \\r
-              time without changing its value\n \\r
-  /n          Specifiy the stopwach number.\n \\r
-              Stopwaches avaliable are 0 to 10\n \\r
-              If it is not specified default is 1\n \\r
-  /Fn         Format for output\n \\r
-              n can be:\n \\r
-                    0    milliseconds\n \\r
-                    1    hh%cmm%css%cdd\n\n \\r
-if none of ON, OFF or /S is specified the command\n \\r
+STRING_TIMER_HELP3, "allow the use of ten stopwaches.\n\n\\r
+TIMER  [ON|OFF] [/S] [/n] [/Fn]\n\n\\r
+  ON          set stopwach ON\n\\r
+  OFF         set stopwach OFF\n\\r
+  /S          Split time. Return stopwach split\n\\r
+              time without changing its value\n\\r
+  /n          Specifiy the stopwach number.\n\\r
+              Stopwaches avaliable are 0 to 10\n\\r
+              If it is not specified default is 1\n\\r
+  /Fn         Format for output\n\\r
+              n can be:\n\\r
+                    0    milliseconds\n\\r
+                    1    hh%cmm%css%cdd\n\n\\r
+if none of ON, OFF or /S is specified the command\n\\r
 will toggle stopwach state\n\n"\r
-                              \r
+\r
 STRING_TYPE_HELP1, "Displays the contents of text files.\n\nTYPE [drive:][path]filename"\r
 \r
-STRING_VERIFY_HELP1, "This command is just a dummy!!\n \\r
-Sets whether to verify that your files are written correctly to a\n \\r
-disk.\n\n \\r
-VERIFY [ON | OFF]\n\n \\r
+STRING_VERIFY_HELP1, "This command is just a dummy!!\n\\r
+Sets whether to verify that your files are written correctly to a\n\\r
+disk.\n\n\\r
+VERIFY [ON | OFF]\n\n\\r
 Type VERIFY without a parameter to display the current VERIFY setting."\r
 \r
 STRING_VERIFY_HELP2, "VERIFY is %s.\n"\r
 \r
 STRING_VERIFY_HELP3, "Must specify ON or OFF."\r
 \r
-STRING_VERSION_HELP1, "Displays shell version information\n\n \\r
-VER [/C][/R][/W]\n\n \\r
-  /C  Displays credits.\n \\r
-  /R  Displays redistribution information.\n \\r
+STRING_VERSION_HELP1, "Displays shell version information\n\n\\r
+VER [/C][/R][/W]\n\n\\r
+  /C  Displays credits.\n\\r
+  /R  Displays redistribution information.\n\\r
   /W  Displays warranty information."\r
 \r
-STRING_VERSION_HELP2, " comes with ABSOLUTELY NO WARRANTY; for details\n \\r
-type: `ver /w'. This is free software, and you are welcome to redistribute\n \\r
-it under certain conditions; type `ver /r' for details. Type `ver /c' for a\n \\r
+STRING_VERSION_HELP2, " comes with ABSOLUTELY NO WARRANTY; for details\n\\r
+type: `ver /w'. This is free software, and you are welcome to redistribute\n\\r
+it under certain conditions; type `ver /r' for details. Type `ver /c' for a\n\\r
 listing of credits."\r
 \r
-STRING_VERSION_HELP3, "\n This program is distributed in the hope that it will be useful,\n \\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\n \\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n \\r
+STRING_VERSION_HELP3, "\n This program is distributed in the hope that it will be useful,\n\\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n\\r
  GNU General Public License for more details."\r
 \r
- STRING_VERSION_HELP4, "\n This program is free software; you can redistribute it and/or modify\n \\r
- it under the terms of the GNU General Public License as published by\n \\r
- the Free Software Foundation; either version 2 of the License, or\n \\r
+STRING_VERSION_HELP4, "\n This program is free software; you can redistribute it and/or modify\n\\r
+ it under the terms of the GNU General Public License as published by\n\\r
+ the Free Software Foundation; either version 2 of the License, or\n\\r
  (at your option) any later version."\r
 \r
-STRING_VERSION_HELP5, "\nSend bug reports to <ros-dev@reactos.com>.\n \\r
+STRING_VERSION_HELP5, "\nSend bug reports to <ros-dev@reactos.com>.\n\\r
 Updates are available at: http://www.reactos.com"\r
 \r
-STRING_VERSION_HELP6, "FreeDOS version written by:\n%s\nReactOS version written by:\n%s\n"\r
+STRING_VERSION_HELP6, "\nFreeDOS version written by:\n"\r
+\r
+STRING_VERSION_HELP7, "\nReactOS version written by:\n"\r
 \r
 STRING_VOL_HELP1, " Volume in drive %c: is %s"\r
 STRING_VOL_HELP2, " Volume in drive %c: has no label"\r
 STRING_VOL_HELP3, " Volume Serial Number is %04X-%04X\n"\r
 STRING_VOL_HELP4, "Displays the disk volume label and serial number, if they exist.\n\nVOL [drive:]"\r
 \r
-STRING_WINDOW_HELP1, "change console window aspect\n\n \\r
-WINDOW [/POS[=]left,top,width,heigth]\n \\r
-              [MIN|MAX|RESTORE] ['title']\n\n \\r
-/POS          specify window placement and dimensions\n \\r
-MIN           minimize the window\n \\r
-MAX           maximize the window\n \\r
+STRING_WINDOW_HELP1, "change console window aspect\n\n\\r
+WINDOW [/POS[=]left,top,width,heigth]\n\\r
+              [MIN|MAX|RESTORE] ['title']\n\n\\r
+/POS          specify window placement and dimensions\n\\r
+MIN           minimize the window\n\\r
+MAX           maximize the window\n\\r
 RESTORE       restore the window"\r
 \r
-STRING_WINDOW_HELP2, "change console window aspect\n\n \\r
-ACTIAVTE 'window' [/POS[=]left,top,width,heigth]\n \\r
-              [MIN|MAX|RESTORE] ['title']\n\n \\r
-window        tile of window on wich perform actions\n \\r
-/POS          specify window placement and dimensions\n \\r
-MIN           minimize the window\n \\r
-MAX           maximize the window\n \\r
-RESTORE       restore the window\n \\r
-title          new title"\r
+STRING_WINDOW_HELP2, "change console window aspect\n\n\\r
+ACTIAVTE 'window' [/POS[=]left,top,width,heigth]\n\\r
+              [MIN|MAX|RESTORE] ['title']\n\n\\r
+window        tile of window on wich perform actions\n\\r
+/POS          specify window placement and dimensions\n\\r
+MIN           minimize the window\n\\r
+MAX           maximize the window\n\\r
+RESTORE       restore the window\n\\r
+title         new title"\r
 \r
 \r
-       \r
 STRING_CHOICE_OPTION,         "YN"\r
 STRING_COPY_OPTION,           "YNA"\r
-STRING_DEL_OPTION,            "AENPQSTWXYZ"\r
 \r
 \r
 STRING_ALIAS_ERROR,          "Command line too long after alias expansion!\n"\r
@@ -515,20 +516,15 @@ STRING_COPY_ERROR2,          "Error: Can't copy onto itself!\n"
 STRING_COPY_ERROR3,          "Error writing destination!\n"\r
 STRING_COPY_ERROR4,          "Error: Not implemented yet!\n"\r
 STRING_DATE_ERROR,           "Invalid date."\r
-STRING_DEL_ERROR1,           "Wildcards!\n\n"\r
-STRING_DEL_ERROR2,           "Full path: %s\n"\r
-STRING_DEL_ERROR3,           "File part: %s\n"\r
-STRING_DEL_ERROR4,           "Full filename: %s\n"\r
 STRING_DEL_ERROR5,           "The file %s will be deleted! "\r
 STRING_DEL_ERROR6,           "Are you sure (Y/N)?"\r
 STRING_DEL_ERROR7,           "Deleting: %s\n"\r
-STRING_DEL_ERROR8,           "No Wildcards!\n"\r
 STRING_ERROR_ERROR1,         "Unknown error! Error code: 0x%lx\n"\r
 STRING_ERROR_ERROR2,         "Syntax error"\r
 STRING_FOR_ERROR1,           "'in' missing in for statement."\r
 STRING_FOR_ERROR2,           "no brackets found."\r
 STRING_FOR_ERROR3,           "'do' missing." \r
-STRING_FOR_ERROR4,           "no command after 'do'." \r
+STRING_FOR_ERROR4,           "no command after 'do'."\r
 STRING_FREE_ERROR1,          "Invalid drive"\r
 STRING_FREE_ERROR2,          "unlabeled"\r
 STRING_GOTO_ERROR1,          "No label specified for GOTO"\r
@@ -552,18 +548,17 @@ STRING_TYPE_ERROR1,          "Invalid option '/%s'\n"
 STRING_WINDOW_ERROR1,        "window not found"\r
 \r
 \r
-STRING_ERROR_PARAMETERF_ERROR,    "Parameter format not correct - %c\n"\r
+STRING_ERROR_PARAMETERF_ERROR,     "Parameter format not correct - %c\n"\r
 STRING_ERROR_INVALID_SWITCH,       "Invalid switch - /%c\n"\r
 STRING_ERROR_TOO_MANY_PARAMETERS,  "Too many parameters - %s\n"\r
-STRING_ERROR_PATH_NOT_FOUND,      "Path not found\n"\r
-STRING_ERROR_FILE_NOT_FOUND,      "File not found\n"\r
-STRING_ERROR_REQ_PARAM_MISSING,           "Required parameter missing\n"\r
-STRING_ERROR_INVALID_DRIVE,               "Invalid drive specification\n"\r
+STRING_ERROR_PATH_NOT_FOUND,       "Path not found\n"\r
+STRING_ERROR_FILE_NOT_FOUND,       "File not found\n"\r
+STRING_ERROR_REQ_PARAM_MISSING,    "Required parameter missing\n"\r
+STRING_ERROR_INVALID_DRIVE,        "Invalid drive specification\n"\r
 STRING_ERROR_INVALID_PARAM_FORMAT, "Invalid parameter format - %s\n"\r
-STRING_ERROR_BADCOMMAND,                  "Bad command or filename\n"\r
-STRING_ERROR_OUT_OF_MEMORY,               "Out of memory error.\n"\r
-STRING_ERROR_CANNOTPIPE,                  "Error!  Cannot pipe!  Cannot open temporary file!\n"\r
-STRING_ERROR_D_PAUSEMSG,                  "Press any key to continue . . ."\r
-STRING_ERROR_DRIVER_NOT_READY      "Drive not ready" \r
-\r
+STRING_ERROR_BADCOMMAND,           "Bad command or filename\n"\r
+STRING_ERROR_OUT_OF_MEMORY,        "Out of memory error.\n"\r
+STRING_ERROR_CANNOTPIPE,           "Error!  Cannot pipe!  Cannot open temporary file!\n"\r
+STRING_ERROR_D_PAUSEMSG,           "Press any key to continue . . ."\r
+STRING_ERROR_DRIVER_NOT_READY      "Drive not ready"\r
 }\r
index 00d7122..8eb1695 100644 (file)
@@ -281,8 +281,9 @@ VOID ExpandAlias (LPTSTR cmd, INT maxlen)
                                m = _tcslen (ptr->lpSubst);
                                if ((int)(_tcslen (cmd) - len + m - n) > maxlen)
                                {
-                                       LoadString( GetModuleHandle(NULL), STRING_ALIAS_ERROR, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                                       ConErrPrintf (szMsg);                                   
+                                       LoadString(GetModuleHandle(NULL), STRING_ALIAS_ERROR, szMsg, RC_STRING_MAX_SIZE);
+                                       ConErrPrintf(szMsg);
+
                                        /* the parser won't cause any problems with an empty line */
                                        cmd[0] = _T('\0');
                                }
@@ -305,13 +306,13 @@ VOID ExpandAlias (LPTSTR cmd, INT maxlen)
 
 INT CommandAlias (LPTSTR cmd, LPTSTR param)
 {
-       LPTSTR ptr;
        TCHAR szMsg[RC_STRING_MAX_SIZE];
+       LPTSTR ptr;
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_ALIAS_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_ALIAS_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
index e43742a..650a58a 100644 (file)
@@ -44,7 +44,7 @@ PrintAttribute (LPTSTR pszPath, LPTSTR pszFile, BOOL bRecurse)
        WIN32_FIND_DATA findData;
        HANDLE hFind;
        TCHAR  szFullName[MAX_PATH];
-       LPTSTR pszFileName;      
+       LPTSTR pszFileName;
 
        /* prepare full file name buffer */
        _tcscpy (szFullName, pszPath);
@@ -112,7 +112,7 @@ PrintAttribute (LPTSTR pszPath, LPTSTR pszFile, BOOL bRecurse)
 
 static VOID
 ChangeAttribute (LPTSTR pszPath, LPTSTR pszFile, DWORD dwMask,
-                                DWORD dwAttrib, BOOL bRecurse, BOOL bDirectories)
+                DWORD dwAttrib, BOOL bRecurse, BOOL bDirectories)
 {
        WIN32_FIND_DATA findData;
        HANDLE hFind;
@@ -143,7 +143,7 @@ ChangeAttribute (LPTSTR pszPath, LPTSTR pszFile, DWORD dwMask,
                        if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
                        {
                                if (!_tcscmp (findData.cFileName, _T(".")) ||
-                                       !_tcscmp (findData.cFileName, _T("..")))
+                                   !_tcscmp (findData.cFileName, _T("..")))
                                        continue;
 
                                _tcscpy (pszFileName, findData.cFileName);
@@ -189,6 +189,7 @@ ChangeAttribute (LPTSTR pszPath, LPTSTR pszFile, DWORD dwMask,
 
 INT CommandAttrib (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        LPTSTR *arg;
        INT    argc, i;
        TCHAR  szPath[MAX_PATH];
@@ -197,7 +198,6 @@ INT CommandAttrib (LPTSTR cmd, LPTSTR param)
        BOOL   bDirectories = FALSE;
        DWORD  dwAttrib = 0;
        DWORD  dwMask = 0;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        /* initialize strings */
        szPath[0] = _T('\0');
@@ -206,8 +206,8 @@ INT CommandAttrib (LPTSTR cmd, LPTSTR param)
        /* print help */
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_ATTRIB_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_ATTRIB_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -321,7 +321,7 @@ INT CommandAttrib (LPTSTR cmd, LPTSTR param)
        /* get full file name */
        for (i = 0; i < argc; i++)
        {
-               if ((*arg[i] != _T('+')) && (*arg[i] != _T('-')) &&     (*arg[i] != _T('/')))
+               if ((*arg[i] != _T('+')) && (*arg[i] != _T('-')) && (*arg[i] != _T('/')))
                {
                        LPTSTR p;
                        GetFullPathName (arg[i], MAX_PATH, szPath, NULL);
@@ -333,7 +333,7 @@ INT CommandAttrib (LPTSTR cmd, LPTSTR param)
                                PrintAttribute (szPath, szFileName, bRecurse);
                        else
                                ChangeAttribute (szPath, szFileName, dwMask,
-                                                                dwAttrib, bRecurse, bDirectories);
+                                                dwAttrib, bRecurse, bDirectories);
                }
        }
 
index 35e62e2..e2ad269 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
  *  BATCH.C - batch file processor for CMD.EXE.
  *
  *
@@ -218,12 +217,12 @@ VOID ExitBatch (LPTSTR msg)
 
 BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
 {
-       HANDLE hFile;
        TCHAR szMsg[RC_STRING_MAX_SIZE];
+       HANDLE hFile;
 
        hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_READ, NULL,
-                                               OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |
-                                               FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+                           OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |
+                           FILE_FLAG_SEQUENTIAL_SCAN, NULL);
 
 #ifdef _DEBUG
        DebugPrintf (_T("Batch: (\'%s\', \'%s\', \'%s\')  hFile = %x\n"),
@@ -232,8 +231,8 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
 
        if (hFile == INVALID_HANDLE_VALUE)
        {
-               LoadString( GetModuleHandle(NULL), STRING_BATCH_ERROR, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPrintf (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_BATCH_ERROR, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf(szMsg);
                return FALSE;
        }
 
index ad2f6a6..e14334e 100644 (file)
@@ -36,8 +36,8 @@ INT cmd_beep (LPTSTR cmd, LPTSTR param)
 
        if (_tcsncmp (param, _T("/?"), 2) == 0)
        {
-               LoadString( GetModuleHandle(NULL), STRING_ALIAS_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts ((LPTSTR)szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_ALIAS_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
index 19e4aa4..4429eb2 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
  *  CALL.C - call internal batch command.
  *
  *
 
 INT cmd_call (LPTSTR cmd, LPTSTR param)
 {
-       LPBATCH_CONTEXT n = NULL;
        TCHAR szMsg[RC_STRING_MAX_SIZE];
+       LPBATCH_CONTEXT n = NULL;
 
 #ifdef _DEBUG
        DebugPrintf (_T("cmd_call: (\'%s\',\'%s\')\n"), cmd, param);
 #endif
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_CALL_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts ((LPTSTR)szMsg);
-
+               LoadString(GetModuleHandle(NULL), STRING_CALL_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
index 3ec2108..1b3e7a9 100644 (file)
 
 INT CommandChcp (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        LPTSTR *arg;
        INT    args;
        UINT uOldCodePage;
        UINT uNewCodePage;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        /* print help */
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_CHCP_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPuts (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_CHCP_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -38,39 +38,37 @@ INT CommandChcp (LPTSTR cmd, LPTSTR param)
        if (args == 0)
        {
                /* display active code page number */
-               LoadString( GetModuleHandle(NULL), STRING_CHCP_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPrintf (szMsg, GetConsoleCP ());
-
+               LoadString(GetModuleHandle(NULL), STRING_CHCP_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf(szMsg, GetConsoleCP());
                return 0;
        }
 
        if (args >= 2)
        {
                /* too many parameters */
-               LoadString( GetModuleHandle(NULL), STRING_CHCP_ERROR2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPrintf (szMsg, param);
-
+               LoadString(GetModuleHandle(NULL), STRING_CHCP_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf(szMsg, param);
                return 1;
        }
 
 
        /* save old code page */
-       uOldCodePage = GetConsoleCP ();
+       uOldCodePage = GetConsoleCP();
 
-       uNewCodePage = (UINT)_ttoi (arg[0]);
+       uNewCodePage = (UINT)_ttoi(arg[0]);
 
        if (uNewCodePage == 0)
        {
-               LoadString( GetModuleHandle(NULL), STRING_CHCP_ERROR3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPrintf (szMsg, arg[0]);
+               LoadString(GetModuleHandle(NULL), STRING_CHCP_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf(szMsg, arg[0]);
                freep (arg);
                return 1;
        }
 
-       if (!SetConsoleCP (uNewCodePage))
+       if (!SetConsoleCP(uNewCodePage))
        {
-               LoadString( GetModuleHandle(NULL), STRING_CHCP_ERROR4, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPrintf (szMsg);           
+               LoadString(GetModuleHandle(NULL), STRING_CHCP_ERROR4, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf(szMsg);
        }
        else
        {
index 2ae006a..f272186 100644 (file)
@@ -103,6 +103,7 @@ IsKeyInString (LPTSTR lpString, TCHAR cKey, BOOL bCaseSensitive)
 INT
 CommandChoice (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        LPTSTR lpOptions;
        TCHAR Options[2];
        LPTSTR lpText    = NULL;
@@ -121,16 +122,15 @@ CommandChoice (LPTSTR cmd, LPTSTR param)
        INT GCret;
        TCHAR Ch;
        DWORD amount,clk;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
-       LoadString( GetModuleHandle(NULL), STRING_CHOICE_OPTION, Options,sizeof(lpOptions)/sizeof(TCHAR));
+       LoadString(GetModuleHandle(NULL), STRING_CHOICE_OPTION, Options, 2);
        lpOptions = Options;
 
        if (_tcsncmp (param, _T("/?"), 2) == 0)
        {
-           LoadString( GetModuleHandle(NULL), STRING_CHOICE_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-           ConOutPuts (szMsg);
-            return 0;
+               LoadString(GetModuleHandle(NULL), STRING_CHOICE_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
+               return 0;
        }
 
        /* retrieve text */
@@ -169,9 +169,8 @@ CommandChoice (LPTSTR cmd, LPTSTR param)
 
                                if (_tcslen (lpOptions) == 0)
                                {
-                                       
-                                       LoadString( GetModuleHandle(NULL), STRING_CHOICE_ERROR, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                                       ConErrPuts (szMsg);
+                                       LoadString(GetModuleHandle(NULL), STRING_CHOICE_ERROR, szMsg, RC_STRING_MAX_SIZE);
+                                       ConErrPuts(szMsg);
                                        freep (arg);
                                        return 1;
                                }
@@ -201,8 +200,8 @@ CommandChoice (LPTSTR cmd, LPTSTR param)
 
                                if (*s != _T(','))
                                {
-                                       LoadString( GetModuleHandle(NULL), STRING_CHOICE_ERROR_TXT, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                                       ConErrPuts (szMsg);
+                                       LoadString(GetModuleHandle(NULL), STRING_CHOICE_ERROR_TXT, szMsg, RC_STRING_MAX_SIZE);
+                                       ConErrPuts(szMsg);
                                        freep (arg);
                                        return 1;
                                }
@@ -213,8 +212,8 @@ CommandChoice (LPTSTR cmd, LPTSTR param)
                        }
                        else if (arg[i][0] == _T('/'))
                        {
-                               LoadString( GetModuleHandle(NULL), STRING_CHOICE_ERROR_OPTION, szMsg,sizeof(szMsg)/sizeof(TCHAR));               
-                               ConErrPrintf (szMsg, arg[i]);
+                               LoadString(GetModuleHandle(NULL), STRING_CHOICE_ERROR_OPTION, szMsg, RC_STRING_MAX_SIZE);
+                               ConErrPrintf(szMsg, arg[i]);
                                freep (arg);
                                return 1;
                        }
index 7c7418e..e96d330 100644 (file)
 
 INT cmd_cls (LPTSTR cmd, LPTSTR param)
 {
-       DWORD dwWritten;
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        CONSOLE_SCREEN_BUFFER_INFO csbi;
        COORD coPos;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
+       DWORD dwWritten;
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_CLS_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_CLS_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
-       GetConsoleScreenBufferInfo (hConsole, &csbi);
+       GetConsoleScreenBufferInfo(hConsole, &csbi);
 
        coPos.X = 0;
        coPos.Y = 0;
-       FillConsoleOutputAttribute (hConsole, wColor,
-                                                               (csbi.dwSize.X)*(csbi.dwSize.Y),
-                                                               coPos, &dwWritten);
-       FillConsoleOutputCharacter (hConsole, _T(' '),
-                                                               (csbi.dwSize.X)*(csbi.dwSize.Y),
-                                                               coPos, &dwWritten);
-       SetConsoleCursorPosition (hConsole, coPos);
+       FillConsoleOutputAttribute(hConsole, wColor,
+                                  csbi.dwSize.X * csbi.dwSize.Y,
+                                  coPos, &dwWritten);
+       FillConsoleOutputCharacter(hConsole, _T(' '),
+                                  csbi.dwSize.X * csbi.dwSize.Y,
+                                  coPos, &dwWritten);
+       SetConsoleCursorPosition(hConsole, coPos);
 
        bIgnoreEcho = TRUE;
 
index be6d1b0..2399496 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
  *  CMD.C - command-line interface.
  *
  *
@@ -550,9 +549,9 @@ DoCommand (LPTSTR line)
 
 VOID ParseCommandLine (LPTSTR cmd)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR cmdline[CMDLINE_LENGTH];
        LPTSTR s;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 #ifdef FEATURE_REDIRECTION
        TCHAR in[CMDLINE_LENGTH] = _T("");
        TCHAR out[CMDLINE_LENGTH] = _T("");
@@ -634,15 +633,15 @@ VOID ParseCommandLine (LPTSTR cmd)
                                    FILE_ATTRIBUTE_NORMAL, NULL);
                if (hFile == INVALID_HANDLE_VALUE)
                {
-                       LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                       ConErrPrintf (szMsg, in);
+                       LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+                       ConErrPrintf(szMsg, in);
                        return;
                }
 
                if (!SetStdHandle (STD_INPUT_HANDLE, hFile))
                {
-                       LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                       ConErrPrintf (szMsg, in);
+                       LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+                       ConErrPrintf(szMsg, in);
                        return;
                }
 #ifdef _DEBUG
@@ -664,13 +663,12 @@ VOID ParseCommandLine (LPTSTR cmd)
                /* Set current stdout to temporary file */
                hFile[1] = CreateFile (szFileName[1], GENERIC_WRITE, 0, &sa,
                                       TRUNCATE_EXISTING, FILE_ATTRIBUTE_TEMPORARY, NULL);
-
-      if (hFile[1] == INVALID_HANDLE_VALUE){
-
-         LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-         ConErrPrintf (szMsg);
-         return;
-      }
+               if (hFile[1] == INVALID_HANDLE_VALUE)
+               {
+                       LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+                       ConErrPrintf(szMsg);
+                       return;
+               }
 
                SetStdHandle (STD_OUTPUT_HANDLE, hFile[1]);
 
@@ -720,16 +718,15 @@ VOID ParseCommandLine (LPTSTR cmd)
                                    FILE_ATTRIBUTE_NORMAL, NULL);
                if (hFile == INVALID_HANDLE_VALUE)
                {
-                       LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                       ConErrPrintf (szMsg, out);
-
+                       LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+                       ConErrPrintf(szMsg, out);
                        return;
                }
 
                if (!SetStdHandle (STD_OUTPUT_HANDLE, hFile))
                {
-                       LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                       ConErrPrintf (szMsg, out);
+                       LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+                       ConErrPrintf(szMsg, out);
                        return;
                }
 
@@ -782,17 +779,16 @@ VOID ParseCommandLine (LPTSTR cmd)
                                            NULL);
                        if (hFile == INVALID_HANDLE_VALUE)
                        {
-                               LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                               ConErrPrintf (szMsg, err);
-
+                               LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+                               ConErrPrintf(szMsg, err);
                                return;
                        }
                }
+
                if (!SetStdHandle (STD_ERROR_HANDLE, hFile))
                {
-                       LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                       ConErrPrintf (szMsg, err);
-
+                       LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+                       ConErrPrintf(szMsg, err);
                        return;
                }
 
@@ -1079,35 +1075,35 @@ ShowCommands (VOID)
        TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        /* print command list */
-       LoadString( GetModuleHandle(NULL), STRING_CMD_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPrintf (szMsg);
-       PrintCommandList ();
+       LoadString(GetModuleHandle(NULL), STRING_CMD_HELP1, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPrintf(szMsg);
+       PrintCommandList();
 
        /* print feature list */
-       LoadString( GetModuleHandle(NULL), STRING_CMD_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPuts (szMsg);
+       LoadString(GetModuleHandle(NULL), STRING_CMD_HELP2, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPuts(szMsg);
 
 #ifdef FEATURE_ALIASES 
-       LoadString( GetModuleHandle(NULL), STRING_CMD_HELP3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPuts (szMsg);
+       LoadString(GetModuleHandle(NULL), STRING_CMD_HELP3, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPuts(szMsg);
 #endif
 #ifdef FEATURE_HISTORY
-       LoadString( GetModuleHandle(NULL), STRING_CMD_HELP4, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPuts (szMsg);
+       LoadString(GetModuleHandle(NULL), STRING_CMD_HELP4, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPuts(szMsg);
 #endif
 #ifdef FEATURE_UNIX_FILENAME_COMPLETION
-       LoadString( GetModuleHandle(NULL), STRING_CMD_HELP5, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPuts (szMsg);
+       LoadString(GetModuleHandle(NULL), STRING_CMD_HELP5, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPuts(szMsg);
 #endif
 #ifdef FEATURE_DIRECTORY_STACK
-       LoadString( GetModuleHandle(NULL), STRING_CMD_HELP6, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPuts (szMsg);
+       LoadString(GetModuleHandle(NULL), STRING_CMD_HELP6, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPuts(szMsg);
 #endif
 #ifdef FEATURE_REDIRECTION
-       LoadString( GetModuleHandle(NULL), STRING_CMD_HELP7, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPuts (szMsg);
+       LoadString(GetModuleHandle(NULL), STRING_CMD_HELP7, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPuts(szMsg);
 #endif
-       ConOutChar (_T('\n'));
+       ConOutChar(_T('\n'));
 }
 #endif
 
@@ -1121,10 +1117,10 @@ ShowCommands (VOID)
 static VOID
 Initialize (int argc, TCHAR* argv[])
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR commandline[CMDLINE_LENGTH];
        TCHAR ModuleName[_MAX_PATH + 1];
        INT i;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        //INT len;
        //TCHAR *ptr, *cmdLine;
@@ -1154,9 +1150,9 @@ Initialize (int argc, TCHAR* argv[])
 
        if (argc >= 2 && !_tcsncmp (argv[1], _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_CMD_HELP8, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);
-               ExitProcess (0);
+               LoadString(GetModuleHandle(NULL), STRING_CMD_HELP8, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
+               ExitProcess(0);
        }
        SetConsoleMode (hIn, ENABLE_PROCESSED_INPUT);
 
@@ -1259,8 +1255,8 @@ Initialize (int argc, TCHAR* argv[])
 
                if (IsExistingFile (_T("commandline")))
                {
-                       LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR4, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                       ConErrPrintf (szMsg, commandline);
+                       LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR4, szMsg, RC_STRING_MAX_SIZE);
+                       ConErrPrintf(szMsg, commandline);
                        ParseCommandLine (commandline);
                }
        }
@@ -1296,15 +1292,15 @@ static VOID Cleanup (int argc, TCHAR *argv[])
        /* run cmdexit.bat */
        if (IsExistingFile (_T("cmdexit.bat")))
        {
-               LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR5, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPrintf (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR5, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf(szMsg);
 
                ParseCommandLine (_T("cmdexit.bat"));
        }
        else if (IsExistingFile (_T("\\cmdexit.bat")))
        {
-               LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR5, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPrintf (szMsg);
+               LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR5, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf ((LPTSTR)szMsg);
                ParseCommandLine (_T("\\cmdexit.bat"));
        }
 #ifndef __REACTOS__
@@ -1320,8 +1316,8 @@ static VOID Cleanup (int argc, TCHAR *argv[])
 
                if (IsExistingFile (_T("commandline")))
                {
-                       LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR4, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                       ConErrPrintf (szMsg, commandline);
+                       LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR4, szMsg, RC_STRING_MAX_SIZE);
+                       ConErrPrintf(szMsg, commandline);
                        ParseCommandLine (commandline);
                }
        }
index 4beb814..5730d8a 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
  *  CMD.H - header file for the modules in CMD.EXE
  *
  *
@@ -170,7 +169,7 @@ VOID ConOutPrintf (LPTSTR, ...);
 VOID ConErrChar (TCHAR);
 VOID ConErrPuts (LPTSTR);
 VOID ConErrPrintf (LPTSTR, ...);
-VOID ConOutFormatMessage (DWORD MessageId, ...);       
+VOID ConOutFormatMessage (DWORD MessageId, ...);
 
 SHORT GetCursorX  (VOID);
 SHORT GetCursorY  (VOID);
index 3563a94..1f886f1 100644 (file)
@@ -5,26 +5,25 @@
 #define REACTOS_STR_INTERNAL_NAME      "cmd\0"
 #define REACTOS_STR_ORIGINAL_FILENAME  "cmd.exe\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-2005 Eric Kohl and others\0"
+
 #include <reactos/version.rc>
 #include "En.rc"
+
 STRINGTABLE DISCARDABLE
 {
STRING_FreeDOS_DEV, "    Tim Norman      Matt Rains\n \
-    Evan Jeffrey    Steffen Kaiser\n \
-    Svante Frey     Oliver Mueller\n \
-    Aaron Kaufman   Marc Desrochers\n \
-    Rob Lake        John P Price\n \
 STRING_FREEDOS_DEV, "    Tim Norman      Matt Rains\n\
+    Evan Jeffrey    Steffen Kaiser\n\
+    Svante Frey     Oliver Mueller\n\
+    Aaron Kaufman   Marc Desrochers\n\
+    Rob Lake        John P Price\n\
     Hans B Pufal\n"
 
STRING_REACTOS_DEV,  "    Eric Kohl       Emanuele Aliberti\n \
 STRING_REACTOS_DEV,  "    Eric Kohl       Emanuele Aliberti\n\
     Paolo Pantaleo  Phillip Susi\n"
 }
 
-
-
-1      ICON    DISCARDABLE     res/terminal.ico
+1 ICON DISCARDABLE res/terminal.ico
 
 
 
index daa5c71..ca704ad 100644 (file)
@@ -332,7 +332,7 @@ VOID ReadCommand (LPTSTR str, INT maxlen)
                                                {
                                                        if (((charcount + orgx) / maxx) + orgy > maxy - 1)
                                                                orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
-                                               }
+                                               }
 
                                                /* set cursor position */
                                                SetCursorXY ((orgx + current) % maxx,
index 446b967..716eb86 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
  *  COLOR.C - color internal command.
  *
  *
  *        Redirection ready!
  *
  *    14-Oct-1999 (Paolo Pantaleo <paolopan@freemail.it>)
- *        4nt's syntax implemented
+ *        4nt's syntax implemented.
  *
  *    03-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- *        Remove all hardcode string to En.rc  
+ *        Move all hardcoded strings to En.rc.
  */
 
 #include "precomp.h"
@@ -30,9 +29,9 @@
 static VOID ColorHelp (VOID)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_COLOR_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPuts (szMsg);
 
+       LoadString(GetModuleHandle(NULL), STRING_COLOR_HELP1, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPuts(szMsg);
 }
 
 
@@ -45,24 +44,24 @@ VOID SetScreenColor (WORD wColor, BOOL bFill)
 
        if ((wColor & 0xF) == (wColor &0xF0) >> 4)
        {
-           LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-           ConErrPuts (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_COLOR_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPuts(szMsg);
        }
-       else 
+       else
        {
-           if (bFill == TRUE)
-           {
-               GetConsoleScreenBufferInfo (hConsole, &csbi);
-
-               coPos.X = 0;
-               coPos.Y = 0;
-               FillConsoleOutputAttribute (hConsole,
-                                           (WORD)(wColor & 0x00FF),
-                                           (csbi.dwSize.X)*(csbi.dwSize.Y),
-                                           coPos,
-                                           &dwWritten);
-           }
-           SetConsoleTextAttribute (hConsole, (WORD)(wColor & 0x00FF));
+               if (bFill == TRUE)
+               {
+                       GetConsoleScreenBufferInfo (hConsole, &csbi);
+
+                       coPos.X = 0;
+                       coPos.Y = 0;
+                       FillConsoleOutputAttribute (hConsole,
+                                                   (WORD)(wColor & 0x00FF),
+                                                   (csbi.dwSize.X)*(csbi.dwSize.Y),
+                                                   coPos,
+                                                   &dwWritten);
+               }
+               SetConsoleTextAttribute (hConsole, (WORD)(wColor & 0x00FF));
        }
 }
 
@@ -90,26 +89,26 @@ INT CommandColor (LPTSTR first, LPTSTR rest)
                return 0;
        }
 
-       if (StringToColor (&wColor, &rest) == FALSE)
+       if (StringToColor(&wColor, &rest) == FALSE)
        {
-               LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPuts (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_COLOR_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPuts(szMsg);
                return 1;
        }
 
-       LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConErrPrintf (szMsg, wColor);
+       LoadString(GetModuleHandle(NULL), STRING_COLOR_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+       ConErrPrintf(szMsg, wColor);
 
        if ((wColor & 0xF) == (wColor &0xF0) >> 4)
        {
-               LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR4, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPrintf (szMsg, wColor);           
+               LoadString(GetModuleHandle(NULL), STRING_COLOR_ERROR4, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf(szMsg, wColor);
                return 1;
        }
 
        /* set color */
-       SetScreenColor (wColor,
-                       (_tcsstr (rest,_T("/F")) || _tcsstr (rest,_T("/f"))));
+       SetScreenColor(wColor,
+                      (_tcsstr (rest,_T("/F")) || _tcsstr (rest,_T("/f"))));
 
        return 0;
 }
index 4066e2b..b9b31d6 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
  *  CONSOLE.C - console input/output functions.
  *
  *
@@ -211,11 +210,11 @@ VOID ConPrintf(LPTSTR szFormat, va_list arg_ptr, DWORD nStdHandle)
 
 VOID ConOutFormatMessage (DWORD MessageId, ...)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        DWORD ret;
        LPTSTR text;
        va_list arg_ptr;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
-       
+
        va_start (arg_ptr, MessageId);
        ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
               NULL,
@@ -233,8 +232,8 @@ VOID ConOutFormatMessage (DWORD MessageId, ...)
        }
        else
        {
-               LoadString( GetModuleHandle(NULL), STRING_CONSOLE_ERROR, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPrintf (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_CONSOLE_ERROR, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf(szMsg);
        }
 }
 
index cf8b860..01be1cf 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
  *  COPY.C -- copy internal command.
  *
  *
@@ -296,29 +295,26 @@ DeleteFileList (LPFILES f)
 static INT
 Overwrite (LPTSTR fn)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR inp[10];
        LPTSTR p;
-       
-       LPTSTR lpOptions;
-       TCHAR Options[3];
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
+       TCHAR szOptions[4];
 
-       LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, Options,sizeof(Options)/sizeof(TCHAR));
-       lpOptions = Options;
+       LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, szOptions, 4);
 
-       LoadString( GetModuleHandle(NULL), STRING_COPY_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-       ConOutPrintf (szMsg);
+       LoadString(GetModuleHandle(NULL), STRING_COPY_HELP1, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPrintf(szMsg);
        
-       ConInString (inp, 10);
-       ConOutPuts (_T(""));
+       ConInString(inp, 10);
+       ConOutPuts(_T(""));
 
        _tcsupr (inp);
        for (p = inp; _istspace (*p); p++)
                ;
 
-       if (*p != lpOptions[0] && *p != lpOptions[2])
+       if (*p != szOptions[0] && *p != szOptions[2])
                return 0;
-       if (*p == lpOptions[2])
+       if (*p == szOptions[2])
                return 2;
 
        return 1;
@@ -330,6 +326,7 @@ Overwrite (LPTSTR fn)
 
 int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        FILETIME srctime;
        HANDLE hFileSrc;
        HANDLE hFileDest;
@@ -339,7 +336,6 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags)
        DWORD  dwWritten;
        DWORD  i;
        BOOL   bEof = FALSE;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
 #ifdef _DEBUG
        DebugPrintf (_T("checking mode\n"));
@@ -351,8 +347,8 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags)
                                                   NULL, OPEN_EXISTING, 0, NULL);
        if (hFileSrc == INVALID_HANDLE_VALUE)
        {
-               LoadString( GetModuleHandle(NULL), STRING_COPY_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConErrPrintf (szMsg, source);
+               LoadString(GetModuleHandle(NULL), STRING_COPY_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf(szMsg, source);
                return 0;
        }
 
@@ -379,8 +375,8 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags)
        {
                if (!_tcscmp (dest, source))
                {
-                       LoadString( GetModuleHandle(NULL), STRING_COPY_ERROR2, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                       ConErrPrintf (szMsg, source);
+                       LoadString(GetModuleHandle(NULL), STRING_COPY_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+                       ConErrPrintf(szMsg, source);
                        
                        CloseHandle (hFileSrc);
                        return 0;
@@ -456,8 +452,8 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags)
                if (dwWritten != dwRead)
                {
                        
-                       LoadString( GetModuleHandle(NULL), STRING_COPY_ERROR3, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                       ConErrPrintf (szMsg);
+                       LoadString(GetModuleHandle(NULL), STRING_COPY_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+                       ConErrPrintf(szMsg);
 
                        free (buffer);
                        CloseHandle (hFileDest);
@@ -633,12 +629,12 @@ SetupCopy (LPFILES sources, TCHAR **p, BOOL bMultiple,
 
 INT cmd_copy (LPTSTR first, LPTSTR rest)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR **p;
        TCHAR drive_d[_MAX_DRIVE];
        TCHAR dir_d[_MAX_DIR];
        TCHAR file_d[_MAX_FNAME];
        TCHAR ext_d[_MAX_EXT];
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        int argc;
        int append;
@@ -655,8 +651,8 @@ INT cmd_copy (LPTSTR first, LPTSTR rest)
 
        if (!_tcsncmp (rest, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_COPY_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPuts (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_COPY_HELP2, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 1;
        }
 
@@ -728,8 +724,8 @@ INT cmd_copy (LPTSTR first, LPTSTR rest)
        }
        else if (bDestFound && bWildcards)
        {
-               LoadString( GetModuleHandle(NULL), STRING_COPY_ERROR4, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConErrPrintf (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_COPY_ERROR4, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf(szMsg);
 
                DeleteFileList (sources);
                freep (p);
index 739027e..3bffcbd 100644 (file)
@@ -53,18 +53,18 @@ PrintDateString (VOID)
        {
                case 0: /* mmddyy */
                default:
-                       LoadString( GetModuleHandle(NULL), STRING_DATE_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                       ConOutPrintf (szMsg, cDateSeparator, cDateSeparator);
+                       LoadString(GetModuleHandle(NULL), STRING_DATE_HELP1, szMsg, RC_STRING_MAX_SIZE);
+                       ConOutPrintf(szMsg, cDateSeparator, cDateSeparator);
                        break;
 
                case 1: /* ddmmyy */
-                       LoadString( GetModuleHandle(NULL), STRING_DATE_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                       ConOutPrintf (szMsg, cDateSeparator, cDateSeparator);
+                       LoadString(GetModuleHandle(NULL), STRING_DATE_HELP2, szMsg, RC_STRING_MAX_SIZE);
+                       ConOutPrintf(szMsg, cDateSeparator, cDateSeparator);
                        break;
 
                case 2: /* yymmdd */
-                       LoadString( GetModuleHandle(NULL), STRING_DATE_HELP3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                       ConOutPrintf (szMsg, cDateSeparator, cDateSeparator);
+                       LoadString(GetModuleHandle(NULL), STRING_DATE_HELP3, szMsg, RC_STRING_MAX_SIZE);
+                       ConOutPrintf(szMsg, cDateSeparator, cDateSeparator);
                        break;
        }
 }
@@ -157,7 +157,7 @@ ParseDate (LPTSTR s)
                        break;
        }
 
-    /* if only entered two digits: */
+       /* if only entered two digits: */
        /*   assume 2000's if value less than 80 */
        /*   assume 1900's if value greater or equal 80 */
        if (d.wYear <= 99)
@@ -184,17 +184,17 @@ ParseDate (LPTSTR s)
 
 INT cmd_date (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        LPTSTR *arg;
        INT    argc;
        INT    i;
        BOOL   bPrompt = TRUE;
        INT    nDateString = -1;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_DATE_HELP4, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts ((LPTSTR)szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_DATE_HELP4, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -247,14 +247,15 @@ INT cmd_date (LPTSTR cmd, LPTSTR param)
                        freep (arg);
                        return 0;
                }
-               LoadString( GetModuleHandle(NULL), STRING_DATE_ERROR, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPuts (szMsg);
-               
+
+               LoadString(GetModuleHandle(NULL), STRING_DATE_ERROR, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPuts(szMsg);
        }
 
        freep (arg);
 
        return 0;
 }
-#endif
+#endif /* INCLUDE_CMD_DATE */
 
+/* EOF */
index dc43140..09cf6fc 100644 (file)
@@ -96,6 +96,7 @@ RemoveFile (LPTSTR lpFileName, DWORD dwFlags)
 
 INT CommandDelete (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR szFullPath[MAX_PATH];
        LPTSTR pFilePart;
        LPTSTR *arg = NULL;
@@ -105,29 +106,14 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
        INT   nEvalArgs = 0; /* nunber of evaluated arguments */
        DWORD dwFlags = 0;
        DWORD dwFiles = 0;
-
        HANDLE hFile;
        WIN32_FIND_DATA f;
-
-       LPTSTR lpOptions;
-       TCHAR Options[11];
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
        LONG ch;
-       
-       
-
-       LoadString( GetModuleHandle(NULL), STRING_DEL_OPTION, Options,sizeof(Options)/sizeof(TCHAR));
-        lpOptions = Options;
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_DEL_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPrintf (szMsg,
-                             lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions[9],lpOptions[10],
-                              lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions[9],lpOptions[10],
-                             lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions[9],lpOptions[10],
-                              lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions[9],lpOptions[10]                                           
-                                          );                   
+               LoadString(GetModuleHandle(NULL), STRING_DEL_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPrintf(szMsg);
                return 0;
        }
 
@@ -142,49 +128,39 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
                        {
                                if (_tcslen (arg[i]) >= 2)
                                {
-                                       
-                                 ch =  _totupper (arg[i][1]);
-                                                                 
-                  if (_totupper (lpOptions[2]) == ch)
-                                    {
-                      dwFlags |= DEL_NOTHING;
-                                        }
-
-                                 else if (_totupper (lpOptions[3]) == ch)
-                                    {
-                     dwFlags |= DEL_PROMPT;
-                                        }
-                 
-                                 else if (_totupper (lpOptions[4]) == ch)
-                                    {
-                      dwFlags |= DEL_QUIET;
-                                        }
-
-                                 else if (_totupper (lpOptions[5]) == ch)
-                                    {
-                      dwFlags |= DEL_SUBDIR;
-                                        }
-
-                                 else if (_totupper (lpOptions[6]) == ch)
-                                    {
-                      dwFlags |= DEL_TOTAL;
-                                        }
-
-                                 else if (_totupper (lpOptions[7]) == ch)
-                                    {
-                      dwFlags |= DEL_WIPE;
-                                        }
-
-                  else if (_totupper (lpOptions[9]) == ch)
-                                    {
-                      dwFlags |= DEL_YES;
-                                        }
-
-                                 else if (_totupper (lpOptions[10]) == ch)
-                                    {
-                      dwFlags |= DEL_ZAP;
-                                        }                              
-
+                                       ch = _totupper (arg[i][1]);
+                                       if (ch == _T('N'))
+                                       {
+                                               dwFlags |= DEL_NOTHING;
+                                       }
+                                       else if (ch == _T('P'))
+                                       {
+                                               dwFlags |= DEL_PROMPT;
+                                       }
+                                       else if (ch == _T('Q'))
+                                       {
+                                               dwFlags |= DEL_QUIET;
+                                       }
+                                       else if (ch == _T('S'))
+                                       {
+                                               dwFlags |= DEL_SUBDIR;
+                                       }
+                                       else if (ch == _T('T'))
+                                       {
+                                               dwFlags |= DEL_TOTAL;
+                                       }
+                                       else if (ch == _T('W'))
+                                       {
+                                               dwFlags |= DEL_WIPE;
+                                       }
+                                       else if (ch == _T('Y'))
+                                       {
+                                               dwFlags |= DEL_YES;
+                                       }
+                                       else if (ch == _T('Z'))
+                                       {
+                                               dwFlags |= DEL_ZAP;
+                                       }
                                }
 
                                nEvalArgs++;
@@ -211,11 +187,9 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
                        {
                                if (!((dwFlags & DEL_YES) || (dwFlags & DEL_QUIET) || (dwFlags & DEL_PROMPT)))
                                {
-                                       
-                                       LoadString( GetModuleHandle(NULL), STRING_DEL_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));
+                                       LoadString( GetModuleHandle(NULL), STRING_DEL_HELP2, szMsg, RC_STRING_MAX_SIZE);
 
                                        res = FilePromptYN (szMsg);
-
                                        if ((res == PROMPT_NO) || (res == PROMPT_BREAK))
                                                break;
                                }
@@ -231,8 +205,7 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
                                {
                                        /* wildcards in filespec */
 #ifdef _DEBUG
-                                       LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                                       ConErrPrintf ((LPTSTR)szMsg);
+                                       ConErrPrintf(_T("Wildcards!\n\n"));
 #endif
 
                                        GetFullPathName (arg[i],
@@ -241,12 +214,8 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
                                                         &pFilePart);
 
 #ifdef _DEBUG
-                                       LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR2, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                                       ConErrPrintf (szMsg, szFullPath);
-
-                                       LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR3, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                                       ConErrPrintf (pFilePart);
-                                       
+                                       ConErrPrintf(_T("Full path: %s\n"), szFullPath);
+                                       ConErrPrintf(_T("File part: %s\n"), pFilePart);
 #endif
 
                                        hFile = FindFirstFile (szFullPath, &f);
@@ -268,18 +237,17 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
                                                _tcscpy (pFilePart, f.cFileName);
 
 #ifdef _DEBUG
-                                               LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR4, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                                               ConErrPrintf (szMsg);
-
+                                               ConErrPrintf(_T("Full filename: %s\n"), szFullPath);
 #endif
+
                                                /* ask for deleting */
                                                if (dwFlags & DEL_PROMPT) 
-                                               {                                                       
-                                                       LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR5, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                                                       ConErrPrintf (szFullPath);
+                                               {
+                                                       LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR5, szMsg, RC_STRING_MAX_SIZE);
+                                                       ConErrPrintf(szMsg, szFullPath);
                                                        
-                                                       LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR6, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                                                       res = FilePromptYN (szMsg);
+                                                       LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR6, szMsg, RC_STRING_MAX_SIZE);
+                                                       res = FilePromptYN ((LPTSTR)szMsg);
 
                                                        if ((res == PROMPT_NO) || (res == PROMPT_BREAK))
                                                        {
@@ -289,8 +257,8 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
 
                                                if (!(dwFlags & DEL_QUIET) && !(dwFlags & DEL_TOTAL))
                                                {
-                                                       LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR7, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                                                       ConErrPrintf (szMsg, szFullPath);                                                               
+                                                       LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR7, szMsg, RC_STRING_MAX_SIZE);
+                                                       ConErrPrintf(szMsg, szFullPath);
                                                }
 
                                                /* delete the file */
@@ -334,22 +302,22 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
                                {
                                        /* no wildcards in filespec */
 #ifdef _DEBUG
-                                       LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR8, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                                       ConErrPrintf (szMsg);
+                                       ConErrPrintf(_T("No Wildcards!\n"));
 #endif
                                        GetFullPathName (arg[i],
                                                         MAX_PATH,
                                                         szFullPath,
                                                         &pFilePart);
 
-                                       /*ask for deleting */
-                                       if((dwFlags & DEL_PROMPT) && (FindFirstFile(szFullPath, &f) != INVALID_HANDLE_VALUE)) //Don't ask if the file doesn't exist, the following code will make the error-msg 
+                                       /* ask for deleting */
+                                       // Don't ask if the file doesn't exist, the following code will make the error-msg
+                                       if((dwFlags & DEL_PROMPT) && (FindFirstFile(szFullPath, &f) != INVALID_HANDLE_VALUE))
                                        {
-                                               LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR5, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                                               ConErrPrintf (szMsg, szFullPath);
-                                               
-                                               LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR6, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                                               res = FilePromptYN (szMsg);
+                                               LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR5, szMsg, RC_STRING_MAX_SIZE);
+                                               ConErrPrintf(szMsg, szFullPath);
+
+                                               LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR6, szMsg, RC_STRING_MAX_SIZE);
+                                               res = FilePromptYN ((LPTSTR)szMsg);
 
                                                if ((res == PROMPT_NO) || (res == PROMPT_BREAK))
                                                {
@@ -358,13 +326,12 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
                                        }
 
 #ifdef _DEBUG
-                                       LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR3, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                                       ConErrPrintf (szMsg, szFullPath);
+                                       ConErrPrintf(_T("Full path: %s\n"), szFullPath);
 #endif
                                        if (!(dwFlags & DEL_QUIET) && !(dwFlags & DEL_TOTAL))
                                        {
-                                               LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR7, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                                               ConErrPrintf (szMsg, szFullPath);
+                                               LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR7, szMsg, RC_STRING_MAX_SIZE);
+                                               ConErrPrintf(szMsg, szFullPath);
                                        }
 
                                        if (!(dwFlags & DEL_NOTHING))
@@ -417,14 +384,14 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
        {
                if (dwFiles < 2)
                {
-                       LoadString( GetModuleHandle(NULL), STRING_DEL_HELP3, szMsg,sizeof(szMsg)/sizeof(TCHAR));
+                       LoadString(GetModuleHandle(NULL), STRING_DEL_HELP3, szMsg, RC_STRING_MAX_SIZE);
                }
                else
                {
-                       LoadString( GetModuleHandle(NULL), STRING_DEL_HELP4, szMsg,sizeof(szMsg)/sizeof(TCHAR));
+                       LoadString(GetModuleHandle(NULL), STRING_DEL_HELP4, szMsg, RC_STRING_MAX_SIZE);
                }
-               
-               ConOutPrintf (szMsg, dwFiles);                  
+
+               ConOutPrintf(szMsg, dwFiles);
        }
 
        return 0;
index 8240e38..00c2fe8 100644 (file)
 
 INT CommandDelay (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        DWORD val;
        DWORD mul=1000;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        if (_tcsncmp (param, _T("/?"), 2) == 0)
        {
-           LoadString( GetModuleHandle(NULL), STRING_DELAY_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-           ConOutPuts (szMsg);
-       
-           return 0;
+               LoadString(GetModuleHandle(NULL), STRING_DELAY_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
+               return 0;
        }
 
        if (*param==0)
@@ -42,7 +41,7 @@ INT CommandDelay (LPTSTR cmd, LPTSTR param)
        }
 
        val = _ttoi(param);
-       Sleep(val*mul);
+       Sleep(val * mul);
 
        return 0;
 }
index d960180..efab42b 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
  *  DIR.C - dir internal command.
  *
  *
  *        dir /s now works in deeper trees
  *
  *    28-Jan-2004 (Michael Fritscher <michael@fritscher.net>)
- *        Fix for /p, so it is working under Windows in GUI-mode, too. 
+ *        Fix for /p, so it is working under Windows in GUI-mode, too.
  *
  *    30-Apr-2004 (Filip Navara <xnavara@volny.cz>)
  *        Fix /w to print long names.
  *        the ros dir very similar to windows dir. Major part of
  *        the code is rewritten. /p is removed, to be rewriten in
  *        the main cmd code.
- *        
+ *
  */
 
 #include "precomp.h"
@@ -154,7 +153,7 @@ enum EOrderBy
 };
 
 /* The struct for holding the switches */
-typedef struct TDirSwitchesFlags
+typedef struct _DirSwitchesFlags
 {
        BOOL bBareFormat;       /* Bare Format */
        BOOL bTSeperator;       /* Thousands seperator */
@@ -188,7 +187,15 @@ typedef struct TDirSwitchesFlags
                BOOL bUnSet;                            /* A helper flag if "-" was given with the switch */
                BOOL bParSetted;                        /* A helper flag if parameters of switch were given */
        } stTimeField;          /* The time field to display or use for sorting */
-}DIRSWITCHFLAGS, * LPDIRSWITCHFLAGS;
+} DIRSWITCHFLAGS, *LPDIRSWITCHFLAGS;
+
+
+typedef struct _DIRFINDLISTNODE
+{
+  WIN32_FIND_DATA stFindInfo;
+  struct _DIRFINDLISTNODE *ptrNext;
+} DIRFINDLISTNODE, *PDIRFINDLISTNODE;
+
 
 typedef BOOL STDCALL
 (*PGETFREEDISKSPACEEX)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
@@ -207,12 +214,11 @@ static ULARGE_INTEGER recurse_bytes;
  * displays help screen for dir
  * Rob Lake
  */
-static VOID
-       DirHelp (VOID)
+static VOID DirHelp(VOID)
 {
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_DIR_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-       ConOutPuts (szMsg);
+  TCHAR szMsg[RC_STRING_MAX_SIZE];
+  LoadString(GetModuleHandle(NULL), STRING_DIR_HELP1, szMsg, RC_STRING_MAX_SIZE);
+  ConOutPuts(szMsg);
 }
 
 
@@ -222,19 +228,18 @@ static VOID
  *
  * Parse the parameters and switches of the command line and exports them
  */
-static BOOL 
-DirReadParam (LPTSTR line,                             /* [IN] The line with the parameters & switches */
-                         LPTSTR *param,                        /* [OUT] The parameters after parsing */
-                         LPDIRSWITCHFLAGS lpFlags      /* [IN/OUT] The flags after calculating switches */
-                         )
+static BOOL
+DirReadParam(LPTSTR Line,                              /* [IN] The line with the parameters & switches */
+            LPTSTR *param,                     /* [OUT] The parameters after parsing */
+            LPDIRSWITCHFLAGS lpFlags)  /* [IN/OUT] The flags after calculating switches */
 {
-       TCHAR cCurSwitch;       /* The current switch */
-       TCHAR cCurChar;         /* Current examing character */
-       TCHAR cCurUChar;        /* Current upper examing character */
-       BOOL bNegative;         /* Negative switch */
-       BOOL bPNegative;        /* Negative switch parameter */
-       BOOL bIntoQuotes;       /* A flag showing if we are in quotes (") */
-       LPTSTR ptrLast;         /* A pointer to the last character of param */
+  TCHAR cCurSwitch;    /* The current switch */
+  TCHAR cCurChar;      /* Current examing character */
+  TCHAR cCurUChar;     /* Current upper examing character */
+  BOOL bNegative;      /* Negative switch */
+  BOOL bPNegative;     /* Negative switch parameter */
+  BOOL bIntoQuotes;    /* A flag showing if we are in quotes (") */
+  LPTSTR ptrLast;      /* A pointer to the last character of param */
 
        /* Initialize variables; */
        cCurSwitch = _T(' ');
@@ -255,18 +260,18 @@ DirReadParam (LPTSTR line,                                /* [IN] The line with the parameters & switches */
 
        /* Main Loop (see README_DIR.txt) */
        /* scan the command line char per char, and we process its char */
-       while (*line)
+       while (*Line)
        {
                /* we save current character as it is and its upper case */
-               cCurChar = *line;
-               cCurUChar = _toupper(*line);
+               cCurChar = *Line;
+               cCurUChar = _toupper(*Line);
                
                /* 1st section (see README_DIR.txt) */
                /* When a switch is expecting */
                if (cCurSwitch == _T('/'))
                {
                        if ((cCurUChar == _T('A')) ||(cCurUChar == _T('T')) || (cCurUChar == _T('O')))
-                       {                       
+                       {
                                cCurSwitch = cCurUChar;
                                switch (cCurUChar)
                                {
@@ -284,38 +289,40 @@ DirReadParam (LPTSTR line,                                /* [IN] The line with the parameters & switches */
                                        break;
                                }
                        }
-                       else if (cCurUChar ==  _T('L'))
+                       else if (cCurUChar == _T('L'))
                                lpFlags->bLowerCase = ! bNegative;
-                       else if (cCurUChar ==  _T('B'))                 
+                       else if (cCurUChar == _T('B'))
                                lpFlags->bBareFormat = ! bNegative;
-                       else if (cCurUChar ==  _T('C'))
+                       else if (cCurUChar == _T('C'))
                                lpFlags->bTSeperator = ! bNegative;
-                       else if (cCurUChar ==  _T('W'))
-                               lpFlags->bWideList = ! bNegative;                               
-                       else if (cCurUChar ==  _T('D'))
-                               lpFlags->bWideListColSort = ! bNegative;                                
-                       else if (cCurUChar ==  _T('N'))
+                       else if (cCurUChar == _T('W'))
+                               lpFlags->bWideList = ! bNegative;
+                       else if (cCurUChar == _T('D'))
+                               lpFlags->bWideListColSort = ! bNegative;
+                       else if (cCurUChar == _T('N'))
                                lpFlags->bNewLongList = ! bNegative;
-                       else if (cCurUChar ==  _T('P'))
+                       else if (cCurUChar == _T('P'))
                                lpFlags->bPause = ! bNegative;
-                       else if (cCurUChar ==  _T('Q'))
+                       else if (cCurUChar == _T('Q'))
                                lpFlags->bUser = ! bNegative;
-                       else if (cCurUChar ==  _T('S'))
+                       else if (cCurUChar == _T('S'))
                                lpFlags->bRecursive = ! bNegative;
-                       else if (cCurUChar ==  _T('X'))
+                       else if (cCurUChar == _T('X'))
                                lpFlags->bShortName = ! bNegative;
                        else if (cCurChar == _T('4'))
                                lpFlags->b4Digit = ! bNegative;
-                       else if (cCurChar ==  _T('?'))
+                       else if (cCurChar == _T('?'))
                        {
                                DirHelp();
-                               return FALSE;                
+                               return FALSE;
                        }
                        else if (cCurChar ==  _T('-'))
+                       {
                                bNegative = TRUE;
-                       else 
+                       }
+                       else
                        {
-                               error_invalid_switch ((TCHAR)_totupper (*line));
+                               error_invalid_switch ((TCHAR)_totupper (*Line));
                                return FALSE;
                        }
 
@@ -328,10 +335,11 @@ DirReadParam (LPTSTR line,                                /* [IN] The line with the parameters & switches */
                                cCurSwitch = _T(' ');
 
                }
-               /* 2nd section (see README_DIR.txt) */
-               /* We are expecting parameter or the unknown */
                else if ((cCurSwitch == _T(' ')) || (cCurSwitch == _T('P')))
                {
+                       /* 2nd section (see README_DIR.txt) */
+                       /* We are expecting parameter or the unknown */
+
                        if (cCurChar == _T('/'))
                                cCurSwitch = _T('/');
 
@@ -342,34 +350,34 @@ DirReadParam (LPTSTR line,                                /* [IN] The line with the parameters & switches */
                                {
                                        cCurSwitch = _T(' ');
                                        if ((*param) && !(ptrLast))
-                                               ptrLast = line;
-                               }                               
-                                       
+                                               ptrLast = Line;
+                               }
+
                        }
-                       /* Process a quote */
                        else if (cCurChar == _T('\"'))
                        {
+                               /* Process a quote */
                                bIntoQuotes = !bIntoQuotes;
-                               if (!bIntoQuotes) ptrLast = line;
+                               if (!bIntoQuotes) ptrLast = Line;
                        }
-                       /* Process a character for parameter */
-                       else                    
+                       else
                        {
+                               /* Process a character for parameter */
                                if ((cCurSwitch == _T(' ')) && (*param))
                                {
-                                       error_too_many_parameters(line);
+                                       error_too_many_parameters(Line);
                                        return FALSE;
                                }
                                cCurSwitch = _T('P');
                                if (!(*param))
-                                       *param = line;
+                                       *param = Line;
                        }
-
                }
-               /* 3rd section (see README_DIR.txt) */
-               /* We are waiting for switch parameters */
                else
                {
+                       /* 3rd section (see README_DIR.txt) */
+                       /* We are waiting for switch parameters */
+
                        /* Check if there are no more switch parameters */
                        if ((cCurChar == _T('/')) || ( cCurChar == _T(' ')))
                        {
@@ -431,7 +439,7 @@ DirReadParam (LPTSTR line,                          /* [IN] The line with the parameters & switches */
                                }
                                else
                                {
-                                       error_parameter_format((TCHAR)_totupper (*line));
+                                       error_parameter_format((TCHAR)_totupper (*Line));
                                        return FALSE;
                                }
                                break;
@@ -451,7 +459,7 @@ DirReadParam (LPTSTR line,                          /* [IN] The line with the parameters & switches */
                                        lpFlags->stTimeField.eTimeField= TF_MODIFIEDDATE  ;
                                else
                                {
-                                       error_parameter_format((TCHAR)_totupper (*line));
+                                       error_parameter_format((TCHAR)_totupper (*Line));
                                        return FALSE;
                                }
                                break;
@@ -497,7 +505,7 @@ DirReadParam (LPTSTR line,                          /* [IN] The line with the parameters & switches */
 
                                else
                                {
-                                       error_parameter_format((TCHAR)_totupper (*line));
+                                       error_parameter_format((TCHAR)_totupper (*Line));
                                        return FALSE;
                                }
 
@@ -508,7 +516,7 @@ DirReadParam (LPTSTR line,                          /* [IN] The line with the parameters & switches */
                                bPNegative = FALSE;
                }
        
-               line++;
+               Line++;
        }
        /* Terminate the parameters */
        if (ptrLast) *ptrLast = 0;
@@ -548,6 +556,7 @@ DirReadParam (LPTSTR line,                          /* [IN] The line with the parameters & switches */
        return TRUE;
 }
 
+
 /*
  * ExtendFilespec
  *
@@ -691,7 +700,6 @@ DirParsePathspec (LPTSTR szPathspec, LPTSTR szPath, LPTSTR szFilespec)
        }
        else
        {
-    
                *tmp = _T('\0');
 
                /* change to this directory */
@@ -704,7 +712,8 @@ DirParsePathspec (LPTSTR szPathspec, LPTSTR szPath, LPTSTR szFilespec)
                        return 1;
                }
        }
-        /* get the full name of the directory */
+
+       /* get the full name of the directory */
        if (!GetCurrentDirectory (MAX_PATH, szPath))
        {
                *tmp = _T('\\');
@@ -726,32 +735,35 @@ DirParsePathspec (LPTSTR szPathspec, LPTSTR szPath, LPTSTR szFilespec)
  * incline
  *
  * increment our line if paginating, display message at end of screen
- *//*Maybe needed in future
+ */
+#if 0
 static BOOL
 IncLine (LPINT pLine, LPDIRSWITCHFLAGS lpFlags)
 {
-       BOOL error;
+       BOOL bError;
        CONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo;
        LONG WindowHeight;
-       error = GetConsoleScreenBufferInfo(hConsole, &lpConsoleScreenBufferInfo);
-       
-       WindowHeight= lpConsoleScreenBufferInfo.srWindow.Bottom - lpConsoleScreenBufferInfo.srWindow.Top;
 
-       //That prevents bad behave if WindowHeight couln't calc 
-       if (!WindowHeight)  
+       bError = GetConsoleScreenBufferInfo(hConsole, &lpConsoleScreenBufferInfo);
+
+       WindowHeight = lpConsoleScreenBufferInfo.srWindow.Bottom - lpConsoleScreenBufferInfo.srWindow.Top;
+
+       /* That prevents bad behiour if WindowHeight could not be calculated */
+       if (!WindowHeight)
        {
                 WindowHeight= 1000000;
        }
+
        if (!(lpFlags->bPause))
                return FALSE;
 
        (*pLine)++;
 
-       // Because I don't know if WindowsHeight
-          work under all cases, perhaps then maxy
-          is the right value 
-   
-       if (*pLine >= (int)maxy - 2 || *pLine >= WindowHeight) 
+       /*
+        * Because I don't know if WindowsHeight work in all cases,
+        * perhaps then maxy is the right value
+        */
+       if (*pLine >= (int)maxy - 2 || *pLine >= WindowHeight)
        {
                *pLine = 0;
                return (PagePrompt () == PROMPT_BREAK);
@@ -759,7 +771,7 @@ IncLine (LPINT pLine, LPDIRSWITCHFLAGS lpFlags)
 
        return FALSE;
 }
-*/
+#endif
 
 /*
  * PrintDirectoryHeader
@@ -767,16 +779,16 @@ IncLine (LPINT pLine, LPDIRSWITCHFLAGS lpFlags)
  * print the header for the dir command
  */
 static BOOL
-PrintDirectoryHeader (LPTSTR szPath, LPINT pLine, LPDIRSWITCHFLAGS lpFlags)
+PrintDirectoryHeader(LPTSTR szPath, LPINT pLine, LPDIRSWITCHFLAGS lpFlags)
 {
+  TCHAR szMsg[RC_STRING_MAX_SIZE];
   TCHAR szRootName[MAX_PATH];
   TCHAR szVolName[80];
   DWORD dwSerialNr;
   LPTSTR p;
-  TCHAR szMsg[RC_STRING_MAX_SIZE];
 
   if (lpFlags->bBareFormat)
-    return(TRUE);
+    return TRUE;
 
   /* build usable root path */
   if (szPath[1] == _T(':') && szPath[2] == _T('\\'))
@@ -825,29 +837,24 @@ PrintDirectoryHeader (LPTSTR szPath, LPINT pLine, LPDIRSWITCHFLAGS lpFlags)
     }
 
   /* print drive info */
-   
   if (szVolName[0] != _T('\0'))
-     {
-           LoadString( GetModuleHandle(NULL), STRING_DIR_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-           ConOutPrintf (szMsg, szRootName[0], szVolName);
-     }
+    {
+      LoadString(GetModuleHandle(NULL), STRING_DIR_HELP2, szMsg, RC_STRING_MAX_SIZE);
+      ConOutPrintf((LPTSTR)szMsg, szRootName[0], szVolName);
+    }
   else
-     {
-           LoadString( GetModuleHandle(NULL), STRING_DIR_HELP3, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-           ConOutPrintf (szMsg, szRootName[0]);
-     }
-
-  
-
+    {
+      LoadString(GetModuleHandle(NULL), STRING_DIR_HELP3, szMsg, RC_STRING_MAX_SIZE);
+      ConOutPrintf(szMsg, szRootName[0]);
+    }
 
   /* print the volume serial number if the return was successful */
-        
-  LoadString( GetModuleHandle(NULL), STRING_DIR_HELP4, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-  ConOutPrintf (szMsg,
-                   HIWORD(dwSerialNr),
-                   LOWORD(dwSerialNr));
+  LoadString(GetModuleHandle(NULL), STRING_DIR_HELP4, (LPTSTR) szMsg, RC_STRING_MAX_SIZE);
+  ConOutPrintf((LPTSTR)szMsg,
+               HIWORD(dwSerialNr),
+               LOWORD(dwSerialNr));
 
-  return(TRUE);
+  return TRUE;
 }
 
 
@@ -855,7 +862,9 @@ PrintDirectoryHeader (LPTSTR szPath, LPINT pLine, LPDIRSWITCHFLAGS lpFlags)
  * convert
  *
  * insert commas into a number
- *//* Maybe needed in future
+ *
+ */
+#if 0
 static INT
 ConvertULong (ULONG num, LPTSTR des, INT len)
 {
@@ -886,7 +895,7 @@ ConvertULong (ULONG num, LPTSTR des, INT len)
 
        return n;
 }
-*/
+#endif
 
 static INT
 ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len, BOOL bPutSeperator)
@@ -921,10 +930,10 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len, BOOL bPutSeperato
 
 
 static VOID
-DirPrintFileDateTime (TCHAR * lpDate,
-                                         TCHAR * lpTime,
-                                         LPWIN32_FIND_DATA lpFile,
-                                         LPDIRSWITCHFLAGS lpFlags)
+DirPrintFileDateTime(TCHAR *lpDate,
+                     TCHAR *lpTime,
+                     LPWIN32_FIND_DATA lpFile,
+                     LPDIRSWITCHFLAGS lpFlags)
 {
        FILETIME ft;
        SYSTEMTIME dt;
@@ -935,21 +944,23 @@ DirPrintFileDateTime (TCHAR * lpDate,
        /* Select the right time field */
        switch (lpFlags->stTimeField.eTimeField)
        {
-       case TF_CREATIONDATE:
-               if (!FileTimeToLocalFileTime(&lpFile->ftCreationTime, &ft))
-                       return;
-               FileTimeToSystemTime(&ft, &dt);         
-               break;
-       case TF_LASTACCESSEDDATE :
-               if (!FileTimeToLocalFileTime(&lpFile->ftLastAccessTime, &ft))
-                       return;
-               FileTimeToSystemTime(&ft, &dt);         
-               break;
-       case TF_MODIFIEDDATE:
-               if (!FileTimeToLocalFileTime(&lpFile->ftLastWriteTime, &ft))
-                       return;
-               FileTimeToSystemTime(&ft, &dt);         
-               break;
+               case TF_CREATIONDATE:
+                       if (!FileTimeToLocalFileTime(&lpFile->ftCreationTime, &ft))
+                               return;
+                       FileTimeToSystemTime(&ft, &dt);
+                       break;
+
+               case TF_LASTACCESSEDDATE :
+                       if (!FileTimeToLocalFileTime(&lpFile->ftLastAccessTime, &ft))
+                               return;
+                       FileTimeToSystemTime(&ft, &dt);
+                       break;
+
+               case TF_MODIFIEDDATE:
+                       if (!FileTimeToLocalFileTime(&lpFile->ftLastWriteTime, &ft))
+                               return;
+                       FileTimeToSystemTime(&ft, &dt);
+                       break;
        }
 
        /* Format date */
@@ -958,7 +969,7 @@ DirPrintFileDateTime (TCHAR * lpDate,
        {
                case 0: /* mmddyy */
                default:
-                       _stprintf (szDate,_T("%02d%c%02d%c%0*d"),
+                       _stprintf (szDate, _T("%02d%c%02d%c%0*d"),
                                        dt.wMonth, cDateSeparator,
                                        dt.wDay, cDateSeparator,
                                        lpFlags->b4Digit?4:2, wYear);
@@ -984,7 +995,7 @@ DirPrintFileDateTime (TCHAR * lpDate,
                        _stprintf (szTime,_T("  %02d%c%02u%c"),
                                        (dt.wHour == 0 ? 12 : (dt.wHour <= 12 ? dt.wHour : dt.wHour - 12)),
                                        cTimeSeparator,
-                                        dt.wMinute, (dt.wHour <= 11 ? 'a' : 'p'));
+                                        dt.wMinute, (dt.wHour <= 11 ? _T('a') : _T('p')));
                        break;
 
                case 1: /* 24 hour format */
@@ -1053,10 +1064,10 @@ PrintSummary(LPTSTR szPath,
             LPINT pLine,
             LPDIRSWITCHFLAGS lpFlags)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR szBuffer[64];
        ULARGE_INTEGER uliFree;
        TCHAR szRoot[] = _T("A:\\");
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
 
        /* Here we check if we didn't find anything */
@@ -1065,6 +1076,7 @@ PrintSummary(LPTSTR szPath,
                error_file_not_found();
                return 1;
        }
+
        /* In bare format we don't print results */
        if (lpFlags->bBareFormat)
                return 0;
@@ -1072,20 +1084,20 @@ PrintSummary(LPTSTR szPath,
        /* Print recursive specific results */
        if (lpFlags->bRecursive)
        {
-               ConvertULargeInteger (u64Bytes, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator);
-               
-               LoadString( GetModuleHandle(NULL), STRING_DIR_HELP5, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPrintf (szMsg,ulFiles, szBuffer);
+               ConvertULargeInteger(u64Bytes, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator);
+
+               LoadString(GetModuleHandle(NULL), STRING_DIR_HELP5, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPrintf(szMsg,ulFiles, szBuffer);
        }
 
        /* Print total  directories and freespace */
        szRoot[0] = szPath[0];
        GetUserDiskFreeSpace(szRoot, &uliFree);
-       ConvertULargeInteger (uliFree, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator);
-       LoadString( GetModuleHandle(NULL), STRING_DIR_HELP6, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-       ConOutPrintf (szMsg,ulDirs, szBuffer);
+       ConvertULargeInteger(uliFree, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator);
+       LoadString(GetModuleHandle(NULL), STRING_DIR_HELP6, (LPTSTR) szMsg, RC_STRING_MAX_SIZE);
+       ConOutPrintf((LPTSTR)szMsg,ulDirs, szBuffer);
 
-  return 0;
+       return 0;
 }
 
 /*
@@ -1096,8 +1108,8 @@ PrintSummary(LPTSTR szPath,
 TCHAR* getExt(const TCHAR* file)
 {
        
-       TCHAR* tmp = _tcsrchr(file,_T('.'));
-       return tmp?tmp+1:_T("");
+       TCHAR* tmp = _tcsrchr(file, _T('.'));
+       return tmp?tmp+1:"";
 }
 
 /*
@@ -1105,23 +1117,23 @@ TCHAR* getExt(const TCHAR* file)
  *
  * Get the name of the file without extension
  */
-TCHAR * getName(const TCHAR* file, TCHAR * dest)
+static LPTSTR getName(const TCHAR* file, TCHAR * dest)
 {
-int iLen;
-TCHAR* end;
-       
+       int iLen;
+       LPTSTR end;
+
        /* Check for "." and ".." folders */
-       if ((_tcscmp(file, _T(".")) == 0)
-               || (_tcscmp(file, _T("..")) == 0))
+       if ((_tcscmp(file, _T(".")) == 0) ||
+           (_tcscmp(file, _T("..")) == 0))
        {
                _tcscpy(dest,file);
                return dest;
        }
 
-       end = _tcsrchr(file,'.');
+       end = _tcsrchr(file, _T('.'));
        if (!end)
-               iLen = _tcslen(file);   
-       else                    
+               iLen = _tcslen(file);
+       else
                iLen = (end - file);
        
 
@@ -1130,156 +1142,172 @@ TCHAR* end;
        
        return dest;
 }
+
+
 /*
  *  DirPrintNewList
  *
  * The function that prints in new style
  */
-static int
+static VOID
 DirPrintNewList(LPWIN32_FIND_DATA ptrFiles[],  /* [IN]Files' Info */
-                               DWORD dwCount,                                  /* [IN] The quantity of files */
-                               TCHAR * szCurPath,                              /* [IN] Full path of current directory */
-                               LPDIRSWITCHFLAGS lpFlags)               /* [IN] The flags used */
+               DWORD dwCount,                  /* [IN] The quantity of files */
+               TCHAR *szCurPath,               /* [IN] Full path of current directory */
+               LPDIRSWITCHFLAGS lpFlags)       /* [IN] The flags used */
 {
-DWORD i;                                               /* An indexer for "for"s */
-TCHAR szSize[30];                              /* The size of file */
-TCHAR szShortName[15];                 /* The sort name */
-TCHAR szDate[20], szTime[20];  /* Date and time strings */
-int iSizeFormat;                               /* The format of size field */
-ULARGE_INTEGER u64FileSize;            /* The file size */
+  DWORD i;
+  TCHAR szSize[30];
+  TCHAR szShortName[15];
+  TCHAR szDate[20];
+  TCHAR szTime[20];
+  INT iSizeFormat;
+  ULARGE_INTEGER u64FileSize;
+
+  for (i = 0;i < dwCount;i++)
+  {
+    /* Calculate size */
+    if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+    {
+      /* Directory */
+      iSizeFormat = -14;
+      _tcscpy(szSize, _T("<DIR>"));
+    }
+    else
+    {
+      /* File */
+      iSizeFormat = 14;
+      u64FileSize.HighPart = ptrFiles[i]->nFileSizeHigh;
+      u64FileSize.LowPart = ptrFiles[i]->nFileSizeLow;
+      ConvertULargeInteger(u64FileSize, szSize, 20, lpFlags->bTSeperator);
+    }
 
-       for(i = 0;i < dwCount;i++)
-       {
+    /* Calculate short name */
+    szShortName[0] = _T('\0');
+    if (lpFlags->bShortName)
+      _stprintf(szShortName, _T(" %-12s"), ptrFiles[i]->cAlternateFileName);
+
+    /* Format date and time */
+    DirPrintFileDateTime(szDate, szTime, ptrFiles[i], lpFlags);
+
+    /* Print the line */
+    ConOutPrintf(_T("%10s  %-8s    %*s%s %s\n"),
+                szDate,
+                szTime,
+                iSizeFormat,
+                szSize,
+                szShortName,
+                ptrFiles[i]->cFileName);
+  }
+}
 
-               /* Calculate size */            
-               if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
-               /* Directory */
-               {
-                       iSizeFormat = -14;
-                       _tcscpy(szSize, _T("<DIR>"));
-               }
-               else
-               /* File */
-               {
-                       iSizeFormat = 14;
-                       u64FileSize.HighPart = ptrFiles[i]->nFileSizeHigh;
-                       u64FileSize.LowPart = ptrFiles[i]->nFileSizeLow;
-                       ConvertULargeInteger(u64FileSize, szSize, 20,lpFlags->bTSeperator);
-               }
-               /* Calculate short name */
-               szShortName[0] = _T('\0');
-               if (lpFlags->bShortName)                
-                       _stprintf(szShortName,_T(" %-12s"), ptrFiles[i]->cAlternateFileName);
-               
-               /* Format date and time */
-               DirPrintFileDateTime(szDate,szTime,ptrFiles[i],lpFlags);
 
-               /* Print the line */
-               ConOutPrintf(_T("%10s  %-8s    %*s%s %s\n"),
-                       szDate,
-                       szTime,
-                       iSizeFormat,
-                       szSize,                 
-                       szShortName,
-                       ptrFiles[i]->cFileName );
-                       
-       }
-       return 0;
-}
 /*
  *  DirPrintWideList
  *
  * The function that prints in wide list
  */
-static int
+static VOID
 DirPrintWideList(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */
-                               DWORD dwCount,                                  /* [IN] The quantity of files */
-                               TCHAR * szCurPath,                              /* [IN] Full path of current directory */
-                               LPDIRSWITCHFLAGS lpFlags)               /* [IN] The flags used */
+                DWORD dwCount,                 /* [IN] The quantity of files */
+                TCHAR *szCurPath,              /* [IN] Full path of current directory */
+                LPDIRSWITCHFLAGS lpFlags)      /* [IN] The flags used */
 {
-DWORD i,j;                                             /* An indexer for "for"s */
-short iScreenWidth;                            /* The screen width */
-short iColumns;                                        /* The columns (used by wide list) */
-short iLines;                                  /* The lines (used by the wide list /d) */
-int iBiggestName;                              /* The biggest name, used for wide list */
-TCHAR szTempFname[MAX_PATH];   /* Temporary string */
-
-       /* Calculate biggest name */
-       iBiggestName = 1;
-       for(i = 0;i < dwCount;i++)
-       {
-               if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
-               {
-                       /* Directories need 2 additinal characters for brackets */
-                       if ((_tcslen(ptrFiles[i]->cFileName) + 2) > iBiggestName)
-                               iBiggestName = _tcslen(ptrFiles[i]->cFileName) + 2;
-               }
-               else
-               {
-                       if (_tcslen(ptrFiles[i]->cFileName)  > iBiggestName)
-                               iBiggestName = _tcslen(ptrFiles[i]->cFileName);
-               }
-       }
-               
-       /* Count the highest number of columns */
-       GetScreenSize(&iScreenWidth, 0);
-       iColumns = iScreenWidth / iBiggestName;
-
-       /* Check if there is enough space for spaces between names */
-       if (((iBiggestName * iColumns) + iColumns) >= iScreenWidth)
-               iColumns --;
-       /* A last check at iColumns to avoid division by zero */
-       if (!(iColumns)) iColumns = 1;
-
-       /* Print Column sorted */
-       if (lpFlags->bWideListColSort)
-       {
-               /* Calculate the lines that will be printed */                  
-               iLines = ceil((float)dwCount/(float)iColumns);
+  USHORT iScreenWidth;
+  USHORT iColumns;
+  USHORT iLines;
+  INT iLongestName;
+  TCHAR szTempFname[MAX_PATH];
+  DWORD i;
+  DWORD j;
+  DWORD temp;
+
+  /* Calculate longest name */
+  iLongestName = 1;
+  for (i = 0; i < dwCount; i++)
+  {
+    if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+    {
+      /* Directories need 2 additinal characters for brackets */
+      if ((_tcslen(ptrFiles[i]->cFileName) + 2) > iLongestName)
+        iLongestName = _tcslen(ptrFiles[i]->cFileName) + 2;
+    }
+    else
+    {
+      if (_tcslen(ptrFiles[i]->cFileName) > iLongestName)
+        iLongestName = _tcslen(ptrFiles[i]->cFileName);
+    }
+  }
 
-               for (i = 0;i < iLines;i++)
-               {
-                       for (j = 0;j < iColumns;j++)
-                       {
-                               DWORD temp = (j*iLines)+i;
-                               if (temp >= dwCount) break;
-                               if (ptrFiles[temp]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
-                                       _stprintf(szTempFname, _T("[%s]"), ptrFiles[temp]->cFileName);
-                               else
-                                       _stprintf(szTempFname, _T("%s"), ptrFiles[temp]->cFileName);
+  /* Count the highest number of columns */
+  GetScreenSize(&iScreenWidth, 0);
+  iColumns = iScreenWidth / iLongestName;
 
-                               ConOutPrintf(_T("%-*s"),iBiggestName + 1 , szTempFname );
-                       }                               
-                       ConOutPrintf(_T("\n"));
-               }
-       }
-       /* Print Line sorted */
-       else
-       {
-               for (i = 0;i < dwCount;i++)
-               {
-                       if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
-                               _stprintf(szTempFname, _T("[%s]"), ptrFiles[i]->cFileName);
-                       else
-                               _stprintf(szTempFname, _T("%s"), ptrFiles[i]->cFileName);
+  /* Check if there is enough space for spaces between names */
+  if (((iLongestName * iColumns) + iColumns) >= iScreenWidth)
+    iColumns --;
 
-                               ConOutPrintf(_T("%-*s"), iBiggestName + 1, szTempFname );
-                       /* We print a new line at the end of each column
-                          except for the case that it is the last item.*/
-                       if (!((i+1)%iColumns) && (i < (dwCount-1)))
-                               ConOutPrintf(_T("\n"));
-               }
-               /* Add a new line after the last item */
-               ConOutPrintf(_T("\n"));
-       }
-       return 0;
+  /* A last check at iColumns to avoid division by zero */
+  if (!(iColumns))
+    iColumns = 1;
+
+  /* Print Column sorted */
+  if (lpFlags->bWideListColSort)
+  {
+    /* Calculate the lines that will be printed */
+//    iLines = ceil((float)dwCount/(float)iColumns);
+    iLines = dwCount / iColumns;
+
+    for (i = 0;i < iLines;i++)
+    {
+      for (j = 0; j < iColumns; j++)
+      {
+        temp = (j * iLines) + i;
+        if (temp >= dwCount)
+           break;
+
+        if (ptrFiles[temp]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+          _stprintf(szTempFname, _T("[%s]"), ptrFiles[temp]->cFileName);
+        else
+          _stprintf(szTempFname, _T("%s"), ptrFiles[temp]->cFileName);
+
+        ConOutPrintf(_T("%-*s"), iLongestName + 1 , szTempFname);
+      }
+
+      ConOutPrintf(_T("\n"));
+    }
+  }
+  else
+  {
+    /* Print Line sorted */
+    for (i = 0; i < dwCount; i++)
+    {
+      if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+        _stprintf(szTempFname, _T("[%s]"), ptrFiles[i]->cFileName);
+      else
+        _stprintf(szTempFname, _T("%s"), ptrFiles[i]->cFileName);
+
+      ConOutPrintf(_T("%-*s"), iLongestName + 1, szTempFname );
+
+      /*
+       * We print a new line at the end of each column
+       * except for the case that it is the last item.
+       */
+      if (!((i + 1) % iColumns) && (i < (dwCount - 1)))
+        ConOutPrintf(_T("\n"));
+    }
+
+    /* Add a new line after the last item */
+    ConOutPrintf(_T("\n"));
+  }
 }
+
+
 /*
  *  DirPrintOldList
  *
  * The function that prints in old style
  */
-static int
+static VOID
 DirPrintOldList(LPWIN32_FIND_DATA ptrFiles[],  /* [IN] Files' Info */
                                DWORD dwCount,                                  /* [IN] The quantity of files */
                                TCHAR * szCurPath,                              /* [IN] Full path of current directory */
@@ -1337,7 +1365,6 @@ ULARGE_INTEGER u64FileSize;               /* The file size */
                        szDate,                 /* The date of file/dir */
                        szTime);                /* The time of file/dir */
        }
-       return 0;
 }
 
 /*
@@ -1345,90 +1372,93 @@ ULARGE_INTEGER u64FileSize;             /* The file size */
  *
  * The function that prints in bare format
  */
-static int
+static VOID
 DirPrintBareList(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */
-                               DWORD dwCount,                                  /* [IN] The quantity of files */
-                               TCHAR * szCurPath,                              /* [IN] Full path of current directory */
-                               LPDIRSWITCHFLAGS lpFlags)               /* [IN] The flags used */
+                DWORD dwCount,                 /* [IN] The number of files */
+                LPTSTR lpCurPath,              /* [IN] Full path of current directory */
+                LPDIRSWITCHFLAGS lpFlags)      /* [IN] The flags used */
 {
-DWORD i;                                               /* An indexer for "for"s */
-TCHAR szFullName[MAX_PATH];            /* The fullpath name of file */
-               
-       for(i = 0;i < dwCount;i++)
+       TCHAR szFullName[MAX_PATH];
+       DWORD i;
+
+       for (i = 0; i < dwCount; i++)
        {
                if ((_tcscmp(ptrFiles[i]->cFileName, _T(".")) == 0) ||
-                       (_tcscmp(ptrFiles[i]->cFileName, _T("..")) == 0))
+                   (_tcscmp(ptrFiles[i]->cFileName, _T("..")) == 0))
                {
-               /* at bare format we don't print "." and ".." folder */
+                       /* at bare format we don't print "." and ".." folder */
                        continue;
                }
-               /* at recursive mode we print full path of file */
                if (lpFlags->bRecursive)
                {
-                       _tcscpy(szFullName, szCurPath);
+                       /* at recursive mode we print full path of file */
+                       _tcscpy(szFullName, lpCurPath);
                        _tcscat(szFullName, ptrFiles[i]->cFileName);
-                       ConOutPrintf(_T("%s\n"), szFullName);
+                       ConOutPrintf("%s\n", szFullName);
                }
-               /* if we are not in recursive mode we print the file names */
                else
-                       ConOutPrintf(_T("%s\n"),ptrFiles[i]->cFileName);        
+               {
+                       /* if we are not in recursive mode we print the file names */
+                       ConOutPrintf("%s\n",ptrFiles[i]->cFileName);
+               }
        }
-       return 0;
 }
 
+
 /*
  * DirPrintFiles
  * 
  * The functions that prints the files list
  */
-static int
+static VOID
 DirPrintFiles(LPWIN32_FIND_DATA ptrFiles[],    /* [IN] Files' Info */
-                               DWORD dwCount,                          /* [IN] The quantity of files */
-                               TCHAR * szCurPath,                      /* [IN] Full path of current directory */
-                               LPDIRSWITCHFLAGS lpFlags)       /* [IN] The flags used */
+             DWORD dwCount,                    /* [IN] The quantity of files */
+             TCHAR *szCurPath,                 /* [IN] Full path of current directory */
+             LPDIRSWITCHFLAGS lpFlags)         /* [IN] The flags used */
 {
-TCHAR szTemp[MAX_PATH];                        /* A buffer to format the directory header */
-TCHAR szMsg[RC_STRING_MAX_SIZE];
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
+       TCHAR szTemp[MAX_PATH];                 /* A buffer to format the directory header */
 
        /* Print directory header */
        _tcscpy(szTemp, szCurPath);
+
        /* We cut the trailing \ of the full path */
        szTemp[_tcslen(szTemp)-1] = _T('\0');
+
        /* Condition to print 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)))
        {
-               LoadString( GetModuleHandle(NULL), STRING_DIR_HELP7, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPrintf (szMsg, szTemp);
+               LoadString(GetModuleHandle(NULL), STRING_DIR_HELP7, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPrintf(szMsg, szTemp);
        }
 
-       /* Bare format */
        if (lpFlags->bBareFormat)
        {
+               /* Bare format */
                DirPrintBareList(ptrFiles, dwCount, szCurPath, lpFlags);
        }
-       /* New list style / Short names */
        else if(lpFlags->bShortName)
        {
+               /* New list style / Short names */
                DirPrintNewList(ptrFiles, dwCount, szCurPath, lpFlags);
        }
-       /* Wide list */
        else if(lpFlags->bWideListColSort || lpFlags->bWideList)
        {
+               /* Wide list */
                DirPrintWideList(ptrFiles, dwCount, szCurPath, lpFlags);
        }
-       /* New list style*/
        else if (lpFlags->bNewLongList )
        {
+               /* New list style*/
                DirPrintNewList(ptrFiles, dwCount, szCurPath, lpFlags);
        }
-       /* If nothing is selected old list is the default */
        else
        {
+               /* If nothing is selected old list is the default */
                DirPrintOldList(ptrFiles, dwCount, szCurPath, lpFlags);
        }
-       return 0;
 }
 
 
@@ -1438,16 +1468,15 @@ TCHAR szMsg[RC_STRING_MAX_SIZE];
  *
  * Compares 2 files based on the order criteria
  */
-static int
-       CompareFiles(
-               LPWIN32_FIND_DATA lpFile1,      /* [IN] A pointer to WIN32_FIND_DATA of file 1 */
-               LPWIN32_FIND_DATA lpFile2,      /* [IN] A pointer to WIN32_FIND_DATA of file 2 */
-               LPDIRSWITCHFLAGS lpFlags)       /* [IN] The flags that we use to list */
+static BOOL
+CompareFiles(LPWIN32_FIND_DATA lpFile1,        /* [IN] A pointer to WIN32_FIND_DATA of file 1 */
+            LPWIN32_FIND_DATA lpFile2, /* [IN] A pointer to WIN32_FIND_DATA of file 2 */
+            LPDIRSWITCHFLAGS lpFlags)  /* [IN] The flags that we use to list */
 {
-/* u64 variables used to translate some broken 32bit info */
-ULARGE_INTEGER u64File1, u64File2;
-int i;                                                         /* An indexer for "for"s */
-long iComp = 0;                                        /* The comparison result */
+  ULARGE_INTEGER u64File1;
+  ULARGE_INTEGER u64File2;
+  int i;
+  long iComp = 0;                                      /* The comparison result */
 
        /* Calculate critiries by order given from user */
        for (i = 0;i < lpFlags->stOrderBy.sCriteriaCount;i++)
@@ -1472,19 +1501,20 @@ long iComp = 0;                                 /* The comparison result */
                                iComp = 0;
                        break;
 
-                       break;
                case ORDER_DIRECTORY:   /* Order by directory attribute /o:g */
                        iComp = ((lpFile2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)-
                                (lpFile1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
                        break;
+
                case ORDER_EXTENSION:   /* Order by extension name /o:e */
-                       iComp = _tcsicmp(getExt(lpFile1->cFileName),getExt(lpFile2->cFileName));
+                       iComp = _stricmp(getExt(lpFile1->cFileName),getExt(lpFile2->cFileName));
                        break;
+
                case ORDER_NAME:                /* Order by filename /o:n */
-                       iComp = _tcsicmp(lpFile1->cFileName, lpFile2->cFileName);
+                       iComp = _stricmp(lpFile1->cFileName, lpFile2->cFileName);
                        break;
-               case ORDER_TIME:                /* Order by file's time /o:t */
 
+               case ORDER_TIME:                /* Order by file's time /o:t */
                        /* We compare files based on the time field selected by /t */
                        switch(lpFlags->stTimeField.eTimeField)
                        {
@@ -1520,13 +1550,14 @@ long iComp = 0;                                 /* The comparison result */
                                iComp = 0;
                        break;
                }
+
                /* Reverse if desired */
                if (lpFlags->stOrderBy.bCriteriaRev[i])
                        iComp *= -1;
 
                /* If that criteria was enough for distinguishing
                   the files/dirs,there is no need to calculate the others*/
-               if (iComp != 0) break;          
+               if (iComp != 0) break;
        }
        
        /* Translate the value of iComp to boolean */
@@ -1541,21 +1572,21 @@ long iComp = 0;                                 /* The comparison result */
  *
  * Sort files by the order criterias using quicksort method
  */
-static void
-QsortFiles(
-       LPWIN32_FIND_DATA ptrArray[],   /* [IN/OUT] The array with file info pointers */
-       int i,                                                  /* [IN]     The index of first item in array */
-       int j,                                                  /* [IN]     The index to last item in array */
-       LPDIRSWITCHFLAGS lpFlags)               /* [IN]     The flags that we will use to sort */
+static VOID
+QsortFiles(LPWIN32_FIND_DATA ptrArray[],       /* [IN/OUT] The array with file info pointers */
+          int i,                               /* [IN]     The index of first item in array */
+          int j,                               /* [IN]     The index to last item in array */
+          LPDIRSWITCHFLAGS lpFlags)            /* [IN]     The flags that we will use to sort */
 {
-LPWIN32_FIND_DATA lpTemp;      /* A temporary pointer */
-                                                       /* used for exchangin pointers */
-int First, Last, Temp;
-BOOL Way;
+       LPWIN32_FIND_DATA lpTemp;       /* A temporary pointer */
+       int First, Last, Temp;
+       BOOL Way;
 
        if (i < j)
        {
-               First = i, Last = j, Way = TRUE;
+               First = i;
+               Last = j;
+               Way = TRUE;
                while (i != j)
                {
                        if (Way == CompareFiles(ptrArray[i], ptrArray[j], lpFlags))
@@ -1564,13 +1595,18 @@ BOOL Way;
                                lpTemp = ptrArray[i];
                                ptrArray[i]= ptrArray[j];
                                ptrArray[j] = lpTemp;
-                               /* Swap the indexers for inverting sorting */
-                               Temp = i, i=j,j =Temp;
+
+                               /* Swap the indexes for inverting sorting */
+                               Temp = i;
+                               i = j;
+                               j =Temp;
+
                                Way = !Way;
                        }
-                       j += (!Way - Way);                      
 
+                       j += (!Way - Way);
                }
+
                QsortFiles(ptrArray,First, i-1, lpFlags);
                QsortFiles(ptrArray,i+1,Last, lpFlags);
        }
@@ -1583,25 +1619,18 @@ BOOL Way;
  *
  * The functions that does everything except for printing results
  */
-static INT DirList (LPTSTR szPath,                             /* [IN] The path that dir starts */
-                                        LPTSTR szFilespec,                     /* [IN] The type of file that we are looking for */
-                                        LPINT pLine,                           /* FIXME: Maybe used for paginating */
-                                        LPDIRSWITCHFLAGS lpFlags)      /* [IN] The flags of the listing */
+static INT
+DirList(LPTSTR szPath,                 /* [IN] The path that dir starts */
+       LPTSTR szFilespec,              /* [IN] The type of file that we are looking for */
+       LPINT pLine,                    /* FIXME: Maybe used for paginating */
+       LPDIRSWITCHFLAGS lpFlags)       /* [IN] The flags of the listing */
 {
-
-/* Internal linked list */
-struct TDirFindListNode
-       {
-       WIN32_FIND_DATA stFindInfo;
-       struct TDirFindListNode * ptrNext;
-};
-
-HANDLE hSearch;                                                        /* The handle of the search */
-HANDLE hRecSearch;                                             /* The handle for searching recursivly */
-WIN32_FIND_DATA wfdFileInfo;                   /* The info of file that found */
-LPWIN32_FIND_DATA * ptrFileArray;              /* An array of pointers with all the files */
-struct TDirFindListNode * ptrStartNode;        /* The pointer to the first node */
-struct TDirFindListNode * ptrNextNode; /* A pointer used for relatives refernces */
+       HANDLE hSearch;                                                 /* The handle of the search */
+       HANDLE hRecSearch;                                              /* The handle for searching recursivly */
+       WIN32_FIND_DATA wfdFileInfo;                    /* The info of file that found */
+       LPWIN32_FIND_DATA * ptrFileArray;               /* An array of pointers with all the files */
+       PDIRFINDLISTNODE ptrStartNode;  /* The pointer to the first node */
+       PDIRFINDLISTNODE ptrNextNode;   /* A pointer used for relatives refernces */
 TCHAR szFullPath[MAX_PATH];                            /* The full path that we are listing with trailing \ */
 TCHAR szFullFileSpec[MAX_PATH];                        /* The full path with file specs that we ll request\ */
 TCHAR szBytes[20];                                             /* A string for converting ULARGE integer */
@@ -1618,7 +1647,7 @@ TCHAR szMsg[RC_STRING_MAX_SIZE];
        dwCount = 0;
        dwCountFiles = 0;
        dwCountDirs = 0;
-       u64CountBytes.QuadPart = 0;     
+       u64CountBytes.QuadPart = 0;
 
        /* Create szFullPath and szFullFileSpec */
        _tcscpy (szFullPath, szPath);
@@ -1628,7 +1657,8 @@ TCHAR szMsg[RC_STRING_MAX_SIZE];
        _tcscat (szFullFileSpec, szFilespec);
 
        /* Prepare the linked list, first node is allocated */
-       if ((ptrStartNode = malloc(sizeof(struct TDirFindListNode))) == NULL)
+       ptrStartNode = malloc(sizeof(DIRFINDLISTNODE));
+       if (ptrStartNode == NULL)
        {
 #ifdef _DEBUG
                ConErrPrintf("DEBUG: Cannot allocate memory for ptrStartNode!\n");
@@ -1638,7 +1668,7 @@ TCHAR szMsg[RC_STRING_MAX_SIZE];
        ptrNextNode = ptrStartNode;
 
        /* Collect the results for the current folder */
-       hSearch = FindFirstFile (szFullFileSpec, &wfdFileInfo);
+       hSearch = FindFirstFile(szFullFileSpec, &wfdFileInfo);
        do
        {
                if (hSearch != INVALID_HANDLE_VALUE)
@@ -1647,15 +1677,31 @@ TCHAR szMsg[RC_STRING_MAX_SIZE];
                        if ((wfdFileInfo.dwFileAttributes & lpFlags->stAttribs.dwAttribMask )
                                == (lpFlags->stAttribs.dwAttribMask & lpFlags->stAttribs.dwAttribVal ))
                        {
-                               ptrNextNode->ptrNext = malloc(sizeof(struct TDirFindListNode));
+                               ptrNextNode->ptrNext = malloc(sizeof(DIRFINDLISTNODE));
+                               if (ptrNextNode->ptrNext == NULL)
+                               {
+#ifdef _DEBUG
+                                       ConErrPrintf("DEBUG: Cannot allocate memory for ptrNextNode->ptrNext!\n");
+#endif
+                                       while (ptrStartNode)
+                                       {
+                                               ptrNextNode = ptrStartNode->ptrNext;
+                                               free(ptrStartNode);
+                                               ptrStartNode = ptrNextNode;
+                                               dwCount --;
+                                       }
+                                       return 1;
+                               }
+
                                /* If malloc fails we go to next file in hope it works,
                                   without braking the linked list! */
                                if (ptrNextNode->ptrNext)
                                {
                                        /* Copy the info of search at linked list */
-                                       memcpy((void *)&ptrNextNode->ptrNext->stFindInfo,
-                                               (void *)&wfdFileInfo,sizeof(WIN32_FIND_DATA));
-                                               
+                                       memcpy(&ptrNextNode->ptrNext->stFindInfo,
+                                              &wfdFileInfo,
+                                              sizeof(WIN32_FIND_DATA));
+
                                        /* If lower case is selected do it here */
                                        if (lpFlags->bLowerCase)
                                        {
@@ -1676,37 +1722,45 @@ TCHAR szMsg[RC_STRING_MAX_SIZE];
                                        else
                                        {
                                                /* File */
-                                               dwCountFiles++;                                                 
+                                               dwCountFiles++;
                                                u64Temp.HighPart = wfdFileInfo.nFileSizeHigh;
                                                u64Temp.LowPart = wfdFileInfo.nFileSizeLow;
                                                u64CountBytes.QuadPart += u64Temp.QuadPart;
-                                       }                                               
+                                       }
                                }
                        }
-                       
-               }               
-       }while(FindNextFile(hSearch,&wfdFileInfo));
+               }
+       }while(FindNextFile(hSearch, &wfdFileInfo));
        FindClose(hSearch);
 
        /* Terminate list */
        ptrNextNode->ptrNext = NULL;
 
        /* Calculate and allocate space need for making an array of pointers */ 
-       ptrFileArray = malloc(sizeof(LPWIN32_FIND_DATA)*dwCount);
-       if (!(ptrFileArray))
+       ptrFileArray = malloc(sizeof(LPWIN32_FIND_DATA) * dwCount);
+       if (ptrFileArray == NULL)
        {
 #ifdef _DEBUG
                ConErrPrintf("DEBUG: Cannot allocate memory for ptrFileArray!\n");
 #endif
-               goto _DirList_clear_n_exit;
+               while (ptrStartNode)
+               {
+                       ptrNextNode = ptrStartNode->ptrNext;
+                       free(ptrStartNode);
+                       ptrStartNode = ptrNextNode;
+                       dwCount --;
+               }
+               return 1;
        }
 
-       /* Create an array of pointers from the linked list
-          this will be used to sort and print data, rather than the list */
+       /*
+        * Create an array of pointers from the linked list
+        * this will be used to sort and print data, rather than the list
+        */
        ptrNextNode = ptrStartNode;
        dwCount = 0;
-       while(ptrNextNode->ptrNext)
-       {       
+       while (ptrNextNode->ptrNext)
+       {
                *(ptrFileArray + dwCount) = &ptrNextNode->ptrNext->stFindInfo;
                ptrNextNode = ptrNextNode->ptrNext;
                dwCount++;
@@ -1728,8 +1782,8 @@ TCHAR szMsg[RC_STRING_MAX_SIZE];
        if (!(lpFlags->bBareFormat) && (dwCount > 0))
        {
                ConvertULargeInteger(u64CountBytes, szBytes, 20, lpFlags->bTSeperator);
-               LoadString( GetModuleHandle(NULL), STRING_DIR_HELP8, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPrintf (szMsg,dwCountFiles, szBytes);
+               LoadString(GetModuleHandle(NULL), STRING_DIR_HELP8, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPrintf(szMsg,dwCountFiles, szBytes);
        }
 
        /* Add statistics to recursive statistics*/
@@ -1751,9 +1805,9 @@ TCHAR szMsg[RC_STRING_MAX_SIZE];
                        if (hRecSearch != INVALID_HANDLE_VALUE)
                        {
                                /* We search for directories other than "." and ".." */
-                               if ((_tcsicmp(wfdFileInfo.cFileName, _T(".")) != 0)
-                                       && (_tcsicmp(wfdFileInfo.cFileName, _T("..")) != 0 )
-                                       && (wfdFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+                               if ((_tcsicmp(wfdFileInfo.cFileName, _T(".")) != 0) &&
+                                   (_tcsicmp(wfdFileInfo.cFileName, _T("..")) != 0 ) &&
+                                   (wfdFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
                                {
                                        /* Concat the path and the directory to do recursive */
                                        _tcscpy(szFullFileSpec, szFullPath);
@@ -1766,8 +1820,6 @@ TCHAR szMsg[RC_STRING_MAX_SIZE];
                FindClose(hRecSearch);
        }
 
-_DirList_clear_n_exit: 
-/* Deallocate memory */
        /* Free linked list */
        while (ptrStartNode)
        {
@@ -1787,9 +1839,9 @@ _DirList_clear_n_exit:
  *
  * internal dir command
  */
-INT CommandDir (LPTSTR first, LPTSTR rest)
+INT CommandDir(LPTSTR first, LPTSTR rest)
 {
-       TCHAR  dircmd[256];                                                     /* A variable to store the DIRCMD enviroment variable */
+       TCHAR  dircmd[256];     /* A variable to store the DIRCMD enviroment variable */
        TCHAR  szPath[MAX_PATH];
        TCHAR  szFilespec[MAX_PATH];
        LPTSTR param;
@@ -1822,9 +1874,9 @@ INT CommandDir (LPTSTR first, LPTSTR rest)
        stFlags.stOrderBy.bUnSet = FALSE;
 
        /* read the parameters from the DIRCMD environment variable */
-       if (GetEnvironmentVariable (_T("DIRCMD"), dircmd, 256)) 
+       if (GetEnvironmentVariable (_T("DIRCMD"), dircmd, 256))
                if (!DirReadParam(dircmd, &param, &stFlags))
-                       return 1;       
+                       return 1;
 
        /* read the parameters */
        if (!DirReadParam(rest, &param, &stFlags))
@@ -1869,7 +1921,7 @@ INT CommandDir (LPTSTR first, LPTSTR rest)
        if (DirList (szPath, szFilespec, &nLine, &stFlags))
                return 1;
 
-       /* print the footer */  
+       /* print the footer */
        PrintSummary(szPath,
                recurse_file_cnt,
                recurse_dir_cnt,
index 9ed61a0..b34d502 100644 (file)
@@ -137,16 +137,15 @@ INT GetDirectoryStackDepth (VOID)
  */
 INT CommandPushd (LPTSTR first, LPTSTR rest)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR curPath[MAX_PATH];
        TCHAR newPath[MAX_PATH];
        BOOL  bChangePath = FALSE;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        if (!_tcsncmp (rest, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_DIRSTACK_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts ((LPTSTR)szMsg);
-               
+               LoadString(GetModuleHandle(NULL), STRING_DIRSTACK_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -172,14 +171,13 @@ INT CommandPushd (LPTSTR first, LPTSTR rest)
  */
 INT CommandPopd (LPTSTR first, LPTSTR rest)
 {
-       TCHAR szPath[MAX_PATH];
        TCHAR szMsg[RC_STRING_MAX_SIZE];
+       TCHAR szPath[MAX_PATH];
 
        if (!_tcsncmp(rest, _T("/?"), 2))
-       {   
-               LoadString( GetModuleHandle(NULL), STRING_DIRSTACK_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);
-               
+       {
+               LoadString(GetModuleHandle(NULL), STRING_DIRSTACK_HELP2, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -200,14 +198,13 @@ INT CommandPopd (LPTSTR first, LPTSTR rest)
  */
 INT CommandDirs (LPTSTR first, LPTSTR rest)
 {
-       LPDIRENTRY lpDir;
        TCHAR szMsg[RC_STRING_MAX_SIZE];
+       LPDIRENTRY lpDir;
 
        if (!_tcsncmp(rest, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_DIRSTACK_HELP3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);
-               
+               LoadString(GetModuleHandle(NULL), STRING_DIRSTACK_HELP3, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -216,9 +213,8 @@ INT CommandDirs (LPTSTR first, LPTSTR rest)
 
        if (lpDir == NULL)
        {
-               LoadString( GetModuleHandle(NULL), STRING_DIRSTACK_HELP4, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);
-               
+               LoadString(GetModuleHandle(NULL), STRING_DIRSTACK_HELP4, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
index c38687e..c1ecc5f 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
  *  ECHO.C - internal echo commands.
  *
  *
@@ -41,8 +40,8 @@ INT CommandEcho (LPTSTR cmd, LPTSTR param)
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_ECHO_HELP4, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);                     
+               LoadString(GetModuleHandle(NULL), STRING_ECHO_HELP4, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -61,15 +60,17 @@ INT CommandEcho (LPTSTR cmd, LPTSTR param)
                        bEcho = TRUE;
                else if (*param)
                        ConOutPuts (param);
-               else {
-             LoadString( GetModuleHandle(NULL), STRING_ECHO_HELP4, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-             ConOutPrintf (szMsg, bEcho ? D_ON : D_OFF);
-                    }
+               else
+               {
+                       LoadString(GetModuleHandle(NULL), STRING_ECHO_HELP4, szMsg, RC_STRING_MAX_SIZE);
+                       ConOutPrintf(szMsg, bEcho ? D_ON : D_OFF);
+               }
        }
 
        return 0;
 }
 
+
 INT CommandEchos (LPTSTR cmd, LPTSTR param)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
@@ -80,9 +81,8 @@ INT CommandEchos (LPTSTR cmd, LPTSTR param)
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_ECHO_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts(szMsg);      
-               
+               LoadString(GetModuleHandle(NULL), STRING_ECHO_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -103,9 +103,8 @@ INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_ECHO_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts((LPTSTR)szMsg);      
-
+               LoadString(GetModuleHandle(NULL), STRING_ECHO_HELP2, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -124,6 +123,7 @@ INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
        return 0;
 }
 
+
 INT CommandEchoserr (LPTSTR cmd, LPTSTR param)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
@@ -132,13 +132,10 @@ INT CommandEchoserr (LPTSTR cmd, LPTSTR param)
        DebugPrintf (_T("CommandEchoserr '%s' : '%s'\n"), cmd, param);
 #endif
 
-       
-
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_ECHO_HELP3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts(szMsg);      
-
+               LoadString(GetModuleHandle(NULL), STRING_ECHO_HELP3, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts((LPTSTR)szMsg);
                return 0;
        }
 
index 4529524..354e707 100644 (file)
 
 VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR  szMessage[1024];
 #ifndef __REACTOS__
        LPTSTR szError;
 #endif
        va_list arg_ptr;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        if (dwErrorCode == ERROR_SUCCESS)
                return;
@@ -71,8 +71,8 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
        }
        else
        {
-               LoadString( GetModuleHandle(NULL), STRING_ERROR_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConErrPrintf (szMsg, dwErrorCode);
+               LoadString(GetModuleHandle(NULL), STRING_ERROR_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf(szMsg, dwErrorCode);
                return;
        }
 
@@ -80,21 +80,21 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
 
        switch (dwErrorCode)
        {
-               case ERROR_FILE_NOT_FOUND:                      
-                       LoadString( GetModuleHandle(NULL), STRING_ERROR_FILE_NOT_FOUND, szMsg,sizeof(szMsg)/sizeof(TCHAR));            
+               case ERROR_FILE_NOT_FOUND:
+                       LoadString(GetModuleHandle(NULL), STRING_ERROR_FILE_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE);
                        break;
 
                case ERROR_PATH_NOT_FOUND:
-                       LoadString( GetModuleHandle(NULL), STRING_ERROR_PATH_NOT_FOUND, szMsg,sizeof(szMsg)/sizeof(TCHAR));             
+                       LoadString(GetModuleHandle(NULL), STRING_ERROR_PATH_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE);
                        break;
 
                case ERROR_NOT_READY:
-                       LoadString( GetModuleHandle(NULL), STRING_ERROR_DRIVER_NOT_READY, szMsg,sizeof(szMsg)/sizeof(TCHAR));                                   
+                       LoadString(GetModuleHandle(NULL), STRING_ERROR_DRIVER_NOT_READY, szMsg, RC_STRING_MAX_SIZE);
                        break;
 
                default:
-                       LoadString( GetModuleHandle(NULL), STRING_ERROR_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                       ConErrPrintf (szMsg);                           
+                       LoadString(GetModuleHandle(NULL), STRING_ERROR_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+                       ConErrPrintf(szMsg);
                        return;
        }
 
@@ -108,107 +108,121 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
 VOID error_parameter_format(TCHAR ch)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_ERROR_PARAMETERF_ERROR, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConErrPrintf (szMsg, ch);
+
+       LoadString(GetModuleHandle(NULL), STRING_ERROR_PARAMETERF_ERROR, szMsg, RC_STRING_MAX_SIZE);
+       ConErrPrintf(szMsg, ch);
 }
 
 
 VOID error_invalid_switch (TCHAR ch)
-{      
+{
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_ERROR_INVALID_SWITCH, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConErrPrintf (szMsg, ch);
+
+       LoadString(GetModuleHandle(NULL), STRING_ERROR_INVALID_SWITCH, szMsg, RC_STRING_MAX_SIZE);
+       ConErrPrintf(szMsg, ch);
 }
 
 
 VOID error_too_many_parameters (LPTSTR s)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_ERROR_TOO_MANY_PARAMETERS, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConErrPrintf (szMsg, s);
+
+       LoadString(GetModuleHandle(NULL), STRING_ERROR_TOO_MANY_PARAMETERS, szMsg, RC_STRING_MAX_SIZE);
+       ConErrPrintf(szMsg, s);
 }
 
 
 VOID error_path_not_found (VOID)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_ERROR_PATH_NOT_FOUND, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConErrPrintf (szMsg);
+
+       LoadString(GetModuleHandle(NULL), STRING_ERROR_PATH_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE);
+       ConErrPrintf(szMsg);
 }
 
 
 VOID error_file_not_found (VOID)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_ERROR_FILE_NOT_FOUND, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConErrPrintf ((LPTSTR)szMsg);
+
+       LoadString(GetModuleHandle(NULL), STRING_ERROR_FILE_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE);
+       ConErrPrintf(szMsg);
 }
 
 
 VOID error_sfile_not_found (LPTSTR f)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_ERROR_FILE_NOT_FOUND, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConErrPrintf (_T("%s - %s\n"), szMsg,f);
+
+       LoadString(GetModuleHandle(NULL), STRING_ERROR_FILE_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE);
+       ConErrPrintf(_T("%s - %s\n"), szMsg, f);
 }
 
 
 VOID error_req_param_missing (VOID)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_ERROR_REQ_PARAM_MISSING, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConErrPrintf (szMsg);
+
+       LoadString(GetModuleHandle(NULL), STRING_ERROR_REQ_PARAM_MISSING, szMsg, RC_STRING_MAX_SIZE);
+       ConErrPrintf(szMsg);
 }
 
 
 VOID error_invalid_drive (VOID)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_ERROR_INVALID_DRIVE, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConErrPrintf (szMsg);
+
+       LoadString(GetModuleHandle(NULL), STRING_ERROR_INVALID_DRIVE, szMsg, RC_STRING_MAX_SIZE);
+       ConErrPrintf(szMsg);
 }
 
 
 VOID error_bad_command (VOID)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_ERROR_BADCOMMAND, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConErrPrintf (szMsg);   
+
+       LoadString(GetModuleHandle(NULL), STRING_ERROR_BADCOMMAND, szMsg, RC_STRING_MAX_SIZE);
+       ConErrPrintf(szMsg);
 }
 
 
 VOID error_no_pipe (VOID)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_ERROR_CANNOTPIPE, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConErrPrintf (szMsg);   
+
+       LoadString(GetModuleHandle(NULL), STRING_ERROR_CANNOTPIPE, szMsg, RC_STRING_MAX_SIZE);
+       ConErrPrintf(szMsg);
 }
 
 
 VOID error_out_of_memory (VOID)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_ERROR_OUT_OF_MEMORY, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConErrPrintf (szMsg);   
+
+       LoadString(GetModuleHandle(NULL), STRING_ERROR_OUT_OF_MEMORY, szMsg, RC_STRING_MAX_SIZE);
+       ConErrPrintf(szMsg);
 }
 
 
 VOID error_invalid_parameter_format (LPTSTR s)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_ERROR_INVALID_PARAM_FORMAT, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConErrPrintf (szMsg, s);
+
+       LoadString(GetModuleHandle(NULL), STRING_ERROR_INVALID_PARAM_FORMAT, szMsg, RC_STRING_MAX_SIZE);
+       ConErrPrintf(szMsg, s);
 }
 
 
 VOID error_syntax (LPTSTR s)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       LoadString( GetModuleHandle(NULL), STRING_ERROR_ERROR2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
+
+       LoadString(GetModuleHandle(NULL), STRING_ERROR_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+
        if (s)
-               ConErrPrintf (_T("%s - %s\n"),szMsg, s);
+               ConErrPrintf(_T("%s - %s\n"), szMsg, s);
        else
-               ConErrPrintf (_T("%s.\n"), szMsg );
+               ConErrPrintf(_T("%s.\n"), szMsg);
 }
 
 
@@ -216,6 +230,8 @@ VOID msg_pause (VOID)
 {
        TCHAR szMsg[RC_STRING_MAX_SIZE];
 
-       LoadString( GetModuleHandle(NULL), STRING_ERROR_D_PAUSEMSG, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPuts (szMsg);     
+       LoadString(GetModuleHandle(NULL), STRING_ERROR_D_PAUSEMSG, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPuts(szMsg);
 }
+
+/* EOF */
index 37ddeea..06f128f 100644 (file)
 
 INT cmd_for (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        LPBATCH_CONTEXT lpNew;
        LPTSTR pp;
        TCHAR  var;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
 #ifdef _DEBUG
        DebugPrintf (_T("cmd_for (\'%s\', \'%s\'\n"), cmd, param);
@@ -61,9 +61,8 @@ INT cmd_for (LPTSTR cmd, LPTSTR param)
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_FOR_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts ((LPTSTR)szMsg);     
-
+               LoadString(GetModuleHandle(NULL), STRING_FOR_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -83,8 +82,8 @@ INT cmd_for (LPTSTR cmd, LPTSTR param)
        /* Check next element is 'IN' */
        if ((_tcsnicmp (param, _T("in"), 2) != 0) || !_istspace (*(param + 2)))
        {
-               LoadString( GetModuleHandle(NULL), STRING_FOR_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               error_syntax (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_FOR_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               error_syntax(szMsg);
                return 1;
        }
 
@@ -95,9 +94,8 @@ INT cmd_for (LPTSTR cmd, LPTSTR param)
        /* Folowed by a '(', find also matching ')' */
        if ((*param != _T('(')) || (NULL == (pp = _tcsrchr (param, _T(')')))))
        {
-               LoadString( GetModuleHandle(NULL), STRING_FOR_ERROR2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               error_syntax (szMsg);
-
+               LoadString(GetModuleHandle(NULL), STRING_FOR_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+               error_syntax(szMsg);
                return 1;
        }
 
@@ -110,8 +108,8 @@ INT cmd_for (LPTSTR cmd, LPTSTR param)
        /* Check DO follows */
        if ((_tcsnicmp (pp, _T("do"), 2) != 0) || !_istspace (*(pp + 2)))
        {
-               LoadString( GetModuleHandle(NULL), STRING_FOR_ERROR3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               error_syntax (szMsg);           
+               LoadString(GetModuleHandle(NULL), STRING_FOR_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+               error_syntax(szMsg);
                return 1;
        }
 
@@ -122,9 +120,8 @@ INT cmd_for (LPTSTR cmd, LPTSTR param)
        /* Check that command tail is not empty */
        if (*pp == _T('\0'))
        {
-               LoadString( GetModuleHandle(NULL), STRING_FOR_ERROR4, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               error_syntax (szMsg);           
-               
+               LoadString(GetModuleHandle(NULL), STRING_FOR_ERROR4, szMsg, RC_STRING_MAX_SIZE);
+               error_syntax(szMsg);
                return 1;
        }
 
index be1b379..44cf613 100644 (file)
@@ -58,6 +58,7 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len)
 static VOID
 PrintDiskInfo (LPTSTR szDisk)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR szRootPath[4] = _T("A:\\");
        TCHAR szDrive[2] = _T("A");
        TCHAR szVolume[64];
@@ -71,14 +72,11 @@ PrintDiskInfo (LPTSTR szDisk)
        DWORD dwBytPerSec;
        DWORD dwFreeCl;
        DWORD dwTotCl;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        if (_tcslen (szDisk) < 2 || szDisk[1] != _T(':'))
        {
-               
-               LoadString( GetModuleHandle(NULL), STRING_FREE_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPrintf (szMsg);   
-               
+               LoadString(GetModuleHandle(NULL), STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf(szMsg);
                return;
        }
 
@@ -88,16 +86,16 @@ PrintDiskInfo (LPTSTR szDisk)
        if (!GetVolumeInformation (szRootPath, szVolume, 64, &dwSerial,
                                   NULL, NULL, NULL, 0))
        {
-               LoadString( GetModuleHandle(NULL), STRING_FREE_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPrintf (_T("%s %s:\n"),szMsg, szDrive);
+               LoadString(GetModuleHandle(NULL), STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf(_T("%s %s:\n"), szMsg, szDrive);
                return;
        }
 
        if (szVolume[0] == _T('\0'))
        {
                
-               LoadString( GetModuleHandle(NULL), STRING_FREE_ERROR2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               _tcscpy (szVolume,  szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_FREE_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+               _tcscpy (szVolume, szMsg);
        }
 
        _stprintf (szSerial,
@@ -108,8 +106,8 @@ PrintDiskInfo (LPTSTR szDisk)
        if (!GetDiskFreeSpace (szRootPath, &dwSecPerCl,
                               &dwBytPerSec, &dwFreeCl, &dwTotCl))
        {
-               LoadString( GetModuleHandle(NULL), STRING_FREE_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPrintf (_T("%s %s:\n"),szMsg, szDrive);           
+               LoadString(GetModuleHandle(NULL), STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf (_T("%s %s:\n"), szMsg, szDrive);
                return;
        }
 
@@ -123,24 +121,23 @@ PrintDiskInfo (LPTSTR szDisk)
        ConvertULargeInteger (uliSize, szFree, 40);
 
        
-       LoadString( GetModuleHandle(NULL), STRING_FREE_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPrintf (szMsg,szDrive, szVolume, szSerial,szTotal, szUsed, szFree);
+       LoadString(GetModuleHandle(NULL), STRING_FREE_HELP1, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPrintf(szMsg, szDrive, szVolume, szSerial, szTotal, szUsed, szFree);
 }
 
 
 INT CommandFree (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        LPTSTR szParam;
        TCHAR  szDefPath[MAX_PATH];
        INT argc, i;
        LPTSTR *arg;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_FREE_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);
-
+               LoadString(GetModuleHandle(NULL), STRING_FREE_HELP2, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
index cfa2e48..c7ce8cb 100644 (file)
@@ -39,9 +39,9 @@
 
 INT cmd_goto (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        LPTSTR tmp;
        LONG   lNewPosHigh;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
 #ifdef _DEBUG
        DebugPrintf (_T("cmd_goto (\'%s\', \'%s\'\n"), cmd, param);
@@ -49,9 +49,8 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param)
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_GOTO_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);     
-
+               LoadString(GetModuleHandle(NULL), STRING_GOTO_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -63,9 +62,8 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param)
 
        if (*param == _T('\0'))
        {
-               
-               LoadString( GetModuleHandle(NULL), STRING_GOTO_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ExitBatch (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_GOTO_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               ExitBatch(szMsg);
                return 1;
        }
 
@@ -97,9 +95,11 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param)
                        return 0;
        }
 
-       LoadString( GetModuleHandle(NULL), STRING_GOTO_ERROR2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConErrPrintf (szMsg,param);             
-       ExitBatch (NULL);
+       LoadString(GetModuleHandle(NULL), STRING_GOTO_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+       ConErrPrintf(szMsg, param);
+       ExitBatch(NULL);
 
        return 1;
 }
+
+/* EOF */
index 345bb3f..9b7be84 100644 (file)
@@ -120,7 +120,7 @@ INT CommandHistory (LPTSTR cmd, LPTSTR param)
        }
        else
        {
-               for(h_tmp=Top->prev;h_tmp!=Bottom;h_tmp=h_tmp->prev)
+               for (h_tmp = Top->prev; h_tmp != Bottom; h_tmp = h_tmp->prev)
                        ConErrPuts(h_tmp->string);
        }
        return 0;
@@ -128,11 +128,9 @@ INT CommandHistory (LPTSTR cmd, LPTSTR param)
 
 VOID set_size(INT new_size)
 {
-
-       while(new_size<size)
+       while (new_size<size)
                del(Top->prev);
-               
-               
+
        max_size=new_size;
 }
 
@@ -140,19 +138,16 @@ VOID set_size(INT new_size)
 VOID InitHistory(VOID)
 {
        size=0;
-       
-       
-       Top = malloc(sizeof(HIST_ENTRY));
-       Bottom = malloc(sizeof(HIST_ENTRY));    
 
+       Top = malloc(sizeof(HIST_ENTRY));
+       Bottom = malloc(sizeof(HIST_ENTRY));
 
        Top->prev = Bottom;
        Top->next = NULL;
        Top->string = NULL;
 
-       
        Bottom->prev = NULL;
-       Bottom->next = Top;     
+       Bottom->next = Top;
        Bottom->string = NULL;
 
        curr_ptr=Bottom;
@@ -163,49 +158,44 @@ VOID InitHistory(VOID)
 
 VOID CleanHistory(VOID)
 {
-       
        while (Bottom->next!=Top)
                del(Bottom->next);
 
        free(Top);
        free(Bottom);
-
 }
 
 
 VOID History_del_current_entry(LPTSTR str)
 {
        LPHIST_ENTRY tmp;
-       
-       if (size==0)
+
+       if (size == 0)
                return;
 
-       if(curr_ptr==Bottom)
+       if (curr_ptr == Bottom)
                curr_ptr=Bottom->next;
 
-       if(curr_ptr==Top)
+       if (curr_ptr == Top)
                curr_ptr=Top->prev;
 
 
-       tmp=curr_ptr;           
-       curr_ptr=curr_ptr->prev;
+       tmp = curr_ptr;
+       curr_ptr = curr_ptr->prev;
        del(tmp);
-       History(-1,str);
-
+       History(-1, str);
 }
 
 
 static
 VOID del(LPHIST_ENTRY item)
 {
-
-       if( item==NULL || item==Top || item==Bottom )
+       if (item==NULL || item==Top || item==Bottom)
        {
 #ifdef _DEBUG
                DebugPrintf(_T("del in " __FILE__  ": retrning\n"
                            "item is 0x%08x (Bottom is0x%08x)\n"),
-                           item, Bottom);                      
-
+                           item, Bottom);
 #endif
                return;
        }
@@ -215,10 +205,6 @@ VOID del(LPHIST_ENTRY item)
        /*free string's mem*/
        if (item->string)
                free(item->string);
-       
-
-
-
 
        /*set links in prev and next item*/
        item->next->prev=item->prev;
@@ -227,17 +213,15 @@ VOID del(LPHIST_ENTRY item)
        free(item);
 
        size--;
-
 }
 
+
 #if 0
 static
 VOID add_before_last(LPTSTR string)
-{      
-
+{
        LPHIST_ENTRY tmp,before,after;
 
-               
        /*delete first entry if maximum number of entries is reached*/
        while(size>=max_size)
                del(Top->prev);
@@ -248,14 +232,11 @@ VOID add_before_last(LPTSTR string)
        if (*string==_T('\0'))
                return;
 
-
-
        /*allocte entry and string*/
        tmp=malloc(sizeof(HIST_ENTRY));
        tmp->string=malloc((_tcslen(string)+1)*sizeof(TCHAR));
-       _tcscpy(tmp->string,string);            
-       
-       
+       _tcscpy(tmp->string,string);
+
        /*set links*/
        before=Bottom->next;
        after=before->next;
@@ -266,12 +247,6 @@ VOID add_before_last(LPTSTR string)
        after->prev=tmp;
        before->next=tmp;
 
-
-
-       
-
-
-
        /*set new size*/
        size++;
 
index ac0e495..b0a235b 100644 (file)
@@ -39,9 +39,9 @@
 
 INT cmd_if (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        INT x_flag = 0; /* when set cause 'then' clause to be executed */
        LPTSTR pp;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
 #ifdef _DEBUG
        DebugPrintf (_T("cmd_if: (\'%S\', \'%S\')\n"), cmd, param);
@@ -49,7 +49,7 @@ INT cmd_if (LPTSTR cmd, LPTSTR param)
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_IF_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
+               LoadString(GetModuleHandle(NULL), STRING_IF_HELP1, szMsg, RC_STRING_MAX_SIZE);
                ConOutPuts(szMsg);
                return 0;
        }
@@ -90,10 +90,9 @@ INT cmd_if (LPTSTR cmd, LPTSTR param)
                else
                        return 0;
        }
-
-       /* Check for 'defined' form */
        else if (!_tcsnicmp (param, _T("defined"), 7) && _istspace (*(param + 7)))
        {
+               /* Check for 'defined' form */
                TCHAR Value [1];
                INT   ValueSize = 0;
 
@@ -121,10 +120,9 @@ INT cmd_if (LPTSTR cmd, LPTSTR param)
                else
                        return 0;
        }
-
-       /* Check for 'errorlevel' form */
        else if (!_tcsnicmp (param, _T("errorlevel"), 10) && _istspace (*(param + 10)))
        {
+               /* Check for 'errorlevel' form */
                INT n = 0;
 
                pp = param + 10;
@@ -138,14 +136,12 @@ INT cmd_if (LPTSTR cmd, LPTSTR param)
 
                x_flag |= X_EMPTY;          /* Syntax error if comd empty */
        }
-
-       /* Check that '==' is present, syntax error if not */
        else if (NULL == (pp = _tcsstr (param, _T("=="))))
        {
+               /* Check that '==' is present, syntax error if not */
                error_syntax (NULL);
                return 1;
        }
-
        else
        {
                /* Change first '='to space to terminate comparison loop */
@@ -193,3 +189,5 @@ INT cmd_if (LPTSTR cmd, LPTSTR param)
 
        return 0;
 }
+
+/* EOF */
index 3cb7471..e6a27de 100644 (file)
@@ -154,19 +154,19 @@ VOID FreeLastPath (VOID)
  */
 INT cmd_chdir (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        LPTSTR dir;             /* pointer to the directory to change to */
        LPTSTR lpOldPath;
        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 */
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        /*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*/
 
        if (!_tcsncmp (param, _T("/?"), 2))
-       {               
-               LoadString(GetModuleHandle(NULL), STRING_CD_HELP, szMsg, sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPuts (szMsg);
+       {
+               LoadString(GetModuleHandle(NULL), STRING_CD_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -190,10 +190,7 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
                TCHAR szPath[MAX_PATH];
 
                GetCurrentDirectory (MAX_PATH, szPath);
-
                ConOutPuts (szPath);
-
-
                return 0;
        }
 
@@ -275,17 +272,16 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
  */
 INT cmd_mkdir (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        LPTSTR dir;             /* pointer to the directory to change to */
        LPTSTR place;   /* used to search for the \ when no space is used */
        LPTSTR *p = NULL;
        INT argc;
-        TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_MKDIR_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-                ConOutPuts (szMsg);
-
+               LoadString(GetModuleHandle(NULL), STRING_MKDIR_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -320,8 +316,8 @@ INT cmd_mkdir (LPTSTR cmd, LPTSTR param)
 
        if (!dir)
        {
-               LoadString( GetModuleHandle(NULL), STRING_PARAM_ERROR, szMsg, sizeof(szMsg)/sizeof(TCHAR));
-               ConErrPrintf (szMsg);
+               LoadString( GetModuleHandle(NULL), STRING_PARAM_ERROR, (LPTSTR) szMsg,sizeof(szMsg));
+               ConErrPrintf (_T((LPTSTR)szMsg));
                return 1;
        }
 
@@ -351,21 +347,17 @@ INT cmd_mkdir (LPTSTR cmd, LPTSTR param)
  */
 INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        LPTSTR dir;             /* pointer to the directory to change to */
        LPTSTR place;   /* used to search for the \ when no space is used */
 
        LPTSTR *p = NULL;
        INT argc;
 
-       
-        TCHAR szMsg[RC_STRING_MAX_SIZE];
-
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_RMDIR_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-
-               ConOutPuts (szMsg);
-
+               LoadString(GetModuleHandle(NULL), STRING_RMDIR_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -399,9 +391,8 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
 
        if (!dir)
        {
-               LoadString( GetModuleHandle(NULL), STRING_PARAM_ERROR, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConErrPrintf (szMsg);
-
+               LoadString(GetModuleHandle(NULL), STRING_PARAM_ERROR, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPrintf(szMsg);
                return 1;
        }
 
@@ -434,8 +425,8 @@ INT CommandExit (LPTSTR cmd, LPTSTR param)
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_EXIT_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPuts (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_EXIT_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -455,8 +446,8 @@ INT CommandRem (LPTSTR cmd, LPTSTR param)
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-           LoadString( GetModuleHandle(NULL), STRING_REM_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-           ConOutPuts (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_REM_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
        }
 
        return 0;
index 3b45221..d71b379 100644 (file)
 
 INT cmd_label (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR  szRootPath[] = _T("A:\\");
        TCHAR  szLabel[80];
        TCHAR  szOldLabel[80];
        DWORD  dwSerialNr;
        LPTSTR *arg;
        INT    args;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        /* set empty label string */
        szLabel[0] = _T('\0');
@@ -39,9 +39,8 @@ INT cmd_label (LPTSTR cmd, LPTSTR param)
        /* print help */
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_LABEL_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPrintf (szMsg);   
-
+               LoadString(GetModuleHandle(NULL), STRING_LABEL_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPrintf(szMsg);
                return 0;
        }
 
@@ -88,40 +87,40 @@ INT cmd_label (LPTSTR cmd, LPTSTR param)
                return 1;
        }
 
-       GetVolumeInformation (szRootPath, szOldLabel, 80, &dwSerialNr,
-                                                 NULL, NULL, NULL, 0);
+       GetVolumeInformation(szRootPath, szOldLabel, 80, &dwSerialNr,
+                             NULL, NULL, NULL, 0);
 
        /* print drive info */  
        if (szOldLabel[0] != _T('\0'))
        {
-               LoadString( GetModuleHandle(NULL), STRING_LABEL_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPrintf (szMsg, _totupper (szRootPath[0]), szOldLabel);
+               LoadString(GetModuleHandle(NULL), STRING_LABEL_HELP2, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPrintf(szMsg, _totupper(szRootPath[0]), szOldLabel);
        }
        else
        {
-               LoadString( GetModuleHandle(NULL), STRING_LABEL_HELP3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPrintf (szMsg, _totupper (szRootPath[0]));
+               LoadString(GetModuleHandle(NULL), STRING_LABEL_HELP3, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPrintf(szMsg, _totupper(szRootPath[0]));
        }
 
-
-
        /* print the volume serial number */
-       LoadString( GetModuleHandle(NULL), STRING_LABEL_HELP4, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPrintf (szMsg, HIWORD(dwSerialNr), LOWORD(dwSerialNr));
+       LoadString(GetModuleHandle(NULL), STRING_LABEL_HELP4, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPrintf(szMsg, HIWORD(dwSerialNr), LOWORD(dwSerialNr));
 
        if (szLabel[0] == _T('\0'))
        {
-               LoadString( GetModuleHandle(NULL), STRING_LABEL_HELP5, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPrintf (szMsg);
-               
-               ConInString (szLabel, 80);
+               LoadString(GetModuleHandle(NULL), STRING_LABEL_HELP5, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPrintf(szMsg);
+
+               ConInString(szLabel, 80);
        }
 
-       SetVolumeLabel (szRootPath, szLabel);
+       SetVolumeLabel(szRootPath, szLabel);
 
-       freep (arg);
+       freep(arg);
 
        return 0;
 }
 
 #endif /* INCLUDE_CMD_LABEL */
+
+/* EOF */
index 3e3a67d..cdd683d 100644 (file)
@@ -33,32 +33,24 @@ VOID InitLocale (VOID)
 
        /* date settings */
        GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDATE, szBuffer, 256);
-#if !defined(_UNICODE) && !defined(UNICODE)    
-        CharToOem (szBuffer, szBuffer);
-#endif
+       CharToOem (szBuffer, szBuffer);
        cDateSeparator = szBuffer[0];
        GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_IDATE, szBuffer, 256);
        nDateFormat = _ttoi (szBuffer);
 
        /* time settings */
        GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STIME, szBuffer, 256);
-#if !defined(_UNICODE) && !defined(UNICODE)    
        CharToOem (szBuffer, szBuffer);
-#endif
        cTimeSeparator = szBuffer[0];
        GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_ITIME, szBuffer, 256);
        nTimeFormat = _ttoi (szBuffer);
 
        /* number settings */
        GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, szBuffer, 256);
-#if !defined(_UNICODE) && !defined(UNICODE)    
        CharToOem (szBuffer, szBuffer);
-#endif
        cThousandSeparator = szBuffer[0];
        GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, szBuffer, 256);
-#if !defined(_UNICODE) && !defined(UNICODE)    
        CharToOem (szBuffer, szBuffer);
-#endif
        cDecimalSeparator  = szBuffer[0];
        GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SGROUPING, szBuffer, 256);
        nNumberGroups = _ttoi (szBuffer);
@@ -67,9 +59,7 @@ VOID InitLocale (VOID)
        for (i = 0; i < 7; i++)
        {
                GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1 + i, szBuffer, 256);
-#if !defined(_UNICODE) && !defined(UNICODE)    
                CharToOem (szBuffer, szBuffer);
-#endif         
                _tcscpy (aszDayNames[(i+1)%7], szBuffer); /* little hack */
        }
 #endif
@@ -93,11 +83,11 @@ VOID InitLocale (VOID)
 
        /* days of week */
        for (i = 0; i < 7; i++)
-               _tcscpy (aszDayNames[i], names[i]);
+               _tcscpy(aszDayNames[i], names[i]);
 #endif
 
 #ifdef LOCALE_DEFAULT
-        LPTSTR names [7] = {_T("Sun"), _T("Mon"), _T("Tue"), _T("Wed"), _T("Thu"), _T("Fri"), _T("Sat")};
+       LPTSTR names [7] = {_T("Sun"), _T("Mon"), _T("Tue"), _T("Wed"), _T("Thu"), _T("Fri"), _T("Sat")};
        INT i;
 
        /* date settings */
@@ -131,63 +121,63 @@ VOID PrintDate (VOID)
        {
                case 0: /* mmddyy */
                default:
-            ConOutPrintf (_T("%s %02d%c%02d%c%04d"),
-                                         aszDayNames[st.wDayOfWeek], st.wMonth, cDateSeparator, st.wDay, cDateSeparator, st.wYear);
+                       ConOutPrintf(_T("%s %02d%c%02d%c%04d"),
+                                    aszDayNames[st.wDayOfWeek], st.wMonth, cDateSeparator, st.wDay, cDateSeparator, st.wYear);
                        break;
 
                case 1: /* ddmmyy */
-            ConOutPrintf (_T("%s %02d%c%02d%c%04d"),
-                                         aszDayNames[st.wDayOfWeek], st.wDay, cDateSeparator, st.wMonth, cDateSeparator, st.wYear);
+                       ConOutPrintf(_T("%s %02d%c%02d%c%04d"),
+                                    aszDayNames[st.wDayOfWeek], st.wDay, cDateSeparator, st.wMonth, cDateSeparator, st.wYear);
                        break;
 
                case 2: /* yymmdd */
-            ConOutPrintf (_T("%s %04d%c%02d%c%02d"),
-                                         aszDayNames[st.wDayOfWeek], st.wYear, cDateSeparator, st.wMonth, cDateSeparator, st.wDay);
+                       ConOutPrintf(_T("%s %04d%c%02d%c%02d"),
+                                    aszDayNames[st.wDayOfWeek], st.wYear, cDateSeparator, st.wMonth, cDateSeparator, st.wDay);
                        break;
        }
 #else
        TCHAR szDate[32];
 
-       GetDateFormat (LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL,
-                                  szDate, sizeof (szDate));
-       ConOutPrintf (_T("%s"), szDate);
+       GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL,
+                     szDate, sizeof (szDate));
+       ConOutPrintf(_T("%s"), szDate);
 #endif
 }
 
 
 VOID PrintTime (VOID)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
 #ifdef __REACTOS__
        SYSTEMTIME st;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
-       GetLocalTime (&st);
+       GetLocalTime(&st);
 
-       LoadString( GetModuleHandle(NULL), STRING_LOCALE_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
+       LoadString(GetModuleHandle(NULL), STRING_LOCALE_HELP1, szMsg, RC_STRING_MAX_SIZE);
 
        switch (nTimeFormat)
        {
                case 0: /* 12 hour format */
-               default:                        
-                       ConOutPrintf (_T("%s %2d%c%02d%c%02d%c%02d%c\n"),szMsg,
-                                       (st.wHour == 0 ? 12 : (st.wHour <= 12 ? st.wHour : st.wHour - 12)),
-                                       cTimeSeparator, st.wMinute, cTimeSeparator, st.wSecond, cDecimalSeparator,
-                                       st.wMilliseconds / 10, (st.wHour <= 11 ? 'a' : 'p'));
+               default:
+                       ConOutPrintf(_T("%s %2d%c%02d%c%02d%c%02d%c\n"), szMsg,
+                                    (st.wHour == 0 ? 12 : (st.wHour <= 12 ? st.wHour : st.wHour - 12)),
+                                    cTimeSeparator, st.wMinute, cTimeSeparator, st.wSecond, cDecimalSeparator,
+                                    st.wMilliseconds / 10, (st.wHour <= 11 ? _T('a') : _T('p')));
                        break;
 
                case 1: /* 24 hour format */
-                       ConOutPrintf (_T("%s %2d%c%02d%c%02d%c%02d\n"),szMsg,                   
-                                       st.wHour, cTimeSeparator, st.wMinute, cTimeSeparator,
-                                       st.wSecond, cDecimalSeparator, st.wMilliseconds / 10);
+                       ConOutPrintf(_T("%s %2d%c%02d%c%02d%c%02d\n"), szMsg,
+                                    st.wHour, cTimeSeparator, st.wMinute, cTimeSeparator,
+                                    st.wSecond, cDecimalSeparator, st.wMilliseconds / 10);
                        break;
        }
 #else
-    TCHAR szTime[32];
+       TCHAR szTime[32];
 
-    GetTimeFormat (LOCALE_USER_DEFAULT, 0, NULL, NULL,
-                                  szTime, sizeof (szTime));
+       GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, NULL,
+                     szTime, sizeof(szTime));
 
-    LoadString( GetModuleHandle(NULL), STRING_LOCALE_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-    ConOutPrintf (_T("%s: %s\n"),(LPTSTR)szMsg, szTime);
+       LoadString(GetModuleHandle(NULL), STRING_LOCALE_HELP1, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPrintf(_T("%s: %s\n"), szMsg, szTime);
 #endif
 }
index 0f37958..de821a0 100644 (file)
@@ -56,6 +56,7 @@ ConvertDWord (DWORD num, LPTSTR des, INT len, BOOL bSeparator)
 
 INT CommandMemory (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        MEMORYSTATUS ms;
        TCHAR szMemoryLoad[20];
        TCHAR szTotalPhys[20];
@@ -64,12 +65,11 @@ INT CommandMemory (LPTSTR cmd, LPTSTR param)
        TCHAR szAvailPageFile[20];
        TCHAR szTotalVirtual[20];
        TCHAR szAvailVirtual[20];
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_MEMMORY_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_MEMMORY_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -85,10 +85,10 @@ INT CommandMemory (LPTSTR cmd, LPTSTR param)
        ConvertDWord (ms.dwTotalVirtual, szTotalVirtual, 20, TRUE);
        ConvertDWord (ms.dwAvailVirtual, szAvailVirtual, 20, TRUE);
 
-       LoadString( GetModuleHandle(NULL), STRING_MEMMORY_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPrintf (szMsg,
-                     szMemoryLoad, szTotalPhys, szAvailPhys, szTotalPageFile,
-                     szAvailPageFile, szTotalVirtual, szAvailVirtual);
+       LoadString(GetModuleHandle(NULL), STRING_MEMMORY_HELP2, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPrintf(szMsg,
+                    szMemoryLoad, szTotalPhys, szAvailPhys, szTotalPageFile,
+                    szAvailPageFile, szTotalVirtual, szAvailVirtual);
 
        return 0;
 }
index e91fe37..161dc4a 100644 (file)
@@ -387,7 +387,7 @@ BOOL FileGetString (HANDLE hFile, LPTSTR lpBuffer, INT nBufferLength)
                        ReadFile (hFile, &ch, 1, &dwRead, NULL);
                        break;
                }
-                lpString[len++] = ch;
+               lpString[len++] = ch;
        }
 
        if (!dwRead && !len)
@@ -437,11 +437,11 @@ HWND GetConsoleWindow (VOID)
 
 INT PagePrompt (VOID)
 {
-       INPUT_RECORD ir;
        TCHAR szMsg[RC_STRING_MAX_SIZE];
+       INPUT_RECORD ir;
 
-       LoadString( GetModuleHandle(NULL), STRING_MISC_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPrintf(szMsg);            
+       LoadString(GetModuleHandle(NULL), STRING_MISC_HELP1, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPrintf(szMsg);
 
        RemoveBreakHandler ();
        ConInDisable ();
@@ -468,39 +468,35 @@ INT PagePrompt (VOID)
 
 INT FilePromptYN (LPTSTR szFormat, ...)
 {
-        TCHAR szOut[512];
-       va_list arg_ptr;
        TCHAR szMsg[RC_STRING_MAX_SIZE];
+       TCHAR szOut[512];
+       va_list arg_ptr;
+//     TCHAR cKey = 0;
+//     LPTSTR szKeys = _T("yna");
 
-//        TCHAR cKey = 0;
-//        LPTSTR szKeys = _T("yna");
-
-        TCHAR szIn[10];
+       TCHAR szIn[10];
        LPTSTR p;
 
        va_start (arg_ptr, szFormat);
        _vstprintf (szOut, szFormat, arg_ptr);
        va_end (arg_ptr);
 
-        ConOutPrintf (szFormat);
-
-/* preliminary fix */
-        ConInString (szIn, 10);
-        ConOutPrintf (_T("\n"));
+       ConOutPrintf (szFormat);
 
-        _tcsupr (szIn);
-        for (p = szIn; _istspace (*p); p++);
+       /* preliminary fix */
+       ConInString (szIn, 10);
+       ConOutPrintf (_T("\n"));
 
-       LoadString( GetModuleHandle(NULL), STRING_CHOICE_OPTION, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               
+       _tcsupr (szIn);
+       for (p = szIn; _istspace (*p); p++)
+               ;
 
-               
-       if (_tcsncmp(p,&szMsg[0],1)==0)
-           return PROMPT_YES;
-       else if (_tcsncmp(p,&szMsg[1],1)==0)
-           return PROMPT_NO;
+       LoadString(GetModuleHandle(NULL), STRING_CHOICE_OPTION, szMsg, RC_STRING_MAX_SIZE);
 
-       
+       if (_tcsncmp(p, &szMsg[0], 1) == 0)
+               return PROMPT_YES;
+       else if (_tcsncmp(p, &szMsg[1], 1) == 0)
+               return PROMPT_NO;
 #if 0
        else if (*p == _T('\03'))
                return PROMPT_BREAK;
@@ -509,7 +505,7 @@ INT FilePromptYN (LPTSTR szFormat, ...)
        return PROMPT_NO;
 
 
-/* unfinished sollution */
+       /* unfinished sollution */
 #if 0
        RemoveBreakHandler ();
        ConInDisable ();
@@ -517,9 +513,9 @@ INT FilePromptYN (LPTSTR szFormat, ...)
        do
        {
                ConInKey (&ir);
-                cKey = _totlower (ir.Event.KeyEvent.uChar.AsciiChar);
-                if (_tcschr (szKeys, cKey[0]) == NULL)
-                        cKey = 0;
+               cKey = _totlower (ir.Event.KeyEvent.uChar.AsciiChar);
+               if (_tcschr (szKeys, cKey[0]) == NULL)
+                       cKey = 0;
 
 
        }
@@ -542,38 +538,37 @@ INT FilePromptYN (LPTSTR szFormat, ...)
 
 INT FilePromptYNA (LPTSTR szFormat, ...)
 {
-        TCHAR szOut[512];
-       va_list arg_ptr;
-//        TCHAR cKey = 0;
-//        LPTSTR szKeys = _T("yna");
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-    
+       TCHAR szOut[512];
+       va_list arg_ptr;
+//     TCHAR cKey = 0;
+//     LPTSTR szKeys = _T("yna");
 
-        TCHAR szIn[10];
+       TCHAR szIn[10];
        LPTSTR p;
 
        va_start (arg_ptr, szFormat);
        _vstprintf (szOut, szFormat, arg_ptr);
        va_end (arg_ptr);
 
-        ConOutPrintf (szFormat);
+       ConOutPrintf (szFormat);
 
-/* preliminary fix */
-        ConInString (szIn, 10);
-        ConOutPrintf (_T("\n"));
+       /* preliminary fix */
+       ConInString (szIn, 10);
+       ConOutPrintf (_T("\n"));
 
-        _tcsupr (szIn);
-        for (p = szIn; _istspace (*p); p++);
+       _tcsupr (szIn);
+       for (p = szIn; _istspace (*p); p++)
+               ;
 
-       LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       
+       LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, szMsg, RC_STRING_MAX_SIZE);
 
-       if (_tcsncmp(p,&szMsg[0],1)==0)
-           return PROMPT_YES;
-       else if (_tcsncmp(p,&szMsg[1],1)==0)
-           return PROMPT_NO;
-       else if (_tcsncmp(p,&szMsg[2],1)==0)
-           return PROMPT_ALL;
+       if (_tcsncmp(p, &szMsg[0], 1) == 0)
+               return PROMPT_YES;
+       else if (_tcsncmp(p, &szMsg[1], 1) == 0)
+               return PROMPT_NO;
+       else if (_tcsncmp(p, &szMsg[2], 1) == 0)
+               return PROMPT_ALL;
 
 #if 0
        else if (*p == _T('\03'))
@@ -591,11 +586,9 @@ INT FilePromptYNA (LPTSTR szFormat, ...)
        do
        {
                ConInKey (&ir);
-                cKey = _totlower (ir.Event.KeyEvent.uChar.AsciiChar);
-                if (_tcschr (szKeys, cKey[0]) == NULL)
-                        cKey = 0;
-
-
+               cKey = _totlower (ir.Event.KeyEvent.uChar.AsciiChar);
+               if (_tcschr (szKeys, cKey[0]) == NULL)
+                       cKey = 0;
        }
        while ((ir.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT) ||
               (ir.Event.KeyEvent.wVirtualKeyCode == VK_MENU) ||
index 2827da6..9ad3684 100644 (file)
 
 static INT Overwrite (LPTSTR fn)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR inp[10];
        LPTSTR p;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
-       LoadString( GetModuleHandle(NULL), STRING_MOVE_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPrintf (szMsg, fn);       
-       ConInString (inp, 10);
+       LoadString(GetModuleHandle(NULL), STRING_MOVE_HELP1, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPrintf(szMsg, fn);
+       ConInString(inp, 10);
 
        _tcsupr (inp);
-       for (p=inp; _istspace (*p); p++)
+       for (p = inp; _istspace(*p); p++)
                ;
 
-       if (*p != _T('Y') && *p != _T('A'))
+       if (*p != szMsg[0] && *p != szMsg[2])
                return OVERWRITE_NO;
-       if (*p == _T('A'))
+       if (*p == szMsg[2])
                return OVERWRITE_ALL;
 
        return OVERWRITE_YES;
@@ -63,6 +63,7 @@ static INT Overwrite (LPTSTR fn)
 
 INT cmd_move (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        LPTSTR *arg;
        INT argc, i, nFiles;
        TCHAR szDestPath[MAX_PATH];
@@ -72,8 +73,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
        WIN32_FIND_DATA findBuffer;
        HANDLE hFile;
        LPTSTR pszFile;
-       BOOL   bNothing = FALSE;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
+       BOOL bNothing = FALSE;
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
@@ -92,8 +92,8 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
                               "  /-Y\n"
                               "..."));
 #else
-               LoadString( GetModuleHandle(NULL), STRING_MOVE_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPuts (szMsg);                     
+               LoadString(GetModuleHandle(NULL), STRING_MOVE_HELP2, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
 #endif
                return 0;
        }
@@ -101,8 +101,6 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
        arg = split (param, &argc, FALSE);
        nFiles = argc;
 
-       LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               
        /* read options */
        for (i = 0; i < argc; i++)
        {
@@ -114,14 +112,14 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
                        if (*p == _T('-'))
                        {
                                p++;
-                               if (_totupper (*p) ==  szMsg[0])
+                               if (_totupper (*p) == _T('Y'))
                                        bPrompt = TRUE;
                        }
                        else
                        {
-                               if (_totupper (*p) ==  szMsg[0])
+                               if (_totupper (*p) == _T('Y'))
                                        bPrompt = FALSE;
-                               else if  (_totupper (*p) ==  szMsg[1])
+                               else if (_totupper (*p) == _T('N'))
                                        bNothing = TRUE;
                        }
                        nFiles--;
@@ -194,11 +192,10 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
                                                if (!bNothing)
                                                {
                                                        if (MoveFile (szSrcPath, szFullDestPath))
-                                                               LoadString( GetModuleHandle(NULL), STRING_MOVE_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
+                                                               LoadString(GetModuleHandle(NULL), STRING_MOVE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
                                                        else
-                                                               LoadString( GetModuleHandle(NULL), STRING_MOVE_ERROR2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                                                       
-                            ConOutPrintf ((LPTSTR)szMsg);
+                                                               LoadString(GetModuleHandle(NULL), STRING_MOVE_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+                                                       ConOutPrintf(szMsg);
                                                }
                                        }
                                        else
@@ -218,10 +215,10 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
                                                        if (!bNothing)
                                                        {
                                                                if (MoveFile (szSrcPath, szDestPath))
-                                                                       LoadString( GetModuleHandle(NULL), STRING_MOVE_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
+                                                                       LoadString(GetModuleHandle(NULL), STRING_MOVE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
                                                                else
-                                                                       LoadString( GetModuleHandle(NULL), STRING_MOVE_ERROR2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                               ConOutPrintf ((LPTSTR)szMsg);
+                                                                       LoadString(GetModuleHandle(NULL), STRING_MOVE_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+                                                               ConOutPrintf(szMsg);
                                                        }
                                                }
                                        }
@@ -238,10 +235,10 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
                                        if (!bNothing)
                                        {
                                                if (MoveFile (szSrcPath, szFullDestPath))
-                                                       LoadString( GetModuleHandle(NULL), STRING_MOVE_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                        else
-                                                       LoadString( GetModuleHandle(NULL), STRING_MOVE_ERROR2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                                               ConOutPrintf ((LPTSTR)szMsg);                                           
+                                                       LoadString(GetModuleHandle(NULL), STRING_MOVE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+                                               else
+                                                       LoadString(GetModuleHandle(NULL), STRING_MOVE_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+                                               ConOutPrintf(szMsg);
                                        }
                                }
                        }
index 769924d..fd9cc65 100644 (file)
@@ -25,6 +25,8 @@
 
 INT CommandMsgbox (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
+
        //used to parse command line
        LPTSTR tmp;
 
@@ -32,20 +34,19 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param)
        //and to find window handle to pass to MessageBox
        HWND hWnd;
        TCHAR buff[128];
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        //these are MessabeBox() parameters
-       LPTSTR title, prompt="";
-       UINT uType=U_TYPE_INIT;
+       LPTSTR title, prompt = "";
+       UINT uType = U_TYPE_INIT;
 
-       //set default title to window title
-       GetConsoleTitle(buff,128);
+       /* set default title to window title */
+       GetConsoleTitle(buff, 128);
        title = buff;
 
        if (_tcsncmp (param, _T("/?"), 2) == 0)
        {
-               LoadString( GetModuleHandle(NULL), STRING_MSGBOX_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts(szMsg);                      
+               LoadString(GetModuleHandle(NULL), STRING_MSGBOX_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -56,27 +57,28 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param)
                param++;
 
        //search for type of messagebox (ok, okcancel, ...)
-       if (_tcsnicmp(param, _T("ok "),) == 0)
-       {       
+       if (_tcsnicmp(param, _T("ok "), 3) == 0)
+       {
                uType |= MB_ICONEXCLAMATION | MB_OK;
-               param+=3;
+               param += 3;
        }
-       else if (_tcsnicmp(param, _T("okcancel "),) == 0)
+       else if (_tcsnicmp(param, _T("okcancel "), 9) == 0)
        {
                uType |= MB_ICONQUESTION | MB_OKCANCEL;
-               param+=9;
+               param += 9;
        }
-       else if (_tcsnicmp(param, _T("yesno "),) == 0)
+       else if (_tcsnicmp(param, _T("yesno "), 6) == 0)
        {
                uType |= MB_ICONQUESTION | MB_YESNO;
-               param+=6;
+               param += 6;
        }
-       else if (_tcsnicmp(param, _T("yesnocancel "), 12 ) == 0)
+       else if (_tcsnicmp(param, _T("yesnocancel "), 12) == 0)
        {
                uType |= MB_ICONQUESTION | MB_YESNOCANCEL;
-               param+=12;
+               param += 12;
        }
-       else{
+       else
+       {
 #ifdef _SYNTAX_CHECK
                error_req_param_missing ();
                return 1;
@@ -93,7 +95,7 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param)
 #ifdef _SYNTAX_CHECK
        //if reached end of string
        //it is an error becuase we do not yet have prompt
-       if ( *param == 0)
+       if (*param == 0)
        {
                error_req_param_missing ();
                return 1;
@@ -103,24 +105,25 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param)
        //search for "title"
        tmp = param;
 
-       if(*param == '"')
+       if (*param == '"')
        {
-               tmp = _tcschr(param+1,'"');
+               tmp = _tcschr(param + 1, '"');
                if (tmp)
                {
                        *tmp = 0;
-               title = param+1;
-               tmp++;
-               param = tmp;
+                       title = param + 1;
+                       tmp++;
+                       param = tmp;
                }
        }
 
        //skip spaces
        while(_istspace(*param))
                param++;
+
 #ifdef _SYNTAX_CHECK
        //get prompt
-       if ( *param == 0)
+       if (*param == 0)
        {
                error_req_param_missing ();
                return 1;
@@ -130,28 +133,28 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param)
        prompt = param;
 
        hWnd=GetConsoleWindow ();
-//        DebugPrintf("FindWindow hWnd = %d\n",hWnd); 
-        ConErrPrintf("FindWindow hWnd = %d\n",hWnd); 
+//     DebugPrintf("FindWindow hWnd = %d\n",hWnd);
+//     ConErrPrintf("FindWindow hWnd = %d\n",hWnd);
 
-       switch (
-               MessageBox(hWnd,prompt,title,uType)
-               )
+       switch (MessageBox(hWnd, prompt, title, uType))
        {
-       case IDYES:
-       case IDOK:
-               nErrorLevel = 10;
-               break;
-
-       case IDNO:
-               nErrorLevel = 11;
-               break;
-
-       case IDCANCEL:
-               nErrorLevel = 12;
-               break;
+               case IDYES:
+               case IDOK:
+                       nErrorLevel = 10;
+                       break;
+
+               case IDNO:
+                       nErrorLevel = 11;
+                       break;
+
+               case IDCANCEL:
+                       nErrorLevel = 12;
+                       break;
        }
 
        return 0;
 }
 
 #endif /* INCLUDE_CMD_MSGBOX */
+
+/* EOF */
index 3978e35..d737bf8 100644 (file)
@@ -39,10 +39,9 @@ INT cmd_path (LPTSTR cmd, LPTSTR param)
        TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        if (!_tcsncmp (param, _T("/?"), 2))
-       {               
-               LoadString( GetModuleHandle(NULL), STRING_PATH_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);     
-
+       {
+               LoadString(GetModuleHandle(NULL), STRING_PATH_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -56,8 +55,8 @@ INT cmd_path (LPTSTR cmd, LPTSTR param)
                dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
                if (dwBuffer == 0)
                {
-                       LoadString( GetModuleHandle(NULL), STRING_PATH_ERROR, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                       ConErrPrintf (szMsg);   
+                       LoadString(GetModuleHandle(NULL), STRING_PATH_ERROR, szMsg, RC_STRING_MAX_SIZE);
+                       ConErrPrintf(szMsg);
                        return 0;
                }
                else if (dwBuffer > ENV_BUFFER_SIZE)
@@ -84,3 +83,5 @@ INT cmd_path (LPTSTR cmd, LPTSTR param)
 }
 
 #endif
+
+/* EOF */
index 4f6565a..faa3d67 100644 (file)
@@ -45,9 +45,8 @@ INT cmd_pause (LPTSTR cmd, LPTSTR param)
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_PAUSE_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);     
-
+               LoadString(GetModuleHandle(NULL), STRING_PAUSE_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -62,3 +61,5 @@ INT cmd_pause (LPTSTR cmd, LPTSTR param)
 }
 
 #endif
+
+/* EOF */
index adf4851..2d6e2b5 100644 (file)
@@ -51,7 +51,6 @@
 
 /*
  * print the command-line prompt
- *
  */
 VOID PrintPrompt(VOID)
 {
@@ -186,15 +185,15 @@ INT cmd_prompt (LPTSTR cmd, LPTSTR param)
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_PROMPT_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);
+               LoadString(GetModuleHandle(NULL), STRING_PROMPT_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
 
 #ifdef FEATURE_DIRECTORY_STACK
-               LoadString( GetModuleHandle(NULL), STRING_PROMPT_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);             
+               LoadString(GetModuleHandle(NULL), STRING_PROMPT_HELP2, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
 #endif
-               LoadString( GetModuleHandle(NULL), STRING_PROMPT_HELP3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);     
+               LoadString(GetModuleHandle(NULL), STRING_PROMPT_HELP3, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -205,3 +204,5 @@ INT cmd_prompt (LPTSTR cmd, LPTSTR param)
        return 0;
 }
 #endif
+
+/* EOF */
index 2f301bd..848f5a9 100644 (file)
@@ -43,6 +43,7 @@ enum
  */
 INT cmd_rename (LPTSTR cmd, LPTSTR param)
 {
+  TCHAR szMsg[RC_STRING_MAX_SIZE];
   LPTSTR *arg = NULL;
   INT args = 0;
   INT nEvalArgs = 0; /* nunber of evaluated arguments */
@@ -58,15 +59,13 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param)
 
   HANDLE hFile;
   WIN32_FIND_DATA f;
-  TCHAR szMsg[RC_STRING_MAX_SIZE];
 
   if (!_tcsncmp(param, _T("/?"), 2))
-    {
-       LoadString( GetModuleHandle(NULL), STRING_REN_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       ConOutPuts(szMsg);
-
-       return(0);
-    }
+  {
+    LoadString(GetModuleHandle(NULL), STRING_REN_HELP1, szMsg, RC_STRING_MAX_SIZE);
+    ConOutPuts(szMsg);
+    return 0;
+  }
 
   /* split the argument list */
   arg = split(param, &args, FALSE);
@@ -76,7 +75,7 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param)
       if (!(dwFlags & REN_ERROR))
        error_req_param_missing();
       freep(arg);
-      return(1);
+      return 1;
     }
 
   /* read options */
@@ -127,7 +126,7 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param)
       if (!(dwFlags & REN_ERROR))
        error_req_param_missing();
       freep(arg);
-      return(1);
+      return 1;
     }
 
   /* get destination pattern */
@@ -239,8 +238,8 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param)
                {
                  if (!(dwFlags & REN_ERROR))
                  {
-                   LoadString( GetModuleHandle(NULL), STRING_REN_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                   ConErrPrintf (szMsg, GetLastError());
+                   LoadString(GetModuleHandle(NULL), STRING_REN_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+                   ConErrPrintf(szMsg, GetLastError());
                  }
                }
            }
@@ -250,20 +249,17 @@ INT cmd_rename (LPTSTR cmd, LPTSTR param)
     }
 
   if (!(dwFlags & REN_QUIET))
-    {
-       if (dwFiles == 1)
-         LoadString( GetModuleHandle(NULL), STRING_REN_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-       else
-         LoadString( GetModuleHandle(NULL), STRING_REN_HELP3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-    
-       ConOutPrintf(szMsg,dwFiles);    
-    }
+  {
+    if (dwFiles == 1)
+      LoadString( GetModuleHandle(NULL), STRING_REN_HELP2, szMsg, RC_STRING_MAX_SIZE);
+    else
+      LoadString( GetModuleHandle(NULL), STRING_REN_HELP3, szMsg, RC_STRING_MAX_SIZE);
+    ConOutPrintf((LPTSTR)szMsg,dwFiles);
+  }
 
-       
-  
   freep(arg);
 
-  return(0);
+  return 0;
 }
 
 #endif
index 2756f1c..820b5d0 100644 (file)
@@ -4,24 +4,23 @@
 #define STRING_ERROR_PARAMETERF_ERROR      100\r
 #define STRING_ERROR_INVALID_SWITCH        101\r
 #define STRING_ERROR_TOO_MANY_PARAMETERS   102\r
-#define STRING_ERROR_PATH_NOT_FOUND       103\r
-#define STRING_ERROR_FILE_NOT_FOUND       104\r
-#define STRING_ERROR_REQ_PARAM_MISSING            105\r
-#define STRING_ERROR_INVALID_DRIVE                106\r
+#define STRING_ERROR_PATH_NOT_FOUND        103\r
+#define STRING_ERROR_FILE_NOT_FOUND        104\r
+#define STRING_ERROR_REQ_PARAM_MISSING     105\r
+#define STRING_ERROR_INVALID_DRIVE         106\r
 #define STRING_ERROR_INVALID_PARAM_FORMAT  107\r
-#define STRING_ERROR_BADCOMMAND                   108\r
-#define STRING_ERROR_OUT_OF_MEMORY                109\r
-#define STRING_ERROR_CANNOTPIPE                   110\r
-#define STRING_ERROR_D_PAUSEMSG                   111\r
+#define STRING_ERROR_BADCOMMAND            108\r
+#define STRING_ERROR_OUT_OF_MEMORY         109\r
+#define STRING_ERROR_CANNOTPIPE            110\r
+#define STRING_ERROR_D_PAUSEMSG            111\r
 #define STRING_ERROR_DRIVER_NOT_READY      112\r
 \r
 #define STRING_CHOICE_OPTION               200\r
 #define STRING_COPY_OPTION                 201\r
-#define STRING_DEL_OPTION                  202\r
 \r
 #define STRING_ALIAS_ERROR                 300\r
 #define STRING_BATCH_ERROR                 301\r
-#define STRING_CHCP_ERROR1                 302 \r
+#define STRING_CHCP_ERROR1                 302\r
 #define STRING_CHCP_ERROR2                 303\r
 #define STRING_CHCP_ERROR3                 304\r
 #define STRING_CHCP_ERROR4                 305\r
 #define STRING_COPY_ERROR3                 321\r
 #define STRING_COPY_ERROR4                 322\r
 #define STRING_DATE_ERROR                  323\r
-#define STRING_DEL_ERROR1                  324\r
-#define STRING_DEL_ERROR2                  325\r
-#define STRING_DEL_ERROR3                  326\r
-#define STRING_DEL_ERROR4                  327\r
 #define STRING_DEL_ERROR5                  328\r
 #define STRING_DEL_ERROR6                  329\r
 #define STRING_DEL_ERROR7                  330\r
-#define STRING_DEL_ERROR8                  331\r
 #define STRING_ERROR_ERROR1                332\r
 #define STRING_ERROR_ERROR2                333\r
-#define STRING_FOR_ERROR1                  334 \r
+#define STRING_FOR_ERROR1                  334\r
 #define STRING_FOR_ERROR2                  335\r
 #define STRING_FOR_ERROR3                  336\r
 #define STRING_FOR_ERROR4                  337\r
@@ -61,7 +55,7 @@
 #define STRING_FREE_ERROR2                 339\r
 #define STRING_GOTO_ERROR1                 340\r
 #define STRING_GOTO_ERROR2                 341\r
-#define STRING_MOVE_ERROR1                 342                \r
+#define STRING_MOVE_ERROR1                 342\r
 #define STRING_MOVE_ERROR2                 343\r
 #define STRING_PARAM_ERROR                 344\r
 #define STRING_PATH_ERROR                  345\r
@@ -81,7 +75,7 @@
 #define STRING_CHCP_HELP                   605\r
 #define STRING_CHOICE_HELP                 606\r
 #define STRING_CLS_HELP                    607\r
-#define STRING_CMD_HELP1                   608 \r
+#define STRING_CMD_HELP1                   608\r
 #define STRING_CMD_HELP2                   609\r
 #define STRING_CMD_HELP3                   610\r
 #define STRING_CMD_HELP4                   611\r
 #define STRING_DATE_HELP3                  621\r
 #define STRING_DATE_HELP4                  622\r
 #define STRING_DEL_HELP1                   623\r
-#define STRING_DEL_HELP2                      624\r
+#define STRING_DEL_HELP2                   624\r
 #define STRING_DEL_HELP3                   625\r
 #define STRING_DEL_HELP4                   626\r
-#define STRING_DELAY_HELP                  627 \r
+#define STRING_DELAY_HELP                  627\r
 \r
-#define STRING_DIR_HELP1                   628 \r
+#define STRING_DIR_HELP1                   628\r
 #define STRING_DIR_HELP2                   629\r
 #define STRING_DIR_HELP3                   630\r
 #define STRING_DIR_HELP4                   631\r
 #define STRING_ECHO_HELP1                  640\r
 #define STRING_ECHO_HELP2                  641\r
 #define STRING_ECHO_HELP3                  642\r
-#define STRING_ECHO_HELP4                  643 \r
-#define STRING_ECHO_HELP5                  644 \r
+#define STRING_ECHO_HELP4                  643\r
+#define STRING_ECHO_HELP5                  644\r
 \r
 #define STRING_EXIT_HELP                   645\r
 \r
 #define STRING_FOR_HELP1                   646\r
 \r
-#define STRING_FREE_HELP1                  647 \r
+#define STRING_FREE_HELP1                  647\r
 #define STRING_FREE_HELP2                  648\r
 \r
 #define STRING_IF_HELP1                    650\r
 #define STRING_MOVE_HELP1                  662\r
 #define STRING_MOVE_HELP2                  663\r
 \r
-#define STRING_MSGBOX_HELP                 664 \r
+#define STRING_MSGBOX_HELP                 664\r
 \r
 #define STRING_PATH_HELP1                  665\r
 \r
 #define STRING_VERSION_HELP4               690\r
 #define STRING_VERSION_HELP5               691\r
 #define STRING_VERSION_HELP6               692\r
+#define STRING_VERSION_HELP7               693\r
 \r
-#define STRING_VOL_HELP1                   69\r
-#define STRING_VOL_HELP2                   694\r
-#define STRING_VOL_HELP3                   695\r
-#define STRING_VOL_HELP4                   696\r
+#define STRING_VOL_HELP1                   694\r
+#define STRING_VOL_HELP2                   695\r
+#define STRING_VOL_HELP3                   696\r
+#define STRING_VOL_HELP4                   697\r
 \r
-#define STRING_WINDOW_HELP1                697\r
-#define STRING_WINDOW_HELP2                698\r
+#define STRING_WINDOW_HELP1                698\r
+#define STRING_WINDOW_HELP2                699\r
 \r
-#define STRING_FreeDOS_DEV                 800\r
+/* These strings are language independent (cmd.rc) */\r
+#define STRING_FREEDOS_DEV                 800\r
 #define STRING_REACTOS_DEV                 801\r
 \r
-\r
-\r
-\r
-\r
-  \r
-\r
-\r
-\r
-\r
+/* EOF */\r
index 9f78820..5693fae 100644 (file)
 
 INT CommandScreen (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        SHORT x,y;
        BOOL bSkipText = FALSE;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        if (_tcsncmp (param, _T("/?"), 2) == 0)
        {
-               LoadString( GetModuleHandle(NULL), STRING_SCREEN_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts((LPTSTR)szMsg);      
-
+               LoadString(GetModuleHandle(NULL), STRING_SCREEN_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
index 99dbffc..1ff7c16 100644 (file)
 
 INT cmd_set (LPTSTR cmd, LPTSTR param)
 {
-       LPTSTR p;
        TCHAR szMsg[RC_STRING_MAX_SIZE];
+       LPTSTR p;
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-           LoadString( GetModuleHandle(NULL), STRING_SET_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-           ConOutPuts (szMsg); 
-
+               LoadString(GetModuleHandle(NULL), STRING_SET_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
index d545997..e18a1b5 100644 (file)
@@ -47,9 +47,8 @@ INT cmd_shift (LPTSTR cmd, LPTSTR param)
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_SHIFT_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
+               LoadString(GetModuleHandle(NULL), STRING_SHIFT_HELP, szMsg, RC_STRING_MAX_SIZE);
                ConOutPuts(szMsg);
-
                return 0;
        }
 
@@ -69,3 +68,5 @@ INT cmd_shift (LPTSTR cmd, LPTSTR param)
 
        return 0;
 }
+
+/* EOF */
index 5af7442..2065459 100644 (file)
 
 INT cmd_start (LPTSTR first, LPTSTR rest)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR szFullName[MAX_PATH];
        BOOL bWait = FALSE;
        TCHAR *param;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        if (_tcsncmp (rest, _T("/?"), 2) == 0)
        {
-               
-               LoadString( GetModuleHandle(NULL), STRING_START_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts(szMsg);      
-
+               LoadString(GetModuleHandle(NULL), STRING_START_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -47,11 +45,13 @@ INT cmd_start (LPTSTR first, LPTSTR rest)
 
                return 0;
        }
+
        if( !*rest )
          {
            // FIXME: use comspec instead
            rest = _T("cmd");
          }
+
        /* get the PATH environment variable and parse it */
        /* search the PATH environment variable for the binary */
        param = _tcschr( rest, _T(' ') );  // skip program name to reach parameters
@@ -60,21 +60,23 @@ INT cmd_start (LPTSTR first, LPTSTR rest)
            *param = 0;
            param++;
          }
+
        if (!SearchForExecutable (rest, szFullName))
        {
                error_bad_command ();
                return 1;
        }
+
        /* check if this is a .BAT or .CMD file */
        if (!_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".bat")) ||
-               !_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".cmd")))
+           !_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".cmd")))
        {
 #ifdef _DEBUG
                DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest);
 #endif
 
-               LoadString( GetModuleHandle(NULL), STRING_START_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPuts (szMsg);                     
+               LoadString(GetModuleHandle(NULL), STRING_START_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPuts(szMsg);
        }
        else
        {
@@ -101,7 +103,7 @@ INT cmd_start (LPTSTR first, LPTSTR rest)
                stui.wShowWindow = SW_SHOWDEFAULT;
                        
                if (CreateProcess (szFullName, szFullCmdLine, NULL, NULL, FALSE,
-                                                  CREATE_NEW_CONSOLE, NULL, NULL, &stui, &prci))
+                                  CREATE_NEW_CONSOLE, NULL, NULL, &stui, &prci))
                {
                        if (bWait)
                        {
@@ -115,8 +117,8 @@ INT cmd_start (LPTSTR first, LPTSTR rest)
                }
                else
                {
-                       ErrorMessage (GetLastError (),
-                                                 _T("Error executing CreateProcess()!!\n"));
+                       ErrorMessage(GetLastError (),
+                                     _T("Error executing CreateProcess()!!\n"));
                }
        }
 
index 3f08c67..5aee0c1 100644 (file)
@@ -174,11 +174,11 @@ static
 WORD txt_clr(LPTSTR str)
 {
        INT i;
-       
-       for(i=0;*(clrtable[i].name);i++)
-               if(     _tcsnicmp(str,clrtable[i].name,_tcslen(clrtable[i].name)) == 0)                 
+
+       for(i = 0; *(clrtable[i].name); i++)
+               if (_tcsnicmp(str, clrtable[i].name, _tcslen(clrtable[i].name)) == 0)
                        return clrtable[i].val;
-       
+
        return (WORD)-1;
 }
 
@@ -188,37 +188,35 @@ WORD txt_clr(LPTSTR str)
 static
 WORD str_to_color(LPTSTR* arg_str)
 {
-       LPTSTR str;     
+       LPTSTR str;
        BOOL bBri;
 
        WORD tmp_clr,ret_clr;
 
        str = *arg_str;
 
-
-       
-       if(!(*str))
+       if (!(*str))
                return (WORD)-1;
 
 
        /*foreground*/
-        bBri = FALSE;
+       bBri = FALSE;
 
-       if(_tcsnicmp(str,_T("bri"),3) == 0 )
+       if (_tcsnicmp(str,_T("bri"),3) == 0)
        {
                bBri = TRUE;
 
-               if(chop_blank(&str))
+               if (chop_blank(&str))
                        return (WORD)-1;
        }
 
-       if( (tmp_clr = txt_clr(str)) == (WORD)-1 )
+       if ((tmp_clr = txt_clr(str)) == (WORD)-1)
        {
                return (WORD)-1;
        }
 
-       /*skip spaces and "on"*/        
-       if ( chop_blank(&str) || chop_blank(&str) )
+       /*skip spaces and "on"*/
+       if (chop_blank(&str) || chop_blank(&str))
                return (WORD)-1;
 
        ret_clr = tmp_clr | (bBri << 3);
index 9c484f1..3a9e99c 100644 (file)
@@ -21,7 +21,7 @@
  *        Fixed time input bug.
  *
  *    30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- *        Remove all hardcode string to En.rc  
+ *        Remove all hardcode string to En.rc.
  */
 
 #include "precomp.h"
@@ -132,18 +132,17 @@ static BOOL ParseTime (LPTSTR s)
 
 INT cmd_time (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        LPTSTR *arg;
        INT    argc;
        INT    i;
        BOOL   bPrompt = TRUE;
        INT    nTimeString = -1;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
-
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_TIME_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts(szMsg);      
+               LoadString(GetModuleHandle(NULL), STRING_TIME_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -175,8 +174,8 @@ INT cmd_time (LPTSTR cmd, LPTSTR param)
                {
                        TCHAR  s[40];
 
-                       LoadString( GetModuleHandle(NULL), STRING_TIME_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-                       ConOutPrintf (szMsg);
+                       LoadString(GetModuleHandle(NULL), STRING_TIME_HELP2, szMsg, RC_STRING_MAX_SIZE);
+                       ConOutPrintf(szMsg);
 
                        ConInString (s, 40);
 
@@ -204,8 +203,9 @@ INT cmd_time (LPTSTR cmd, LPTSTR param)
                        /* force input the next time around. */
                        nTimeString = -1;
                }
-               LoadString( GetModuleHandle(NULL), STRING_TIME_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConErrPuts (szMsg);                     
+
+               LoadString(GetModuleHandle(NULL), STRING_TIME_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPuts(szMsg);
        }
 
        freep (arg);
index 235dc90..84b1217 100644 (file)
@@ -47,8 +47,8 @@ PrintElapsedTime (DWORD time,INT format)
        switch (format)
        {
        case 0:
-               LoadString( GetModuleHandle(NULL), STRING_TIMER_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPrintf(szMsg,time);
+               LoadString(GetModuleHandle(NULL), STRING_TIMER_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPrintf(szMsg, time);
                break;
 
        case 1:
@@ -56,13 +56,13 @@ PrintElapsedTime (DWORD time,INT format)
                time /= 1000;
                s = time % 60;
                time /=60;
-               m = time % 60;          
+               m = time % 60;
                h = time / 60;
-               LoadString( GetModuleHandle(NULL), STRING_TIMER_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
+               LoadString( GetModuleHandle(NULL), STRING_TIMER_HELP2, szMsg, RC_STRING_MAX_SIZE);
                ConOutPrintf(szMsg,
-                            h,cTimeSeparator,
-                            m,cTimeSeparator,
-                            s,cDecimalSeparator,ms/10);
+                            h, cTimeSeparator,
+                            m, cTimeSeparator,
+                            s, cDecimalSeparator, ms/10);
                break;
        }
 }
@@ -104,8 +104,8 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
 
        if (_tcsncmp (param, _T("/?"), 2) == 0)
        {
-               LoadString( GetModuleHandle(NULL), STRING_TIMER_HELP3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPrintf (szMsg,cTimeSeparator,cTimeSeparator,cDecimalSeparator);           
+               LoadString(GetModuleHandle(NULL), STRING_TIMER_HELP3, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPrintf(szMsg, cTimeSeparator, cTimeSeparator, cDecimalSeparator);
                return 0;
        }
 
@@ -132,7 +132,6 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
                // other options
                if (p[i][0] == _T('/'))
                {
-
                        // set timer number
                        if (_istdigit(p[i][1]) && bCanNSet)
                        {
@@ -149,7 +148,7 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
                        }
                        
                        // specify format
-                       if(_totupper(p[i][1]) == _T('F'))
+                       if (_totupper(p[i][1]) == _T('F'))
                        {
                                iFormat = p[i][2] - _T('0');
                                continue;
@@ -184,9 +183,10 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
                return 0;
        }
 
-       if(NewClkStatus == NCS_NOT_SPECIFIED)
-       {       
-               if(cS){
+       if (NewClkStatus == NCS_NOT_SPECIFIED)
+       {
+               if (cS)
+               {
                        cS=FALSE;
                        PS;
                        PrintElapsedTime(GetTickCount()-cT, iFormat);
@@ -202,9 +202,9 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
        }
 
 
-       if(NewClkStatus == NCS_OFF)
+       if (NewClkStatus == NCS_OFF)
        {
-               if(cS)
+               if (cS)
                {
                        cS=FALSE;
                        PS;
index 424f158..93eb9e9 100644 (file)
@@ -26,8 +26,8 @@ INT cmd_title (LPTSTR cmd, LPTSTR param)
        /* Asking help? */
        if (!_tcsncmp(param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_TITLE_HELP, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts(szMsg);      
+               LoadString(GetModuleHandle(NULL), STRING_TITLE_HELP, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
index 286f149..a187f79 100644 (file)
@@ -34,6 +34,7 @@
 
 INT cmd_type (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR  buff[256];
        HANDLE hFile, hConsoleOut;
        DWORD  dwRead;
@@ -42,14 +43,13 @@ INT cmd_type (LPTSTR cmd, LPTSTR param)
        INT    argc,i;
        LPTSTR *argv;
        LPTSTR errmsg;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
-       
+
        hConsoleOut=GetStdHandle (STD_OUTPUT_HANDLE);
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_TYPE_HELP1, (LPTSTR) szMsg,sizeof(szMsg));
-               ConOutPuts (szMsg);     
+               LoadString(GetModuleHandle(NULL), STRING_TYPE_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -65,10 +65,11 @@ INT cmd_type (LPTSTR cmd, LPTSTR param)
        {
                if (_T('/') == argv[i][0])
                {
-                       LoadString( GetModuleHandle(NULL), STRING_TYPE_ERROR1, (LPTSTR) szMsg,sizeof(szMsg));
-                       ConErrPrintf (szMsg, argv[i] + 1);
+                       LoadString(GetModuleHandle(NULL), STRING_TYPE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+                       ConErrPrintf(szMsg, argv[i] + 1);
                        continue;
                }
+
                hFile = CreateFile(argv[i],
                        GENERIC_READ,
                        FILE_SHARE_READ,NULL,
@@ -101,8 +102,8 @@ INT cmd_type (LPTSTR cmd, LPTSTR param)
                } while(dwRead>0 && bRet);
 
                CloseHandle(hFile);
-       }       
-       
+       }
+
        freep (argv);
 
        return 0;
index ae39988..1f250dd 100644 (file)
@@ -63,29 +63,26 @@ VOID ShortVersion (VOID)
  */
 INT cmd_ver (LPTSTR cmd, LPTSTR param)
 {
-       INT i;
        TCHAR szMsg[RC_STRING_MAX_SIZE];
-       TCHAR rosdev[RC_STRING_MAX_SIZE];
-       TCHAR fredev[RC_STRING_MAX_SIZE];
+       INT i;
 
        if (_tcsstr (param, _T("/?")) != NULL)
        {
-               LoadString( GetModuleHandle(NULL), STRING_VERSION_HELP1, (LPTSTR) szMsg,sizeof(szMsg));
-               ConOutPuts (szMsg);     
-
+               LoadString(GetModuleHandle(NULL), STRING_VERSION_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
        ShortVersion();
        ConOutPuts (_T("Copyright (C) 1994-1998 Tim Norman and others."));
-       ConOutPuts (_T("Copyright (C) 1998-2001 Eric Kohl and others."));
+       ConOutPuts (_T("Copyright (C) 1998-2005 Eric Kohl and others."));
 
        /* Basic copyright notice */
        if (param[0] == _T('\0'))
        {
-               ConOutPuts (_T("\n"SHELLINFO));
-               LoadString( GetModuleHandle(NULL), STRING_VERSION_HELP2, (LPTSTR) szMsg,sizeof(szMsg));
-               ConOutPuts (szMsg);     
+               ConOutPuts(_T("\n"SHELLINFO));
+               LoadString(GetModuleHandle(NULL), STRING_VERSION_HELP2, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
        }
        else
        {
@@ -109,38 +106,26 @@ INT cmd_ver (LPTSTR cmd, LPTSTR param)
                        if (_totupper (param[i]) == _T('W'))
                        {
                                /* Warranty notice */
-                               LoadString( GetModuleHandle(NULL), STRING_VERSION_HELP3, (LPTSTR) szMsg,sizeof(szMsg));
-                               ConOutPuts (szMsg);     
+                               LoadString(GetModuleHandle(NULL), STRING_VERSION_HELP3, szMsg, RC_STRING_MAX_SIZE);
+                               ConOutPuts(szMsg);
                        }
                        else if (_totupper (param[i]) == _T('R'))
                        {
                                /* Redistribution notice */
-                               LoadString( GetModuleHandle(NULL), STRING_VERSION_HELP4, (LPTSTR) szMsg,sizeof(szMsg));
-                               ConOutPuts (szMsg);                                     
+                               LoadString(GetModuleHandle(NULL), STRING_VERSION_HELP4, szMsg, RC_STRING_MAX_SIZE);
+                               ConOutPuts(szMsg);
                        }
                        else if (_totupper (param[i]) == _T('C'))
                        {
                                /* Developer listing */
-                               
-                               LoadString( GetModuleHandle(NULL), STRING_REACTOS_DEV, rosdev,sizeof(rosdev)/sizeof(TCHAR));
-                               LoadString( GetModuleHandle(NULL), STRING_FreeDOS_DEV, fredev,sizeof(fredev)/sizeof(TCHAR));
-                               LoadString( GetModuleHandle(NULL), STRING_VERSION_HELP6, (LPTSTR) szMsg,sizeof(szMsg));                 
-                               ConOutPrintf ((LPTSTR)szMsg,fredev,rosdev);
-                               
-                               /*
-                               ConOutPuts (_T("\n"
-                                              "FreeDOS version written by:\n"
-                                              "    Tim Norman      Matt Rains\n"
-                                              "    Evan Jeffrey    Steffen Kaiser\n"
-                                              "    Svante Frey     Oliver Mueller\n"
-                                              "    Aaron Kaufman   Marc Desrochers\n"
-                                              "    Rob Lake        John P Price\n"
-                                              "    Hans B Pufal\n"
-                                              "\n"
-                                              "ReactOS version written by:\n"
-                                              "    Eric Kohl       Emanuele Aliberti\n"
-                                              "    Paolo Pantaleo  Phillip Susi\n"));
-                          */
+                               LoadString(GetModuleHandle(NULL), STRING_VERSION_HELP6, szMsg, RC_STRING_MAX_SIZE);
+                               ConOutPrintf(szMsg);
+                               LoadString(GetModuleHandle(NULL), STRING_FREEDOS_DEV, szMsg, RC_STRING_MAX_SIZE);
+                               ConOutPrintf(szMsg);
+                               LoadString(GetModuleHandle(NULL), STRING_VERSION_HELP7, szMsg, RC_STRING_MAX_SIZE);
+                               ConOutPrintf(szMsg);
+                               LoadString(GetModuleHandle(NULL), STRING_REACTOS_DEV, szMsg, RC_STRING_MAX_SIZE);
+                               ConOutPrintf(szMsg);
                        }
                        else
                        {
@@ -150,8 +135,8 @@ INT cmd_ver (LPTSTR cmd, LPTSTR param)
                }
        }
 
-       LoadString( GetModuleHandle(NULL), STRING_VERSION_HELP5, (LPTSTR) szMsg,sizeof(szMsg));
-       ConOutPuts (szMsg);     
+       LoadString(GetModuleHandle(NULL), STRING_VERSION_HELP5, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPuts(szMsg);
        return 0;
 }
 
index ed7ce70..0ac13ef 100644 (file)
@@ -34,23 +34,25 @@ INT cmd_verify (LPTSTR cmd, LPTSTR param)
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_VERIFY_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPuts (szMsg);     
+               LoadString(GetModuleHandle(NULL), STRING_VERIFY_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
        if (!*param)
        {
-               LoadString( GetModuleHandle(NULL), STRING_VERIFY_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPrintf (szMsg, bVerify ? D_ON : D_OFF);
+               LoadString(GetModuleHandle(NULL), STRING_VERIFY_HELP2, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPrintf((LPTSTR)szMsg, bVerify ? D_ON : D_OFF);
        }
        else if (_tcsicmp (param, D_OFF) == 0)
                bVerify = FALSE;
        else if (_tcsicmp (param, D_ON) == 0)
                bVerify = TRUE;
-       else            
-           LoadString( GetModuleHandle(NULL), STRING_VERIFY_HELP3, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-        ConOutPuts (szMsg);    
+       else
+       {
+               LoadString(GetModuleHandle(NULL), STRING_VERIFY_HELP3, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
+       }
 
        return 0;
 }
index c58d236..45bf0f4 100644 (file)
 static INT
 PrintVolumeHeader (LPTSTR pszRootPath)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR szVolName[80];
        DWORD dwSerialNr;
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
-
 
        /* get the volume information of the drive */
        if(!GetVolumeInformation (pszRootPath,
@@ -49,44 +48,34 @@ PrintVolumeHeader (LPTSTR pszRootPath)
        }
 
        /* print drive info */
-       
-       
-    
-
        if (szVolName[0] != '\0')
        {
-               LoadString( GetModuleHandle(NULL), STRING_VOL_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPrintf (szMsg, pszRootPath[0],szVolName);
+               LoadString(GetModuleHandle(NULL), STRING_VOL_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPrintf(szMsg, pszRootPath[0],szVolName);
        }
        else
        {
-               LoadString( GetModuleHandle(NULL), STRING_VOL_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPrintf (szMsg, pszRootPath[0]);
+               LoadString(GetModuleHandle(NULL), STRING_VOL_HELP2, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPrintf(szMsg, pszRootPath[0]);
        }
 
-       
-       
-
        /* print the volume serial number */
-       LoadString( GetModuleHandle(NULL), STRING_VOL_HELP3, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-       ConOutPrintf (szMsg,
-                     HIWORD(dwSerialNr),
-                     LOWORD(dwSerialNr));
+       LoadString(GetModuleHandle(NULL), STRING_VOL_HELP3, szMsg, RC_STRING_MAX_SIZE);
+       ConOutPrintf(szMsg, HIWORD(dwSerialNr), LOWORD(dwSerialNr));
        return 0;
 }
 
 
 INT cmd_vol (LPTSTR cmd, LPTSTR param)
 {
+       TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR szRootPath[] = _T("A:\\");
        TCHAR szPath[MAX_PATH];
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_VOL_HELP4, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPuts ((LPTSTR)szMsg);     
-
+               LoadString(GetModuleHandle(NULL), STRING_VOL_HELP4, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
index 30396af..ec2a37e 100644 (file)
@@ -233,29 +233,29 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
        DebugPrintf (_T("SearchForExecutable(): Loaded PATHEXT: %s\n"), pszBuffer);
 #endif
 
-       pExt = _tcsrchr(pFileName, _T('.'));
+       pExt = _tcsrchr(pFileName, _T('.'));
        if (pExt != NULL)
        {
-               LPTSTR pszBuffer2;
-                       pszBuffer2 = _tcsdup(pszBuffer);
-               if (pszBuffer2)
-               {
-                       pCh = _tcstok(pszBuffer2, _T(";"));
-                       while (pCh)
-                       {
-                               if (0 == _tcsicmp(pCh, pExt))
-                               {
+               LPTSTR pszBuffer2;
+               pszBuffer2 = _tcsdup(pszBuffer);
+               if (pszBuffer2)
+               {
+                       pCh = _tcstok(pszBuffer2, _T(";"));
+                       while (pCh)
+                       {
+                               if (0 == _tcsicmp(pCh, pExt))
+                               {
                                        free(pszBuffer);
                                        free(pszBuffer2);
-                                       return SearchForExecutableSingle(pFileName, pFullName, NULL);
-                               }
-                               pCh = _tcstok(NULL, _T(";"));
-                       }
-                       free(pszBuffer2);
-               }
+                                       return SearchForExecutableSingle(pFileName, pFullName, NULL);
+                               }
+                               pCh = _tcstok(NULL, _T(";"));
+                       }
+                       free(pszBuffer2);
+               }
        }
 
-       pCh = _tcstok(pszBuffer, _T(";"));
+       pCh = _tcstok(pszBuffer, _T(";"));
        while (pCh)
        {
                if (SearchForExecutableSingle(pFileName, pFullName, pCh))
@@ -269,3 +269,5 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
        free(pszBuffer);
        return FALSE;
 }
+
+/* EOF */
index 85cd4f8..5c3254d 100644 (file)
 
 */
 
-static
-INT ServiceActivate (LPTSTR param, HWND hWnd)
+static INT ServiceActivate (LPTSTR param, HWND hWnd)
 {
-       LPTSTR *p=0,p_tmp;
-       INT argc=0,i;
-       INT iAction=0;
-       LPTSTR title=0;
+       LPTSTR *p = 0, p_tmp;
+       INT argc = 0, i;
+       INT iAction = 0;
+       LPTSTR title = 0;
        WINDOWPLACEMENT wp;
        RECT pos;
        LPTSTR tmp;
 
 
-       if(*param)
-               p=split(param,&argc);
+       if (*param)
+               p = split(param, &argc);
 
 
-       for(i = 0; i < argc; i++)
+       for (i = 0; i < argc; i++)
        {
-               p_tmp=p[i];
+               p_tmp = p[i];
                if (*p_tmp == _T('/'))
                        p_tmp++;
 
-               if (_tcsicmp(p_tmp,_T("min"))==0)
+               if (_tcsicmp(p_tmp, _T("min")) == 0)
                {
                        iAction |= A_MIN;
                        continue;
                }
 
-               if (_tcsicmp(p_tmp,_T("max"))==0)
+               if (_tcsicmp(p_tmp, _T("max")) == 0)
                {
                        iAction |= A_MAX;
                        continue;
                }
 
-               if (_tcsicmp(p_tmp,_T("restore"))==0)
+               if (_tcsicmp(p_tmp, _T("restore")) == 0)
                {
                        iAction |= A_RESTORE;
                        continue;
                }
 
-               if (_tcsicmp(p_tmp,_T("close"))==0)
+               if (_tcsicmp(p_tmp, _T("close")) == 0)
                {
                        iAction |= A_CLOSE;
                        continue;
                }
 
-               if (_tcsnicmp(p_tmp,_T("pos"),3)==0)
+               if (_tcsnicmp(p_tmp, _T("pos"), 3) == 0)
                {
                        iAction |= A_POS;
                        tmp = p_tmp+3;
@@ -91,7 +90,7 @@ INT ServiceActivate (LPTSTR param, HWND hWnd)
                                tmp++;
 
                        pos.left= _ttoi(tmp);
-                       if(!(tmp=_tcschr(tmp,_T(','))))
+                       if(!(tmp=_tcschr(tmp, _T(','))))
                        {
                                error_invalid_parameter_format(p[i]);
                                freep(p);
@@ -99,15 +98,15 @@ INT ServiceActivate (LPTSTR param, HWND hWnd)
                        }
 
                        pos.top = _ttoi (++tmp);
-                       if(!(tmp=_tcschr(tmp,_T(','))))
+                       if(!(tmp=_tcschr(tmp, _T(','))))
                        {
                                error_invalid_parameter_format(p[i]);
                                freep(p);
                                return 1;
                        }
 
-                       pos.right = _ttoi(++tmp)+pos.left;
-                       if(!(tmp=_tcschr(tmp,_T(','))))
+                       pos.right = _ttoi(++tmp) + pos.left;
+                       if (!(tmp = _tcschr(tmp, _T(','))))
                        {
                                error_invalid_parameter_format(p[i]);
                                freep(p);
@@ -117,13 +116,13 @@ INT ServiceActivate (LPTSTR param, HWND hWnd)
                        continue;
                }
 
-               if (_tcsnicmp(p_tmp,_T("size"),4)==0)
+               if (_tcsnicmp(p_tmp, _T("size"), 4)==0)
                {
                        iAction |=A_SIZE;
                        continue;
                }
 
-               /*none of them=window title*/
+               /* none of them=window title */
                if (title)
                {
                        error_invalid_parameter_format(p[i]);
@@ -133,39 +132,39 @@ INT ServiceActivate (LPTSTR param, HWND hWnd)
 
                if (p_tmp[0] == _T('"'))
                {
-                       title = (p_tmp+1);
-                       *_tcschr(p_tmp+1,_T('"'))=0;
+                       title = (p_tmp + 1);
+                       *_tcschr(p_tmp + 1, _T('"')) = 0;
                        continue;
                }
                title = p_tmp;
        }
 
-       if(title)
-               SetWindowText(hWnd,title);
+       if (title)
+               SetWindowText(hWnd, title);
 
-       wp.length=sizeof(WINDOWPLACEMENT);
-       GetWindowPlacement(hWnd,&wp);
+       wp.length = sizeof(WINDOWPLACEMENT);
+       GetWindowPlacement(hWnd, &wp);
 
-       if(iAction & A_POS)     
-               wp.rcNormalPosition = pos;      
+       if (iAction & A_POS)
+               wp.rcNormalPosition = pos;
 
-       if(iAction & A_MIN)
-               wp.showCmd=SW_MINIMIZE;
+       if (iAction & A_MIN)
+               wp.showCmd = SW_MINIMIZE;
 
-       if(iAction & A_MAX)
-               wp.showCmd=SW_SHOWMAXIMIZED;
+       if (iAction & A_MAX)
+               wp.showCmd = SW_SHOWMAXIMIZED;
 
        /*if no actions are specified default is SW_RESTORE*/
-       if( (iAction & A_RESTORE) || (!iAction) )
-               wp.showCmd=SW_RESTORE;
+       if ((iAction & A_RESTORE) || (!iAction))
+               wp.showCmd = SW_RESTORE;
 
-       if(iAction & A_CLOSE)
+       if (iAction & A_CLOSE)
                ConErrPrintf(_T("!!!FIXME:  CLOSE Not implemented!!!\n"));
 
-       wp.length=sizeof(WINDOWPLACEMENT);
-       SetWindowPlacement(hWnd,&wp);
+       wp.length = sizeof(WINDOWPLACEMENT);
+       SetWindowPlacement(hWnd, &wp);
 
-       if(p)
+       if (p)
                freep(p);
 
        return 0;
@@ -176,33 +175,32 @@ INT ServiceActivate (LPTSTR param, HWND hWnd)
 
 INT CommandWindow (LPTSTR cmd, LPTSTR param)
 {
-       HWND h;
        TCHAR szMsg[RC_STRING_MAX_SIZE];
+       HWND hwnd;
 
        if (_tcsncmp (param, _T("/?"), 2) == 0)
        {
-               LoadString( GetModuleHandle(NULL), STRING_WINDOW_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPuts (szMsg);     
-
+               LoadString(GetModuleHandle(NULL), STRING_WINDOW_HELP1, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
        h = GetConsoleWindow();
        Sleep(0);
-       return ServiceActivate(param,h);
+       return ServiceActivate(param, hwnd);
 }
 
 
 INT CommandActivate (LPTSTR cmd, LPTSTR param)
 {
-       LPTSTR str;
-       HWND h;
        TCHAR szMsg[RC_STRING_MAX_SIZE];
+       LPTSTR str;
+       HWND hwnd;
 
        if (_tcsncmp (param, _T("/?"), 2) == 0)
        {
-               LoadString( GetModuleHandle(NULL), STRING_WINDOW_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConOutPuts (szMsg);     
+               LoadString(GetModuleHandle(NULL), STRING_WINDOW_HELP2, szMsg, RC_STRING_MAX_SIZE);
+               ConOutPuts(szMsg);
                return 0;
        }
 
@@ -219,15 +217,15 @@ INT CommandActivate (LPTSTR cmd, LPTSTR param)
        else
                str = "";
 
-       h=FindWindow(NULL, param);
-       if (!h)
+       hwnd = FindWindow(NULL, param);
+       if (hwnd == NULL)
        {
-               LoadString( GetModuleHandle(NULL), STRING_WINDOW_ERROR1, szMsg,sizeof(szMsg)/sizeof(TCHAR));
-               ConErrPuts (szMsg);                     
+               LoadString(GetModuleHandle(NULL), STRING_WINDOW_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               ConErrPuts(szMsg);
                return 1;
        }
 
-       return ServiceActivate(str,h);
+       return ServiceActivate(str, hwnd);
 }
 
 #endif /* (  defined(INCLUDE_CMD_WINDOW) ||  defined(INCLUDE_CMD_ACTIVATE)  ) */