mirror of
https://github.com/reactos/reactos.git
synced 2025-07-12 13:14:14 +00:00
translate %errorlevel% to a value when it pass at command line. Now is errorlevel implement as it should. left todo check all cmd command that they are setting right value
svn path=/trunk/; revision=16452
This commit is contained in:
parent
9254444a9c
commit
04480b3be7
1 changed files with 24 additions and 8 deletions
|
@ -134,6 +134,9 @@
|
||||||
*
|
*
|
||||||
* 06-May-2005 (Klemens Friedl <frik85@gmail.com>)
|
* 06-May-2005 (Klemens Friedl <frik85@gmail.com>)
|
||||||
* Add 'help' command (list all commands plus description)
|
* Add 'help' command (list all commands plus description)
|
||||||
|
*
|
||||||
|
* 06-jul-2005 (Magnus Olsen <magnus@greatlord.com>)
|
||||||
|
* translate '%errorlevel%' to the internal value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
@ -982,23 +985,36 @@ ProcessInput (BOOL bFlag)
|
||||||
{
|
{
|
||||||
TCHAR evar[512];
|
TCHAR evar[512];
|
||||||
*tp = _T('\0');
|
*tp = _T('\0');
|
||||||
|
|
||||||
/* FIXME: This is just a quick hack!! */
|
/* FIXME: This is just a quick hack!! */
|
||||||
/* Do a proper memory allocation!! */
|
/* Do a proper memory allocation!! */
|
||||||
if (GetEnvironmentVariable (ip, evar, 512))
|
|
||||||
cp = _stpcpy (cp, evar);
|
if (_tcsicmp(ip,_T("errorlevel")) ==0)
|
||||||
|
{
|
||||||
|
memset(evar,0,512 * sizeof(TCHAR));
|
||||||
|
_itot(nErrorLevel,evar,10);
|
||||||
|
cp = _stpcpy (cp, evar);
|
||||||
|
}
|
||||||
|
else if (GetEnvironmentVariable (ip, evar, 512))
|
||||||
|
{
|
||||||
|
cp = _stpcpy (cp, evar);
|
||||||
|
}
|
||||||
|
|
||||||
ip = tp + 1;
|
ip = tp + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*cp++ = _T('%');
|
*cp++ = _T('%');
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (_istcntrl (*ip))
|
if (_istcntrl (*ip))
|
||||||
*ip = _T(' ');
|
*ip = _T(' ');
|
||||||
*cp++ = *ip++;
|
*cp++ = *ip++;
|
||||||
|
@ -1007,10 +1023,10 @@ ProcessInput (BOOL bFlag)
|
||||||
*cp = _T('\0');
|
*cp = _T('\0');
|
||||||
|
|
||||||
/* strip trailing spaces */
|
/* strip trailing spaces */
|
||||||
while ((--cp >= commandline) && _istspace (*cp));
|
while ((--cp >= commandline) && _istspace (*cp));
|
||||||
|
|
||||||
*(cp + 1) = _T('\0');
|
*(cp + 1) = _T('\0');
|
||||||
|
|
||||||
/* JPP 19980807 */
|
/* JPP 19980807 */
|
||||||
/* Echo batch file line */
|
/* Echo batch file line */
|
||||||
if (bEchoThisLine)
|
if (bEchoThisLine)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue