mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +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>)
|
||||
* 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"
|
||||
|
@ -982,23 +985,36 @@ ProcessInput (BOOL bFlag)
|
|||
{
|
||||
TCHAR evar[512];
|
||||
*tp = _T('\0');
|
||||
|
||||
|
||||
/* FIXME: This is just a quick hack!! */
|
||||
/* Do a proper memory allocation!! */
|
||||
if (GetEnvironmentVariable (ip, evar, 512))
|
||||
cp = _stpcpy (cp, evar);
|
||||
|
||||
/* Do a proper memory allocation!! */
|
||||
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
*cp++ = _T('%');
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (_istcntrl (*ip))
|
||||
*ip = _T(' ');
|
||||
*cp++ = *ip++;
|
||||
|
@ -1007,10 +1023,10 @@ ProcessInput (BOOL bFlag)
|
|||
*cp = _T('\0');
|
||||
|
||||
/* strip trailing spaces */
|
||||
while ((--cp >= commandline) && _istspace (*cp));
|
||||
while ((--cp >= commandline) && _istspace (*cp));
|
||||
|
||||
*(cp + 1) = _T('\0');
|
||||
|
||||
|
||||
/* JPP 19980807 */
|
||||
/* Echo batch file line */
|
||||
if (bEchoThisLine)
|
||||
|
|
Loading…
Reference in a new issue