fix errors in "activate". Change activate, window, and msgbox commands from checking...
authorBrandon Turner <turnerb7@msu.edu>
Tue, 18 Oct 2005 13:32:32 +0000 (13:32 +0000)
committerBrandon Turner <turnerb7@msu.edu>
Tue, 18 Oct 2005 13:32:32 +0000 (13:32 +0000)
svn path=/trunk/; revision=18552

reactos/subsys/system/cmd/config.h
reactos/subsys/system/cmd/window.c

index bd59a55..356af14 100644 (file)
@@ -20,6 +20,8 @@
 
 #define WIN32_LEAN_AND_MEAN
 
+//#define NT4_INTERNAL_COMMANDS
+
 /* Define to enable the alias command, and aliases.*/
 #define FEATURE_ALIASES
 
@@ -51,7 +53,7 @@
 /* #define LOCALE_GERMAN */    /* German locale */
 /* #define LOCALE_DEFAULT */   /* United States locale */
 
-#ifndef __REACTOS__
+#ifdef NT4_INTERNAL_COMMANDS
 #define INCLUDE_CMD_ACTIVATE
 #endif
 #define INCLUDE_CMD_ATTRIB
@@ -70,7 +72,7 @@
 #define INCLUDE_CMD_MEMORY
 #define INCLUDE_CMD_MKDIR
 #define INCLUDE_CMD_MOVE
-#ifndef __REACTOS__
+#ifdef NT4_INTERNAL_COMMANDS
 #define INCLUDE_CMD_MSGBOX
 #endif
 #define INCLUDE_CMD_PATH
@@ -90,7 +92,7 @@
 #define INCLUDE_CMD_BEEP
 #define INCLUDE_CMD_VERIFY
 #define INCLUDE_CMD_VOL
-#ifndef __REACTOS__
+#ifdef NT4_INTERNAL_COMMANDS
 #define INCLUDE_CMD_WINDOW
 #endif
 
index ef17c90..10ac14c 100644 (file)
@@ -49,8 +49,7 @@ static INT ServiceActivate (LPTSTR param, HWND hWnd)
 
 
        if (*param)
-               p = split(param, &argc);
-
+               p = split(param, &argc, FALSE);
 
        for (i = 0; i < argc; i++)
        {
@@ -187,7 +186,7 @@ INT CommandWindow (LPTSTR cmd, LPTSTR param)
                return 0;
        }
 
-       h = GetConsoleWindow();
+       hwnd = GetConsoleWindow();
        Sleep(0);
        return ServiceActivate(param, hwnd);
 }
@@ -195,8 +194,9 @@ INT CommandWindow (LPTSTR cmd, LPTSTR param)
 
 INT CommandActivate (LPTSTR cmd, LPTSTR param)
 {
-       LPTSTR str;
        HWND hwnd;
+       LPTSTR *arg;
+       INT argc;
 
        if (_tcsncmp (param, _T("/?"), 2) == 0)
        {
@@ -207,24 +207,25 @@ INT CommandActivate (LPTSTR cmd, LPTSTR param)
        if(!(*param))
                return 1;
 
-       str=_tcschr(param,_T(' '));
-
-       if (str)
+       /*Split the user input into array*/
+       arg = split (param, &argc, FALSE);
+       if(argc < 2)
        {
-               *str=_T('\0');
-               str++;
+               if(arg != NULL)
+                       freep(arg);
        }
-       else
-               str = "";
-
-       hwnd = FindWindow(NULL, param);
+       hwnd = FindWindow(NULL, arg[0]);
        if (hwnd == NULL)
        {
+               if(arg != NULL)
+                       freep(arg);
                ConErrResPuts(STRING_WINDOW_ERROR1);
                return 1;
        }
+       if(arg != NULL)
+               freep(arg);
 
-       return ServiceActivate(str, hwnd);
+       return ServiceActivate(param, hwnd);
 }
 
 #endif /* (  defined(INCLUDE_CMD_WINDOW) ||  defined(INCLUDE_CMD_ACTIVATE)  ) */