Don't strip trailing spaces from the command line
[reactos.git] / reactos / base / shell / cmd / cmd.c
index eade016..3b310b1 100644 (file)
@@ -790,7 +790,6 @@ VOID ParseCommandLine (LPTSTR cmd)
                _tcscpy(err, bc->Err);
        }
 
-
        /* Set up the initial conditions ... */
        /* preserve STDIN, STDOUT and STDERR handles */
        hOldConIn  = GetStdHandle (STD_INPUT_HANDLE);
@@ -811,18 +810,9 @@ VOID ParseCommandLine (LPTSTR cmd)
                                    FILE_ATTRIBUTE_NORMAL, NULL);
                if (hFile == INVALID_HANDLE_VALUE)
                {
-                       if (bc)
-                       {
-                               /* will fail for windows gui apps */
-                               num = 0;
-                               bc->hBatchFile = INVALID_HANDLE_VALUE;
-                       }
-                       else
-                       {
-                               LoadString(CMD_ModuleHandle, STRING_CMD_ERROR1, szMsg, RC_STRING_MAX_SIZE);
-                               ConErrPrintf(szMsg, in);
-                               return;
-                       }
+                       LoadString(CMD_ModuleHandle, STRING_CMD_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+                       ConErrPrintf(szMsg, in);
+                       return;
                }
 
                if (!SetStdHandle (STD_INPUT_HANDLE, hFile))
@@ -901,7 +891,7 @@ VOID ParseCommandLine (LPTSTR cmd)
 
        /* Now set up the end conditions... */
        /* redirect STDOUT */
-       if ((bc) && (bc->hBatchFile != INVALID_HANDLE_VALUE) && (out[0]))
+       if (out[0])
        {
                /* Final output to here */
                HANDLE hFile;
@@ -968,7 +958,7 @@ VOID ParseCommandLine (LPTSTR cmd)
        }
 
        /* redirect STDERR */
-       if ((bc) && (bc->hBatchFile != INVALID_HANDLE_VALUE) && (err[0]))
+       if (err[0])
        {
                /* Final output to here */
                HANDLE hFile;
@@ -1465,7 +1455,7 @@ ProcessInput (BOOL bFlag)
                                }
                        }
 
-                       if (_istcntrl (*ip))
+                       if (*ip != _T('\0') && (_istcntrl (*ip)))
                                *ip = _T(' ');
                        *cp++ = *ip++;
 
@@ -1539,11 +1529,6 @@ ProcessInput (BOOL bFlag)
 
                *cp = _T('\0');
 
-               /* strip trailing spaces */
-               while ((--cp >= commandline) && _istspace (*cp));
-
-               *(cp + 1) = _T('\0');
-
                /* JPP 19980807 */
                /* Echo batch file line */
                if (bEchoThisLine)
@@ -1774,10 +1759,6 @@ Initialize (int argc, const TCHAR* argv[])
        InitLastPath ();
 #endif
 
-#ifdef FATURE_ALIASES
-       InitializeAlias ();
-#endif
-
        if (argc >= 2)
        {
                for (i = 1; i < argc; i++)
@@ -1855,7 +1836,7 @@ Initialize (int argc, const TCHAR* argv[])
             _T(KERNEL_RELEASE_STR),
             _T(KERNEL_VERSION_BUILD_STR));
 
-           ConOutPuts (_T("(C) Copyright 1998-" COPYRIGHT_YEAR " ReactOS Team.\n"));
+           ConOutPuts (_T("(C) Copyright 1998-") _T(COPYRIGHT_YEAR) _T(" ReactOS Team.\n"));
     }
 
     ExecuteAutoRunFile ();
@@ -1898,10 +1879,6 @@ static VOID Cleanup (int argc, const TCHAR *argv[])
                ParseCommandLine (_T("\\cmdexit.bat"));
        }
 
-#ifdef FEATURE_ALIASES
-       DestroyAlias ();
-#endif
-
 #ifdef FEATURE_DIECTORY_STACK
        /* destroy directory stack */
        DestroyDirectoryStack ();