move network tools
[reactos.git] / reactos / subsys / system / cmd / shift.c
1 /*
2 * SHIFT.C - shift internal batch command
3 *
4 *
5 * History:
6 *
7 * 16 Jul 1998 (Hans B Pufal)
8 * started.
9 *
10 * 16 Jul 1998 (John P Price)
11 * Separated commands into individual files.
12 *
13 * 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
14 * added config.h include
15 *
16 * 07-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
17 * Added help text ("shift /?") and cleaned up.
18 *
19 * 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
20 * Unicode and redirection safe!
21 *
22 * 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
23 * Remove all hardcode string to En.rc
24 */
25
26 #include <precomp.h>
27 #include "resource.h"
28
29
30 /*
31 * Perform the SHIFT command.
32 *
33 * Only valid inside batch files.
34 *
35 * FREEDOS extension : optional parameter DOWN to allow shifting
36 * parameters backwards.
37 *
38 */
39
40 INT cmd_shift (LPTSTR cmd, LPTSTR param)
41 {
42
43 #ifdef _DEBUG
44 DebugPrintf (_T("cmd_shift: (\'%s\', \'%s\')\n"), cmd, param);
45 #endif
46
47 if (!_tcsncmp (param, _T("/?"), 2))
48 {
49 ConOutResPaging(TRUE,STRING_SHIFT_HELP);
50 return 0;
51 }
52
53 nErrorLevel = 0;
54
55 if (bc == NULL)
56 {
57 /* not in batch - error!! */
58 nErrorLevel = 1;
59 return 1;
60 }
61
62 if (!_tcsicmp (param, _T("down")))
63 {
64 if (bc->shiftlevel)
65 bc->shiftlevel--;
66 }
67 else /* shift up */
68 bc->shiftlevel++;
69
70 return 0;
71 }
72
73 /* EOF */