mirror of
https://github.com/reactos/reactos.git
synced 2024-09-04 09:39:07 +00:00
remove some hardcode commadline buffer value. first step to implement dymatic buffer. but we need do it very carefull, so nothing will be broken.
svn path=/trunk/; revision=17626
This commit is contained in:
parent
ada0f8dfe8
commit
25f28a6291
|
@ -21,8 +21,8 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
|
||||||
{
|
{
|
||||||
TCHAR szFullName[MAX_PATH];
|
TCHAR szFullName[MAX_PATH];
|
||||||
TCHAR first[CMDLINE_LENGTH];
|
TCHAR first[CMDLINE_LENGTH];
|
||||||
TCHAR rest[CMDLINE_LENGTH];
|
TCHAR *rest;
|
||||||
TCHAR param[CMDLINE_LENGTH];
|
TCHAR *param;
|
||||||
BOOL bWait = FALSE;
|
BOOL bWait = FALSE;
|
||||||
BOOL bBat = FALSE;
|
BOOL bBat = FALSE;
|
||||||
BOOL bCreate = FALSE;
|
BOOL bCreate = FALSE;
|
||||||
|
@ -30,6 +30,9 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
|
||||||
PROCESS_INFORMATION prci;
|
PROCESS_INFORMATION prci;
|
||||||
STARTUPINFO stui;
|
STARTUPINFO stui;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
param[0] = _T('\0');
|
param[0] = _T('\0');
|
||||||
|
|
||||||
if (_tcsncmp (Rest, _T("/?"), 2) == 0)
|
if (_tcsncmp (Rest, _T("/?"), 2) == 0)
|
||||||
|
@ -46,6 +49,8 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
|
||||||
Rest = _T("cmd");
|
Rest = _T("cmd");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rest = malloc ( _tcslen(Rest) + 1 * sizeof(TCHAR));
|
||||||
|
|
||||||
_tcscpy(rest,Rest);
|
_tcscpy(rest,Rest);
|
||||||
|
|
||||||
/* Parsing the command that gets called by start, and it's parameters */
|
/* Parsing the command that gets called by start, and it's parameters */
|
||||||
|
@ -59,6 +64,7 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
|
||||||
{
|
{
|
||||||
if(rest[i] == _T(' '))
|
if(rest[i] == _T(' '))
|
||||||
{
|
{
|
||||||
|
param = malloc ( _tcslen(&rest[i]) + 1 * sizeof(TCHAR));
|
||||||
_tcscpy(param,&rest[i]);
|
_tcscpy(param,&rest[i]);
|
||||||
rest[i] = _T('\0');
|
rest[i] = _T('\0');
|
||||||
break;
|
break;
|
||||||
|
@ -95,6 +101,7 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for a drive change */
|
/* check for a drive change */
|
||||||
|
|
||||||
if (!_tcscmp (first + 1, _T(":")) && _istalpha (*first))
|
if (!_tcscmp (first + 1, _T(":")) && _istalpha (*first))
|
||||||
{
|
{
|
||||||
TCHAR szPath[MAX_PATH];
|
TCHAR szPath[MAX_PATH];
|
||||||
|
@ -106,14 +113,27 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
|
||||||
if (szPath[0] != (TCHAR)_totupper (*first))
|
if (szPath[0] != (TCHAR)_totupper (*first))
|
||||||
ConErrResPuts (STRING_FREE_ERROR1);
|
ConErrResPuts (STRING_FREE_ERROR1);
|
||||||
|
|
||||||
|
if (rest != NULL)
|
||||||
|
free(rest);
|
||||||
|
|
||||||
|
if (param != NULL)
|
||||||
|
free(param);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* get the PATH environment variable and parse it */
|
/* get the PATH environment variable and parse it */
|
||||||
/* search the PATH environment variable for the binary */
|
/* search the PATH environment variable for the binary */
|
||||||
if (!SearchForExecutable (rest, szFullName))
|
if (!SearchForExecutable (rest, szFullName))
|
||||||
{
|
{
|
||||||
error_bad_command ();
|
error_bad_command ();
|
||||||
|
|
||||||
|
if (rest != NULL)
|
||||||
|
free(rest);
|
||||||
|
|
||||||
|
if (param != NULL)
|
||||||
|
free(param);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,6 +148,12 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
|
||||||
if (!SearchForExecutable (_T("CMD"), szFullCmdLine))
|
if (!SearchForExecutable (_T("CMD"), szFullCmdLine))
|
||||||
{
|
{
|
||||||
error_bad_command ();
|
error_bad_command ();
|
||||||
|
if (rest != NULL)
|
||||||
|
free(rest);
|
||||||
|
|
||||||
|
if (param != NULL)
|
||||||
|
free(param);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,6 +226,12 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
if (rest != NULL)
|
||||||
|
free(rest);
|
||||||
|
|
||||||
|
if (param != NULL)
|
||||||
|
free(param);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue