[CMD]
[reactos.git] / reactos / base / shell / cmd / misc.c
index 6c1a177..c94fce8 100644 (file)
@@ -94,16 +94,16 @@ VOID GetPathCase( TCHAR * Path, TCHAR * OutPath)
 
     for(i = 0; i < _tcslen(Path); i++)
     {
-        if(Path[i] != _T('\\'))
+        if (Path[i] != _T('\\'))
         {
             _tcsncat(TempPath, &Path[i], 1);
-            if(i != _tcslen(Path) - 1)
+            if (i != _tcslen(Path) - 1)
                 continue;
         }
         /* Handle the base part of the path different.
            Because if you put it into findfirstfile, it will
            return your current folder */
-        if(_tcslen(TempPath) == 2 && TempPath[1] == _T(':'))
+        if (_tcslen(TempPath) == 2 && TempPath[1] == _T(':'))
         {
             _tcscat(OutPath, TempPath);
             _tcscat(OutPath, _T("\\"));
@@ -112,7 +112,7 @@ VOID GetPathCase( TCHAR * Path, TCHAR * OutPath)
         else
         {
             hFind = FindFirstFile(TempPath,&FindFileData);
-            if(hFind == INVALID_HANDLE_VALUE)
+            if (hFind == INVALID_HANDLE_VALUE)
             {
                 _tcscpy(OutPath, Path);
                 return;
@@ -157,7 +157,7 @@ BOOL CheckCtrlBreak (INT mode)
                 c = _totupper(cgetchar());
             } while (!(_tcschr(options, c) || c == _T('\3')) || !c);
 
-            ConOutPuts (_T("\r\n"));
+            ConOutChar(_T('\n'));
 
             if (c == options[1])
                 return bCtrlBreak = FALSE; /* ignore */
@@ -194,6 +194,7 @@ BOOL add_entry (LPINT ac, LPTSTR **arg, LPCTSTR entry)
     *arg = cmd_realloc (oldarg, (*ac + 2) * sizeof (LPTSTR));
     if (NULL == *arg)
     {
+        cmd_free (q);
         *arg = oldarg;
         return FALSE;
     }
@@ -533,25 +534,25 @@ BOOL FileGetString (HANDLE hFile, LPTSTR lpBuffer, INT nBufferLength)
     return TRUE;
 }
 
-INT PagePrompt (VOID)
+INT PagePrompt(VOID)
 {
     INPUT_RECORD ir;
 
     ConOutResPuts(STRING_MISC_HELP1);
 
-    RemoveBreakHandler ();
-    ConInDisable ();
+    RemoveBreakHandler();
+    ConInDisable();
 
     do
     {
-        ConInKey (&ir);
+        ConInKey(&ir);
     }
     while ((ir.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT) ||
            (ir.Event.KeyEvent.wVirtualKeyCode == VK_MENU) ||
            (ir.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL));
 
-    AddBreakHandler ();
-    ConInEnable ();
+    AddBreakHandler();
+    ConInEnable();
 
     if ((ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) ||
         ((ir.Event.KeyEvent.wVirtualKeyCode == _T('C')) &&
@@ -578,8 +579,8 @@ INT FilePromptYN (UINT resID)
         ConOutResPrintf (resID);
 
     /* preliminary fix */
-    ConInString (szIn, 10);
-    ConOutPrintf (_T("\n"));
+    ConInString(szIn, 10);
+    ConOutChar(_T('\n'));
 
     _tcsupr (szIn);
     for (p = szIn; _istspace (*p); p++)
@@ -600,8 +601,8 @@ INT FilePromptYN (UINT resID)
 
     /* unfinished solution */
 #if 0
-    RemoveBreakHandler ();
-    ConInDisable ();
+    RemoveBreakHandler();
+    ConInDisable();
 
     do
     {
@@ -616,8 +617,8 @@ INT FilePromptYN (UINT resID)
            (ir.Event.KeyEvent.wVirtualKeyCode == VK_MENU) ||
            (ir.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL));
 
-    AddBreakHandler ();
-    ConInEnable ();
+    AddBreakHandler();
+    ConInEnable();
 
     if ((ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) ||
         ((ir.Event.KeyEvent.wVirtualKeyCode == 'C') &&
@@ -642,8 +643,8 @@ INT FilePromptYNA (UINT resID)
         ConOutResPrintf (resID);
 
     /* preliminary fix */
-    ConInString (szIn, 10);
-    ConOutPrintf (_T("\n"));
+    ConInString(szIn, 10);
+    ConOutChar(_T('\n'));
 
     _tcsupr (szIn);
     for (p = szIn; _istspace (*p); p++)
@@ -666,8 +667,8 @@ INT FilePromptYNA (UINT resID)
 
     /* unfinished solution */
 #if 0
-    RemoveBreakHandler ();
-    ConInDisable ();
+    RemoveBreakHandler();
+    ConInDisable();
 
     do
     {
@@ -680,8 +681,8 @@ INT FilePromptYNA (UINT resID)
            (ir.Event.KeyEvent.wVirtualKeyCode == VK_MENU) ||
            (ir.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL));
 
-    AddBreakHandler ();
-    ConInEnable ();
+    AddBreakHandler();
+    ConInEnable();
 
     if ((ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) ||
         ((ir.Event.KeyEvent.wVirtualKeyCode == _T('C')) &&