add shift.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2639
This commit is contained in:
		
							parent
							
								
									c02188b774
								
							
						
					
					
						commit
						1303deba35
					
				
					 4 changed files with 18 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -16,7 +16,7 @@
 | 
			
		|||
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* $Id: shell.h,v 1.15 2006-02-09 11:47:48 qbix79 Exp $ */
 | 
			
		||||
/* $Id: shell.h,v 1.16 2006-05-25 15:08:40 qbix79 Exp $ */
 | 
			
		||||
 | 
			
		||||
#ifndef DOSBOX_SHELL_H
 | 
			
		||||
#define DOSBOX_SHELL_H
 | 
			
		||||
| 
						 | 
				
			
			@ -48,6 +48,7 @@ public:
 | 
			
		|||
	~BatchFile();
 | 
			
		||||
	bool ReadLine(char * line);
 | 
			
		||||
	bool Goto(char * where);
 | 
			
		||||
	void Shift(void);
 | 
			
		||||
	Bit16u file_handle;
 | 
			
		||||
	bool echo;
 | 
			
		||||
	DOS_Shell * shell;
 | 
			
		||||
| 
						 | 
				
			
			@ -104,6 +105,7 @@ public:
 | 
			
		|||
	void CMD_CHOICE(char * args);
 | 
			
		||||
	void CMD_ATTRIB(char * args);
 | 
			
		||||
	void CMD_PATH(char * args);
 | 
			
		||||
	void CMD_SHIFT(char * /*args*/);
 | 
			
		||||
	/* The shell's variables */
 | 
			
		||||
	Bit16u input_handle;
 | 
			
		||||
	BatchFile * bf;
 | 
			
		||||
| 
						 | 
				
			
			@ -113,10 +115,10 @@ public:
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
struct SHELL_Cmd {
 | 
			
		||||
    const char * name;								/* Command name*/
 | 
			
		||||
	const char * name;								/* Command name*/
 | 
			
		||||
	Bit32u flags;									/* Flags about the command */
 | 
			
		||||
    void (DOS_Shell::*handler)(char * args);		/* Handler for this command */
 | 
			
		||||
    const char * help;								/* String with command help */
 | 
			
		||||
	void (DOS_Shell::*handler)(char * args);		/* Handler for this command */
 | 
			
		||||
	const char * help;								/* String with command help */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static inline void StripSpaces(char*&args) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@
 | 
			
		|||
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* $Id: shell.cpp,v 1.73 2006-04-29 10:05:55 c2woody Exp $ */
 | 
			
		||||
/* $Id: shell.cpp,v 1.74 2006-05-25 15:08:40 qbix79 Exp $ */
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <stdarg.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -320,7 +320,7 @@ void DOS_Shell::Run(void) {
 | 
			
		|||
			if (echo) ShowPrompt();
 | 
			
		||||
			InputCommand(input_line);
 | 
			
		||||
			ParseLine(input_line);
 | 
			
		||||
			if (echo) WriteOut("\n");
 | 
			
		||||
			if (echo && !bf) WriteOut("\n");
 | 
			
		||||
		}
 | 
			
		||||
	} while (!exit);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -496,6 +496,7 @@ void SHELL_Init() {
 | 
			
		|||
	MSG_Add("SHELL_CMD_SET_HELP","Change environment variables.\n");
 | 
			
		||||
	MSG_Add("SHELL_CMD_IF_HELP","Performs conditional processing in batch programs.\n");
 | 
			
		||||
	MSG_Add("SHELL_CMD_GOTO_HELP","Jump to a labeled line in a batch script.\n");
 | 
			
		||||
	MSG_Add("SHELL_CMD_SHIFT_HELP","Leftshift commandline parameters in a batch script.\n");
 | 
			
		||||
	MSG_Add("SHELL_CMD_TYPE_HELP","Display the contents of a text-file.\n");
 | 
			
		||||
	MSG_Add("SHELL_CMD_REM_HELP","Add comments in a batch file.\n");
 | 
			
		||||
	MSG_Add("SHELL_CMD_NO_WILD","This is a simple version of the command, no wildcards allowed!\n");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@
 | 
			
		|||
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* $Id: shell_batch.cpp,v 1.20 2006-02-23 08:13:14 qbix79 Exp $ */
 | 
			
		||||
/* $Id: shell_batch.cpp,v 1.21 2006-05-25 15:08:40 qbix79 Exp $ */
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -149,3 +149,6 @@ again:
 | 
			
		|||
	goto again;
 | 
			
		||||
	return false;
 | 
			
		||||
};
 | 
			
		||||
void BatchFile::Shift(void) {
 | 
			
		||||
	cmd->Shift(1);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@
 | 
			
		|||
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* $Id: shell_cmds.cpp,v 1.66 2006-04-23 15:17:07 qbix79 Exp $ */
 | 
			
		||||
/* $Id: shell_cmds.cpp,v 1.67 2006-05-25 15:08:40 qbix79 Exp $ */
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -46,6 +46,7 @@ static SHELL_Cmd cmd_list[]={
 | 
			
		|||
{	"SET",		0,			&DOS_Shell::CMD_SET,		"SHELL_CMD_SET_HELP"},
 | 
			
		||||
{	"IF",		0,			&DOS_Shell::CMD_IF,			"SHELL_CMD_IF_HELP"},
 | 
			
		||||
{	"GOTO",		0,			&DOS_Shell::CMD_GOTO,		"SHELL_CMD_GOTO_HELP"},
 | 
			
		||||
{	"SHIFT",	0,			&DOS_Shell::CMD_SHIFT,		"SHELL_CMD_SHIFT_HELP"},
 | 
			
		||||
{	"TYPE",		0,			&DOS_Shell::CMD_TYPE,		"SHELL_CMD_TYPE_HELP"},
 | 
			
		||||
{	"REM",		0,			&DOS_Shell::CMD_REM,		"SHELL_CMD_REM_HELP"},
 | 
			
		||||
{	"RENAME",	0,			&DOS_Shell::CMD_RENAME,		"SHELL_CMD_RENAME_HELP"},
 | 
			
		||||
| 
						 | 
				
			
			@ -670,6 +671,9 @@ void DOS_Shell::CMD_GOTO(char * args) {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DOS_Shell::CMD_SHIFT(char * /*args*/ ) {
 | 
			
		||||
	if(bf) bf->Shift();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DOS_Shell::CMD_TYPE(char * args) {
 | 
			
		||||
	StripSpaces(args);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue