moved shell_inc.h to include
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1494
This commit is contained in:
parent
82155f2b42
commit
735883416c
4 changed files with 159 additions and 5 deletions
149
include/shell.h
Normal file
149
include/shell.h
Normal file
|
@ -0,0 +1,149 @@
|
|||
/*
|
||||
* Copyright (C) 2002-2003 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: shell.h,v 1.1 2003-12-17 21:49:31 qbix79 Exp $ */
|
||||
|
||||
#ifndef SHELL_H_
|
||||
#define SHELL_H_
|
||||
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include "dosbox.h"
|
||||
#include "mem.h"
|
||||
#include "programs.h"
|
||||
#include "dos_inc.h"
|
||||
#include "regs.h"
|
||||
#include "support.h"
|
||||
#include "callback.h"
|
||||
#include "setup.h"
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#define CMD_MAXLINE 4096
|
||||
#define CMD_MAXCMDS 20
|
||||
#define CMD_OLDSIZE 4096
|
||||
extern Bitu call_shellstop;
|
||||
class DOS_Shell;
|
||||
|
||||
|
||||
class BatchFile {
|
||||
public:
|
||||
BatchFile(DOS_Shell * host,char * name, char * cmd_line);
|
||||
~BatchFile();
|
||||
bool ReadLine(char * line);
|
||||
bool Goto(char * where);
|
||||
Bit16u file_handle;
|
||||
bool echo;
|
||||
DOS_Shell * shell;
|
||||
BatchFile * prev;
|
||||
CommandLine * cmd;
|
||||
};
|
||||
|
||||
class DOS_Shell : public Program {
|
||||
|
||||
private:
|
||||
|
||||
std::list<std::string> l_history, l_completion;
|
||||
|
||||
char *completion_start;
|
||||
Bit16u completion_index;
|
||||
|
||||
public:
|
||||
|
||||
DOS_Shell();
|
||||
|
||||
void Run(void);
|
||||
void RunInternal(void); //for command /C
|
||||
/* A load of subfunctions */
|
||||
void ParseLine(char * line);
|
||||
Bitu GetRedirection(char *s, char **ifn, char **ofn,bool * append);
|
||||
void InputCommand(char * line);
|
||||
void ShowPrompt();
|
||||
void DoCommand(char * cmd);
|
||||
void Execute(char * name,char * args);
|
||||
/* Some internal used functions */
|
||||
char * Which(char * name);
|
||||
/* Some supported commands */
|
||||
void CMD_HELP(char * args);
|
||||
void CMD_CLS(char * args);
|
||||
void CMD_COPY(char * args);
|
||||
void CMD_DIR(char * args);
|
||||
void CMD_DELETE(char * args);
|
||||
void CMD_ECHO(char * args);
|
||||
void CMD_EXIT(char * args);
|
||||
void CMD_MKDIR(char * args);
|
||||
void CMD_CHDIR(char * args);
|
||||
void CMD_RMDIR(char * args);
|
||||
void CMD_SET(char * args);
|
||||
void CMD_IF(char * args);
|
||||
void CMD_GOTO(char * args);
|
||||
void CMD_TYPE(char * args);
|
||||
void CMD_REM(char * args);
|
||||
void CMD_RENAME(char * args);
|
||||
void CMD_CALL(char * args);
|
||||
void SyntaxError(void);
|
||||
void CMD_PAUSE(char * args);
|
||||
void CMD_SUBST(char* args);
|
||||
void CMD_LOADHIGH(char* args);
|
||||
/* The shell's variables */
|
||||
Bit16u input_handle;
|
||||
BatchFile * bf;
|
||||
bool echo;
|
||||
bool exit;
|
||||
bool call;
|
||||
};
|
||||
|
||||
struct SHELL_Cmd {
|
||||
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 */
|
||||
};
|
||||
|
||||
static inline void StripSpaces(char*&args)
|
||||
{
|
||||
while(*args && (*args == ' '))
|
||||
args++;
|
||||
}
|
||||
|
||||
|
||||
static inline char* ExpandDot(char*args, char* buffer)
|
||||
{
|
||||
if(*args=='.')
|
||||
{
|
||||
if(*(args+1)==0)
|
||||
{
|
||||
strcpy(buffer,"*.*");
|
||||
return buffer;
|
||||
}
|
||||
if( (*(args+1)!='.') && (*(args+1)!='\\') )
|
||||
{
|
||||
buffer[0]='*';
|
||||
buffer[1]=0;
|
||||
strcat(buffer,args);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
else strcpy(buffer,args);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -16,6 +16,8 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: debug.cpp,v 1.48 2003-12-17 21:52:23 qbix79 Exp $ */
|
||||
|
||||
#include "programs.h"
|
||||
|
||||
#include <string.h>
|
||||
|
@ -36,7 +38,7 @@
|
|||
#include "timer.h"
|
||||
#include "paging.h"
|
||||
#include "../ints/xms.h"
|
||||
#include "../shell/shell_inc.h"
|
||||
#include "shell.h"
|
||||
|
||||
#ifdef WIN32
|
||||
void WIN32_Console();
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dos_programs.cpp,v 1.20 2003-09-08 18:10:08 qbix79 Exp $ */
|
||||
/* $Id: dos_programs.cpp,v 1.21 2003-12-17 21:55:42 qbix79 Exp $ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -28,7 +28,7 @@
|
|||
#include "regs.h"
|
||||
#include "callback.h"
|
||||
#include "cdrom.h"
|
||||
#include "../shell/shell_inc.h"
|
||||
|
||||
|
||||
void MSCDEX_SetCDInterface(int intNr, int forceCD);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
* Copyright (C) 2002-2003 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,11 +16,14 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: drives.h,v 1.18 2003-12-17 21:54:31 qbix79 Exp $ */
|
||||
|
||||
#ifndef _DRIVES_H__
|
||||
#define _DRIVES_H__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "dos_system.h"
|
||||
#include "shell.h" /* for DOS_Shell */
|
||||
|
||||
bool WildFileCmp(const char * file, const char * wild);
|
||||
|
||||
|
@ -44,7 +47,7 @@ public:
|
|||
virtual bool isRemote(void);
|
||||
private:
|
||||
char basedir[CROSS_LEN];
|
||||
|
||||
friend void DOS_Shell::CMD_SUBST(char* args);
|
||||
struct {
|
||||
char srch_dir[CROSS_LEN];
|
||||
} srchInfo[MAX_OPENDIRS];
|
||||
|
|
Loading…
Add table
Reference in a new issue