ReactOS 0.4.15-dev-7942-gd23573b
shift.c
Go to the documentation of this file.
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)
17 * Added help text ("shift /?") and cleaned up.
18 *
19 * 20-Jan-1999 (Eric Kohl)
20 * Unicode and redirection safe!
21 *
22 * 30-Apr-2005 (Magnus Olsen <magnus@greatlord.com>)
23 * Remove all hardcoded strings in En.rc
24 */
25
26#include "precomp.h"
27
28/*
29 * Perform the SHIFT command.
30 *
31 * Only valid inside batch files.
32 *
33 * FREEDOS extension : optional parameter DOWN to allow shifting
34 * parameters backwards.
35 *
36 */
37
39{
40 INT i = 0;
41 TRACE ("cmd_shift: (\'%s\')\n", debugstr_aw(param));
42
43 if (!_tcsncmp (param, _T("/?"), 2))
44 {
46 return 0;
47 }
48
49 nErrorLevel = 0;
50
51 if (bc == NULL)
52 {
53 /* not in batch - error!! */
54 nErrorLevel = 1;
55 return 1;
56 }
57
58 if (!_tcsicmp (param, _T("down")))
59 {
60 if (bc->shiftlevel[0])
61 for (; i <= 9; i++)
62 bc->shiftlevel[i]--;
63 }
64 else /* shift up */
65 {
66 if (*param == _T('/'))
67 {
68 if (!_istdigit(param[1]))
69 {
71 return 1;
72 }
73 i = param[1] - '0';
74 }
75
76 for (; i < 9; i++)
77 bc->shiftlevel[i] = bc->shiftlevel[i + 1];
78 bc->shiftlevel[i]++;
79 }
80
81 return 0;
82}
83
84/* EOF */
PBATCH_CONTEXT bc
Definition: batch.c:67
INT nErrorLevel
Definition: cmd.c:158
VOID error_invalid_switch(TCHAR ch)
Definition: error.c:72
VOID ConOutResPaging(BOOL StartPaging, UINT resID)
Definition: console.c:182
#define debugstr_aw
Definition: precomp.h:43
#define STRING_SHIFT_HELP
Definition: resource.h:169
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
GLfloat param
Definition: glext.h:5796
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define _istdigit
Definition: tchar.h:1494
#define _tcsncmp
Definition: tchar.h:1428
INT cmd_shift(LPTSTR param)
Definition: shift.c:38
#define TRACE(s)
Definition: solgame.cpp:4
INT shiftlevel[10]
Definition: batch.h:36
int32_t INT
Definition: typedefs.h:58
#define _T(x)
Definition: vfdio.h:22
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define _tcsicmp
Definition: xmlstorage.h:205