[CMDUTILS]: Fix some utils descriptions.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Mon, 17 Mar 2014 23:14:08 +0000 (23:14 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Mon, 17 Mar 2014 23:14:08 +0000 (23:14 +0000)
svn path=/trunk/; revision=62523

reactos/base/applications/cmdutils/doskey/doskey.rc
reactos/base/applications/cmdutils/find/find.rc
reactos/base/applications/cmdutils/mode/CMakeLists.txt
reactos/base/applications/cmdutils/mode/mode.c
reactos/base/applications/cmdutils/mode/mode.rbuild [deleted file]
reactos/base/applications/cmdutils/mode/mode.rc
reactos/base/applications/cmdutils/more/more.rc
reactos/base/applications/cmdutils/xcopy/rsrc.rc

index c302f55..52e969b 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "doskey.h"
 
-#define REACTOS_STR_FILE_DESCRIPTION  "W32 doskey command"
+#define REACTOS_STR_FILE_DESCRIPTION  "ReactOS Doskey Command"
 #define REACTOS_STR_INTERNAL_NAME     "doskey"
 #define REACTOS_STR_ORIGINAL_FILENAME "doskey.exe"
 #include <reactos/version.rc>
index ae1c505..5c05433 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "resource.h"
 
-#define REACTOS_STR_FILE_DESCRIPTION  "W32 find command"
+#define REACTOS_STR_FILE_DESCRIPTION  "ReactOS Find Command"
 #define REACTOS_STR_INTERNAL_NAME     "find"
 #define REACTOS_STR_ORIGINAL_FILENAME "find.exe"
 #include <reactos/version.rc>
index 578fc4b..ed5689c 100644 (file)
@@ -1,5 +1,5 @@
 
 add_executable(mode mode.c mode.rc)
 set_module_type(mode win32cui)
-add_importlibs(mode shell32 user32 msvcrt kernel32)
+add_importlibs(mode user32 msvcrt kernel32)
 add_cd_file(TARGET mode DESTINATION reactos/system32 FOR all)
index bdd7341..fd9cb77 100644 (file)
@@ -32,7 +32,8 @@
 #define NUM_ELEMENTS(a) (sizeof(a)/sizeof(a[0]))
 #define ASSERT(a)
 
-const TCHAR* const usage_strings[] = {
+const TCHAR* const usage_strings[] =
+{
     _T("Device Status:     MODE [device] [/STATUS]"),
     _T("Select code page:  MODE CON[:] CP SELECT=yyy"),
     _T("Code page status:  MODE CON[:] CP [/STATUS]"),
@@ -45,7 +46,8 @@ const TCHAR* const usage_strings[] = {
     _T("                            [rts=on|off|hs|tg] [idsr=on|off]"),
 };
 
-const TCHAR* const parity_strings[] = {
+const TCHAR* const parity_strings[] =
+{
     _T("None"),   // default
     _T("Odd"),    // only symbol in this set to have a 'd' in it
     _T("Even"),   // ... 'v' in it
@@ -60,10 +62,11 @@ const TCHAR* const stopbit_strings[] = { _T("1"), _T("1.5"), _T("2") };
 
 int Usage()
 {
-       int i;
+    int i;
 
     _tprintf(_T("\nConfigures system devices.\n\n"));
-    for (i = 0; i < NUM_ELEMENTS(usage_strings); i++) {
+    for (i = 0; i < NUM_ELEMENTS(usage_strings); i++)
+    {
         _tprintf(_T("%s\n"), usage_strings[i]);
     }
     _tprintf(_T("\n"));
@@ -77,21 +80,32 @@ int QueryDevices()
     TCHAR* ptr = buffer;
 
     *ptr = '\0';
-    if (QueryDosDevice(NULL, buffer, NUM_ELEMENTS(buffer))) {
-        while (*ptr != '\0') {
+    if (QueryDosDevice(NULL, buffer, NUM_ELEMENTS(buffer)))
+    {
+        while (*ptr != '\0')
+        {
             len = _tcslen(ptr);
-            if (_tcsstr(ptr, _T("COM"))) {
+            if (_tcsstr(ptr, _T("COM")))
+            {
                 _tprintf(_T("    Found serial device - %s\n"), ptr);
-            } else if (_tcsstr(ptr, _T("PRN"))) {
+            }
+            else if (_tcsstr(ptr, _T("PRN")))
+            {
                 _tprintf(_T("    Found printer device - %s\n"), ptr);
-            } else if (_tcsstr(ptr, _T("LPT"))) {
+            }
+            else if (_tcsstr(ptr, _T("LPT")))
+            {
                 _tprintf(_T("    Found parallel device - %s\n"), ptr);
-            } else {
+            }
+            else
+            {
                 //_tprintf(_T("    Found other device - %s\n"), ptr);
             }
             ptr += (len+1);
         }
-    } else {
+    }
+    else
+    {
         _tprintf(_T("    ERROR: QueryDosDevice(...) failed.%ld\n"), GetLastError());
     }
     return 1;
@@ -105,19 +119,28 @@ int ShowParallelStatus(int nPortNum)
     _stprintf(szPortName, _T("LPT%d"), nPortNum);
     _tprintf(_T("\nStatus for device LPT%d:\n"), nPortNum);
     _tprintf(_T("-----------------------\n"));
-    if (QueryDosDevice(szPortName, buffer, NUM_ELEMENTS(buffer))) {
+    if (QueryDosDevice(szPortName, buffer, NUM_ELEMENTS(buffer)))
+    {
         TCHAR* ptr = _tcsrchr(buffer, '\\');
-        if (ptr != NULL) {
-            if (0 == _tcscmp(szPortName, ++ptr)) {
+        if (ptr != NULL)
+        {
+            if (0 == _tcscmp(szPortName, ++ptr))
+            {
                 _tprintf(_T("    Printer output is not being rerouted.\n"));
-            } else {
+            }
+            else
+            {
                 _tprintf(_T("    Printer output is being rerouted to serial port %s\n"), ptr);
             }
             return 0;
-        } else {
+        }
+        else
+        {
             _tprintf(_T("    QueryDosDevice(%s) returned unrecogised form %s.\n"), szPortName, buffer);
         }
-    } else {
+    }
+    else
+    {
         _tprintf(_T("    ERROR: QueryDosDevice(%s) failed.\n"), szPortName);
     }
     return 1;
@@ -132,14 +155,17 @@ int ShowConsoleStatus()
 
     _tprintf(_T("\nStatus for device CON:\n"));
     _tprintf(_T("-----------------------\n"));
-    if (GetConsoleScreenBufferInfo(hConsoleOutput, &ConsoleScreenBufferInfo)) {
+    if (GetConsoleScreenBufferInfo(hConsoleOutput, &ConsoleScreenBufferInfo))
+    {
         _tprintf(_T("    Lines:          %d\n"), ConsoleScreenBufferInfo.dwSize.Y);
         _tprintf(_T("    Columns:        %d\n"), ConsoleScreenBufferInfo.dwSize.X);
     }
-    if (SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &dwKbdDelay, 0)) {
+    if (SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &dwKbdDelay, 0))
+    {
         _tprintf(_T("    Keyboard delay: %ld\n"), dwKbdDelay);
     }
-    if (SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &dwKbdSpeed, 0)) {
+    if (SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &dwKbdSpeed, 0))
+    {
         _tprintf(_T("    Keyboard rate:  %ld\n"), dwKbdSpeed);
     }
     _tprintf(_T("    Code page:      %d\n"), GetConsoleOutputCP());
@@ -165,31 +191,29 @@ BOOL SerialPortQuery(int nPortNum, LPDCB pDCB, LPCOMMTIMEOUTS pCommTimeouts, BOO
                        0,     // no attributes
                        NULL); // no template
 
-    if (hPort == INVALID_HANDLE_VALUE) {
+    if (hPort == INVALID_HANDLE_VALUE)
+    {
         _tprintf(_T("Illegal device name - %s\n"), szPortName);
         _tprintf(_T("Last error = 0x%lx\n"), GetLastError());
         return FALSE;
     }
-    if (bWrite) {
-        result = SetCommState(hPort, pDCB);
-    } else {
-        result = GetCommState(hPort, pDCB);
-    }
-    if (!result) {
+
+    result = bWrite ? SetCommState(hPort, pDCB)
+                    : GetCommState(hPort, pDCB);
+    if (!result)
+    {
         _tprintf(_T("Failed to %s the status for device COM%d:\n"), bWrite ? _T("set") : _T("get"), nPortNum);
         CloseHandle(hPort);
         return FALSE;
     }
-    if (bWrite) {
-        result = SetCommTimeouts(hPort, pCommTimeouts);
-    } else {
-        result = GetCommTimeouts(hPort, pCommTimeouts);
-    }
-    if (!result) {
+
+    result = bWrite ? SetCommTimeouts(hPort, pCommTimeouts)
+                    : GetCommTimeouts(hPort, pCommTimeouts);
+    if (!result)
+    {
         _tprintf(_T("Failed to %s Timeout status for device COM%d:\n"), bWrite ? _T("set") : _T("get"), nPortNum);
         CloseHandle(hPort);
         return FALSE;
-
     }
     CloseHandle(hPort);
     return TRUE;
@@ -200,14 +224,17 @@ int ShowSerialStatus(int nPortNum)
     DCB dcb;
     COMMTIMEOUTS CommTimeouts;
 
-    if (!SerialPortQuery(nPortNum, &dcb, &CommTimeouts, FALSE)) {
+    if (!SerialPortQuery(nPortNum, &dcb, &CommTimeouts, FALSE))
+    {
         return 1;
     }
-    if (dcb.Parity > NUM_ELEMENTS(parity_strings)) {
+    if (dcb.Parity > NUM_ELEMENTS(parity_strings))
+    {
         _tprintf(_T("ERROR: Invalid value for Parity Bits %d:\n"), dcb.Parity);
         dcb.Parity = 0;
     }
-    if (dcb.StopBits > NUM_ELEMENTS(stopbit_strings)) {
+    if (dcb.StopBits > NUM_ELEMENTS(stopbit_strings))
+    {
         _tprintf(_T("ERROR: Invalid value for Stop Bits %d:\n"), dcb.StopBits);
         dcb.StopBits = 0;
     }
@@ -234,9 +261,9 @@ int SetParallelState(int nPortNum)
 
     _stprintf(szPortName, _T("LPT%d"), nPortNum);
     _stprintf(szTargetPath, _T("COM%d"), nPortNum);
-    if (!DefineDosDevice(DDD_REMOVE_DEFINITION, szPortName, szTargetPath)) {
+    if (!DefineDosDevice(DDD_REMOVE_DEFINITION, szPortName, szTargetPath))
+    {
         DWORD error = GetLastError();
-
         _tprintf(_T("SetParallelState(%d) - DefineDosDevice(%s) failed: 0x%lx\n"), nPortNum, szPortName, error);
     }
     return 0;
@@ -260,26 +287,26 @@ DWORD QueryDosDevice(
 int SetConsoleState()
 {
 /*
-       "Select code page:  MODE CON[:] CP SELECT=yyy",
-       "Code page status:  MODE CON[:] CP [/STATUS]",
-       "Display mode:      MODE CON[:] [COLS=c] [LINES=n]",
-       "Typematic rate:    MODE CON[:] [RATE=r DELAY=d]",
+    "Select code page:  MODE CON[:] CP SELECT=yyy",
+    "Code page status:  MODE CON[:] CP [/STATUS]",
+    "Display mode:      MODE CON[:] [COLS=c] [LINES=n]",
+    "Typematic rate:    MODE CON[:] [RATE=r DELAY=d]",
  */
-       return 0;
+    return 0;
 }
 
 static
 int ExtractModeSerialParams(const TCHAR* param)
 {
-    if (       _tcsstr(param, _T("OFF"))) {
+    if (_tcsstr(param, _T("OFF")))
         return 0;
-    } else if (_tcsstr(param, _T("ON"))) {
+    else if (_tcsstr(param, _T("ON")))
         return 1;
-    } else if (_tcsstr(param, _T("HS"))) {
+    else if (_tcsstr(param, _T("HS")))
         return 2;
-    } else if (_tcsstr(param, _T("TG"))) {
+    else if (_tcsstr(param, _T("TG")))
         return 3;
-    }
+
     return -1;
 }
 
@@ -291,88 +318,133 @@ int SetSerialState(int nPortNum, int args, TCHAR *argv[])
     COMMTIMEOUTS CommTimeouts;
     TCHAR buf[MAX_COMPARAM_LEN+1];
 
-    if (SerialPortQuery(nPortNum, &dcb, &CommTimeouts, FALSE)) {
-        for (arg = 2; arg < args; arg++) {
-            if (_tcslen(argv[arg]) > MAX_COMPARAM_LEN) {
+    if (SerialPortQuery(nPortNum, &dcb, &CommTimeouts, FALSE))
+    {
+        for (arg = 2; arg < args; arg++)
+        {
+            if (_tcslen(argv[arg]) > MAX_COMPARAM_LEN)
+            {
                 _tprintf(_T("Invalid parameter (too long) - %s\n"), argv[arg]);
                 return 1;
             }
             _tcscpy(buf, argv[arg]);
             _tcslwr(buf);
-            if (_tcsstr(buf, _T("baud="))) {
+            if (_tcsstr(buf, _T("baud=")))
+            {
                 _tscanf(buf+5, "%lu", &dcb.BaudRate);
-            } else if (_tcsstr(buf, _T("parity="))) {
-                if (_tcschr(buf, 'D')) {
+            }
+            else if (_tcsstr(buf, _T("parity=")))
+            {
+                if (_tcschr(buf, 'D'))
                     dcb.Parity = 1;
-                } else if (_tcschr(buf, 'V')) {
+                else if (_tcschr(buf, 'V'))
                     dcb.Parity = 2;
-                } else if (_tcschr(buf, 'M')) {
+                else if (_tcschr(buf, 'M'))
                     dcb.Parity = 3;
-                } else if (_tcschr(buf, 'S')) {
+                else if (_tcschr(buf, 'S'))
                     dcb.Parity = 4;
-                } else {
+                else
                     dcb.Parity = 0;
-                }
-            } else if (_tcsstr(buf, _T("data="))) {
+            }
+            else if (_tcsstr(buf, _T("data=")))
+            {
                 _tscanf(buf+5, "%lu", &dcb.ByteSize);
-            } else if (_tcsstr(buf, _T("stop="))) {
-                if (_tcschr(buf, '5')) {
+            }
+            else if (_tcsstr(buf, _T("stop=")))
+            {
+                if (_tcschr(buf, '5'))
                     dcb.StopBits = 1;
-                } else if (_tcschr(buf, '2')) {
+                else if (_tcschr(buf, '2'))
                     dcb.StopBits = 2;
-                } else {
+                else
                     dcb.StopBits = 0;
-                }
-            } else if (_tcsstr(buf, _T("to="))) { // to=on|off
+            }
+            else if (_tcsstr(buf, _T("to="))) // to=on|off
+            {
                 value = ExtractModeSerialParams(buf);
-                if (value != -1) {
-                } else {
+                if (value != -1)
+                {
+                }
+                else
+                {
                     goto invalid_serial_parameter;
                 }
-            } else if (_tcsstr(buf, _T("xon="))) { // xon=on|off
+            }
+            else if (_tcsstr(buf, _T("xon="))) // xon=on|off
+            {
                 value = ExtractModeSerialParams(buf);
-                if (value != -1) {
+                if (value != -1)
+                {
                     dcb.fOutX = value;
                     dcb.fInX = value;
-                } else {
+                }
+                else
+                {
                     goto invalid_serial_parameter;
                 }
-            } else if (_tcsstr(buf, _T("odsr="))) { // odsr=on|off
+            }
+            else if (_tcsstr(buf, _T("odsr="))) // odsr=on|off
+            {
                 value = ExtractModeSerialParams(buf);
-                if (value != -1) {
+                if (value != -1)
+                {
                     dcb.fOutxDsrFlow = value;
-                } else {
+                }
+                else
+                {
                     goto invalid_serial_parameter;
                 }
-            } else if (_tcsstr(buf, _T("octs="))) { // octs=on|off
+            }
+            else if (_tcsstr(buf, _T("octs="))) // octs=on|off
+            {
                 value = ExtractModeSerialParams(buf);
-                if (value != -1) {
+                if (value != -1)
+                {
                     dcb.fOutxCtsFlow = value;
-                } else {
+                }
+                else
+                {
                     goto invalid_serial_parameter;
                 }
-            } else if (_tcsstr(buf, _T("dtr="))) { // dtr=on|off|hs
+            }
+            else if (_tcsstr(buf, _T("dtr="))) // dtr=on|off|hs
+            {
                 value = ExtractModeSerialParams(buf);
-                if (value != -1) {
+                if (value != -1)
+                {
                     dcb.fDtrControl = value;
-                } else {
+                }
+                else
+                {
                     goto invalid_serial_parameter;
                 }
-            } else if (_tcsstr(buf, _T("rts="))) { // rts=on|off|hs|tg
+            }
+            else if (_tcsstr(buf, _T("rts="))) // rts=on|off|hs|tg
+            {
                 value = ExtractModeSerialParams(buf);
-                if (value != -1) {
+                if (value != -1)
+                {
                     dcb.fRtsControl = value;
-                } else {
+                }
+                else
+                {
                     goto invalid_serial_parameter;
                 }
-            } else if (_tcsstr(buf, _T("idsr="))) { // idsr=on|off
+            }
+            else if (_tcsstr(buf, _T("idsr="))) // idsr=on|off
+            {
                 value = ExtractModeSerialParams(buf);
-                if (value != -1) {
+                if (value != -1)
+                {
                     dcb.fDsrSensitivity = value;
-                } else {
+                }
+                else
+                {
                     goto invalid_serial_parameter;
                 }
-            } else {
+            }
+            else
+            {
 invalid_serial_parameter:;
                 _tprintf(_T("Invalid parameter - %s\n"), buf);
                 return 1;
@@ -387,9 +459,11 @@ int find_portnum(const TCHAR* cmdverb)
 {
     int portnum = -1;
 
-    if (cmdverb[3] >= '0' && cmdverb[3] <= '9') {
+    if (cmdverb[3] >= '0' && cmdverb[3] <= '9')
+    {
         portnum = cmdverb[3] - '0';
-        if (cmdverb[4] >= '0' && cmdverb[4] <= '9') {
+        if (cmdverb[4] >= '0' && cmdverb[4] <= '9')
+        {
             portnum *= 10;
             portnum += cmdverb[4] - '0';
         }
@@ -403,55 +477,77 @@ int main(int argc, TCHAR *argv[])
     TCHAR param1[MAX_COMPARAM_LEN+1];
     TCHAR param2[MAX_COMPARAM_LEN+1];
 
-    if (argc > 1) {
-        if (_tcslen(argv[1]) > MAX_COMPARAM_LEN) {
+    if (argc > 1)
+    {
+        if (_tcslen(argv[1]) > MAX_COMPARAM_LEN)
+        {
             _tprintf(_T("Invalid parameter (too long) - %s\n"), argv[1]);
             return 1;
         }
         _tcscpy(param1, argv[1]);
         _tcslwr(param1);
-        if (argc > 2) {
-            if (_tcslen(argv[2]) > MAX_COMPARAM_LEN) {
+        if (argc > 2)
+        {
+            if (_tcslen(argv[2]) > MAX_COMPARAM_LEN)
+            {
                 _tprintf(_T("Invalid parameter (too long) - %s\n"), argv[2]);
                 return 1;
             }
             _tcscpy(param2, argv[2]);
             _tcslwr(param2);
-        } else {
+        }
+        else
+        {
             param2[0] = '\0';
         }
-        if (_tcsstr(param1, _T("/?")) || _tcsstr(param1, _T("-?"))) {
+        if (_tcsstr(param1, _T("/?")) || _tcsstr(param1, _T("-?")))
+        {
             return Usage();
-        } else if (_tcsstr(param1, _T("/status"))) {
+        }
+        else if (_tcsstr(param1, _T("/status")))
+        {
             goto show_status;
-        } else if (_tcsstr(param1, _T("lpt"))) {
+        }
+        else if (_tcsstr(param1, _T("lpt")))
+        {
             nPortNum = find_portnum(param1);
             if (nPortNum != -1)
                 return ShowParallelStatus(nPortNum);
-        } else if (_tcsstr(param1, _T("con"))) {
+        }
+        else if (_tcsstr(param1, _T("con")))
+        {
             return ShowConsoleStatus();
-        } else if (_tcsstr(param1, _T("com"))) {
+        }
+        else if (_tcsstr(param1, _T("com")))
+        {
             nPortNum = find_portnum(param1);
-            if (nPortNum != -1) {
-                if (param2[0] == '\0' || _tcsstr(param2, _T("/status"))) {
+            if (nPortNum != -1)
+            {
+                if (param2[0] == '\0' || _tcsstr(param2, _T("/status")))
+                {
                     return ShowSerialStatus(nPortNum);
-                } else {
+                }
+                else
+                {
                     return SetSerialState(nPortNum, argc, argv);
                 }
             }
         }
         _tprintf(_T("Invalid parameter - %s\n"), param1);
         return 1;
-    } else {
+    }
+    else
+    {
 show_status:;
 
         QueryDevices();
 /*
         ShowParallelStatus(1);
-        for (nPortNum = 0; nPortNum < MAX_COMPORT_NUM; nPortNum++) {
-          ShowSerialStatus(nPortNum + 1);
+        for (nPortNum = 0; nPortNum < MAX_COMPORT_NUM; nPortNum++)
+        {
+            ShowSerialStatus(nPortNum + 1);
         }
-           ShowConsoleStatus();
+        ShowConsoleStatus();
  */
     }
     return 0;
diff --git a/reactos/base/applications/cmdutils/mode/mode.rbuild b/reactos/base/applications/cmdutils/mode/mode.rbuild
deleted file mode 100644 (file)
index 11eb306..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<module name="mode" type="win32cui" installbase="system32" installname="mode.exe">
-       <include base="mode">.</include>
-       <library>shell32</library>
-       <library>user32</library>
-       <file>mode.c</file>
-       <file>mode.rc</file>
index 44ca8c4..60f7d21 100644 (file)
@@ -1,5 +1,5 @@
 
-#define REACTOS_STR_FILE_DESCRIPTION   "ReactOS mode utility\0"
-#define REACTOS_STR_INTERNAL_NAME      "mode\0"
-#define REACTOS_STR_ORIGINAL_FILENAME  "mode.exe\0"
+#define REACTOS_STR_FILE_DESCRIPTION    "ReactOS Mode Utility"
+#define REACTOS_STR_INTERNAL_NAME       "mode"
+#define REACTOS_STR_ORIGINAL_FILENAME   "mode.exe"
 #include <reactos/version.rc>
index ce96958..d440800 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "resource.h"
 
-#define REACTOS_STR_FILE_DESCRIPTION  "W32 more command"
+#define REACTOS_STR_FILE_DESCRIPTION  "ReactOS More Command"
 #define REACTOS_STR_INTERNAL_NAME     "more"
 #define REACTOS_STR_ORIGINAL_FILENAME "more.exe"
 #include <reactos/version.rc>
index 13a1969..106e302 100644 (file)
@@ -20,7 +20,7 @@
 
 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 
-#define REACTOS_STR_FILE_DESCRIPTION  "xcopy command"
+#define REACTOS_STR_FILE_DESCRIPTION  "ReactOS Xcopy Command"
 #define REACTOS_STR_INTERNAL_NAME     "xcopy"
 #define REACTOS_STR_ORIGINAL_FILENAME "xcopy.exe"
 #include <reactos/version.rc>