cmd.c - when the env isnt found, dont zero out the params
redir.c - skip over all ^ when looking for redir/pipe
echo.c - when printing out, treat ^ correctly.
svn path=/trunk/; revision=17545
cp = commandline;
while (*ip)
{
cp = commandline;
while (*ip)
{
GetCurrentDirectory (MAX_PATH, szPath);
cp = _stpcpy (cp, szPath);
}
GetCurrentDirectory (MAX_PATH, szPath);
cp = _stpcpy (cp, szPath);
}
/* %TIME% */
else if (_tcsicmp(ip,_T("time")) ==0)
{
/* %TIME% */
else if (_tcsicmp(ip,_T("time")) ==0)
{
evar = malloc ( 512 * sizeof(TCHAR));
if (evar==NULL)
return 1;
evar = malloc ( 512 * sizeof(TCHAR));
if (evar==NULL)
return 1;
size = GetEnvironmentVariable (ip, evar, 512);
size = GetEnvironmentVariable (ip, evar, 512);
+ if(GetLastError() == ERROR_ENVVAR_NOT_FOUND)
+ {
+ /* if no env var is found you must
+ continue with what was input*/
+ cp = _stpcpy (cp, _T("%"));
+ cp = _stpcpy (cp, ip);
+ cp = _stpcpy (cp, _T("%"));
+ }
+ else
+ {
if (size > 512)
{
evar = realloc(evar,size * sizeof(TCHAR) );
if (size > 512)
{
evar = realloc(evar,size * sizeof(TCHAR) );
{
cp = _stpcpy (cp, evar);
}
{
cp = _stpcpy (cp, evar);
}
INT CommandEcho (LPTSTR cmd, LPTSTR param)
{
TCHAR szMsg[RC_STRING_MAX_SIZE];
INT CommandEcho (LPTSTR cmd, LPTSTR param)
{
TCHAR szMsg[RC_STRING_MAX_SIZE];
#ifdef _DEBUG
DebugPrintf (_T("CommandEcho '%s' : '%s'\n"), cmd, param);
#ifdef _DEBUG
DebugPrintf (_T("CommandEcho '%s' : '%s'\n"), cmd, param);
else if (_tcsicmp (param, D_ON) == 0)
bEcho = TRUE;
else if (*param)
else if (_tcsicmp (param, D_ON) == 0)
bEcho = TRUE;
else if (*param)
+ {
+ while(i < _tcslen(param))
+ {
+ if(param[i] == _T('^'))
+ {
+ memmove(¶m[i],¶m[i + 1], _tcslen(¶m[i]) * sizeof(TCHAR));
+ //skip past the char being escaped
+ i++;
+ }
+ else
+ i++;
+ }
else
{
LoadString(CMD_ModuleHandle, STRING_ECHO_HELP5, szMsg, RC_STRING_MAX_SIZE);
else
{
LoadString(CMD_ModuleHandle, STRING_ECHO_HELP5, szMsg, RC_STRING_MAX_SIZE);
/* find and remove all the redirections first */
while (*sp)
{
/* find and remove all the redirections first */
while (*sp)
{
+ if (*sp == _T('^'))
+ {
+ *dp++ = *sp++;
+ *dp++ = *sp++;
+ continue;
+ }
if ((*sp == _T('"')) || (*sp == _T('\'')))
{
/* No redirects inside quotes */
if ((*sp == _T('"')) || (*sp == _T('\'')))
{
/* No redirects inside quotes */
- if ((*sp == _T('"')) || (*sp == _T('\'')))
+ if (*sp == _T('^'))
+ {
+ *sp++;
+ *sp++;
+ continue;
+ }
+ else if ((*sp == _T('"')) || (*sp == _T('\'')))