reactos/reactos/base/shell/cmd/shift.c
Jeffrey Morlan c49ed3a82c Remove the "LPTSTR cmd" argument to internal commands; there's no need for a command to be told its own name. It was only used in two places:
- a hack in cmd_mkdir that was already obsolete a decade ago
- to distinguish "echo" from "echo.", but that is the wrong way to implement this anyway. There's nothing particularly special about the period, "echo" is just one of those commands that is lenient about where its parameters begin, and when it echos a line, the first character (usually a space, but in the case of "echo." a period) is skipped.

svn path=/trunk/; revision=35647
2008-08-25 23:22:03 +00:00

71 lines
1.2 KiB
C

/*
* SHIFT.C - shift internal batch command
*
*
* History:
*
* 16 Jul 1998 (Hans B Pufal)
* started.
*
* 16 Jul 1998 (John P Price)
* Separated commands into individual files.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 07-Jan-1999 (Eric Kohl)
* Added help text ("shift /?") and cleaned up.
*
* 20-Jan-1999 (Eric Kohl)
* Unicode and redirection safe!
*
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
* Remove all hardcode string to En.rc
*/
#include <precomp.h>
/*
* Perform the SHIFT command.
*
* Only valid inside batch files.
*
* FREEDOS extension : optional parameter DOWN to allow shifting
* parameters backwards.
*
*/
INT cmd_shift (LPTSTR param)
{
TRACE ("cmd_shift: (\'%s\')\n", debugstr_aw(param));
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutResPaging(TRUE,STRING_SHIFT_HELP);
return 0;
}
nErrorLevel = 0;
if (bc == NULL)
{
/* not in batch - error!! */
nErrorLevel = 1;
return 1;
}
if (!_tcsicmp (param, _T("down")))
{
if (bc->shiftlevel)
bc->shiftlevel--;
}
else /* shift up */
bc->shiftlevel++;
return 0;
}
/* EOF */