Add slightly modified help system of ykhwong. Added a few of the descriptions as well.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2678
This commit is contained in:
parent
6215071ebc
commit
a56dddbb12
3 changed files with 64 additions and 9 deletions
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: shell.h,v 1.17 2006-07-21 09:40:10 qbix79 Exp $ */
|
||||
/* $Id: shell.h,v 1.18 2006-07-26 11:36:30 qbix79 Exp $ */
|
||||
|
||||
#ifndef DOSBOX_SHELL_H
|
||||
#define DOSBOX_SHELL_H
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
void CMD_CHOICE(char * args);
|
||||
void CMD_ATTRIB(char * args);
|
||||
void CMD_PATH(char * args);
|
||||
void CMD_SHIFT(char * /*args*/);
|
||||
void CMD_SHIFT(char * args);
|
||||
void CMD_VER(char * args);
|
||||
/* The shell's variables */
|
||||
Bit16u input_handle;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: shell.cpp,v 1.76 2006-07-21 09:40:10 qbix79 Exp $ */
|
||||
/* $Id: shell.cpp,v 1.77 2006-07-26 11:36:30 qbix79 Exp $ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -485,28 +485,49 @@ void SHELL_Init() {
|
|||
"\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBC\033[0m\n"
|
||||
//"\n" //Breaks the startup message if you type a mount and a drive change.
|
||||
);
|
||||
MSG_Add("SHELL_CMD_CHDIR_HELP","Change Directory.\n");
|
||||
MSG_Add("SHELL_CMD_CHDIR_HELP","Displays/changes the current directory.\n");
|
||||
MSG_Add("SHELL_CMD_CHDIR_HELP_LONG","CHDIR [drive:][path]\n"
|
||||
"CHDIR [..]\n"
|
||||
"CD [drive:][path]\n"
|
||||
"CD [..]\n\n"
|
||||
" .. Specifies that you want to change to the parent directory.\n\n"
|
||||
"Type CD drive: to display the current directory in the specified drive.\n"
|
||||
"Type CD without parameters to display the current drive and directory.\n");
|
||||
MSG_Add("SHELL_CMD_CLS_HELP","Clear screen.\n");
|
||||
MSG_Add("SHELL_CMD_DIR_HELP","Directory View.\n");
|
||||
MSG_Add("SHELL_CMD_ECHO_HELP","Display messages and enable/disable command echoing.\n");
|
||||
MSG_Add("SHELL_CMD_EXIT_HELP","Exit from the shell.\n");
|
||||
MSG_Add("SHELL_CMD_HELP_HELP","Show help.\n");
|
||||
MSG_Add("SHELL_CMD_MKDIR_HELP","Make Directory.\n");
|
||||
MSG_Add("SHELL_CMD_MKDIR_HELP_LONG","MKDIR [drive:][path]\n"
|
||||
"MD [drive:][path]\n");
|
||||
MSG_Add("SHELL_CMD_RMDIR_HELP","Remove Directory.\n");
|
||||
MSG_Add("SHELL_CMD_RMDIR_HELP_LONG","RMDIR [drive:][path]\n"
|
||||
"RD [drive:][path]\n");
|
||||
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_TYPE_HELP_LONG","TYPE [drive:][path][filename]\n");
|
||||
MSG_Add("SHELL_CMD_REM_HELP","Add comments in a batch file.\n");
|
||||
MSG_Add("SHELL_CMD_REM_HELP_LONG","REM [comment]\n");
|
||||
MSG_Add("SHELL_CMD_NO_WILD","This is a simple version of the command, no wildcards allowed!\n");
|
||||
MSG_Add("SHELL_CMD_RENAME_HELP","Renames files.\n");
|
||||
MSG_Add("SHELL_CMD_DELETE_HELP","Removes files.\n");
|
||||
MSG_Add("SHELL_CMD_RENAME_HELP","Renames one or more files.\n");
|
||||
MSG_Add("SHELL_CMD_RENAME_HELP_LONG","RENAME [drive:][path]filename1 filename2.\n"
|
||||
"REN [drive:][path]filename1 filename2.\n\n"
|
||||
"Note that you can not specify a new drive or path for your destination file.\n");
|
||||
MSG_Add("SHELL_CMD_DELETE_HELP","Removes one or more files.\n");
|
||||
MSG_Add("SHELL_CMD_COPY_HELP","Copy files.\n");
|
||||
MSG_Add("SHELL_CMD_CALL_HELP","Start a batch file from within another batch file.\n");
|
||||
MSG_Add("SHELL_CMD_SUBST_HELP","Assign an internal directory to a drive.\n");
|
||||
MSG_Add("SHELL_CMD_LOADHIGH_HELP","Loads a program into upper memory (requires xms=true,umb=true).\n");
|
||||
MSG_Add("SHELL_CMD_CHOICE_HELP","Waits for a keypress and sets ERRORLEVEL.\n");
|
||||
MSG_Add("SHELL_CMD_CHOICE_HELP_LONG","CHOICE [/C:choices] [/N] [/S] text\n"
|
||||
" /C[:]choices - Specifies allowable keys. Default is: yn.\n"
|
||||
" /N - Do not display the choices at end of prompt.\n"
|
||||
" /S - Enables case-sensitive choices to be selected.\n"
|
||||
" text - The text to display as a prompt.\n");
|
||||
MSG_Add("SHELL_CMD_ATTRIB_HELP","Does nothing. Provided for compatibility.\n");
|
||||
MSG_Add("SHELL_CMD_PATH_HELP","Provided for compatibility.\n");
|
||||
MSG_Add("SHELL_CMD_VER_HELP","View and set the reported DOS version.\n");
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: shell_cmds.cpp,v 1.68 2006-07-21 09:40:10 qbix79 Exp $ */
|
||||
/* $Id: shell_cmds.cpp,v 1.69 2006-07-26 11:36:30 qbix79 Exp $ */
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
@ -117,13 +117,24 @@ void DOS_Shell::DoCommand(char * line) {
|
|||
WriteOut(MSG_Get("SHELL_EXECUTE_ILLEGAL_COMMAND"),cmd);
|
||||
}
|
||||
|
||||
#define HELP(command) \
|
||||
if (ScanCMDBool(args,"?")) { \
|
||||
WriteOut(MSG_Get("SHELL_CMD_" command "_HELP")); \
|
||||
const char* long_m = MSG_Get("SHELL_CMD_" command "_HELP_LONG"); \
|
||||
WriteOut("\n"); \
|
||||
if(strcmp("Message not Found!\n",long_m)) WriteOut(long_m); \
|
||||
else WriteOut(command "\n"); \
|
||||
return; \
|
||||
}
|
||||
|
||||
void DOS_Shell::CMD_CLS(char * args) {
|
||||
HELP("CLS");
|
||||
reg_ax=0x0003;
|
||||
CALLBACK_RunRealInt(0x10);
|
||||
};
|
||||
|
||||
void DOS_Shell::CMD_DELETE(char * args) {
|
||||
HELP("DELETE");
|
||||
/* Command uses dta so set it to our internal dta */
|
||||
RealPt save_dta=dos.dta();
|
||||
dos.dta(dos.tables.tempdta);
|
||||
|
@ -163,6 +174,7 @@ void DOS_Shell::CMD_DELETE(char * args) {
|
|||
}
|
||||
|
||||
void DOS_Shell::CMD_HELP(char * args){
|
||||
HELP("HELP");
|
||||
/* Print the help */
|
||||
WriteOut(MSG_Get("SHELL_CMD_HELP"));
|
||||
Bit32u cmd_index=0;
|
||||
|
@ -174,6 +186,7 @@ void DOS_Shell::CMD_HELP(char * args){
|
|||
}
|
||||
|
||||
void DOS_Shell::CMD_RENAME(char * args){
|
||||
HELP("RENAME");
|
||||
StripSpaces(args);
|
||||
if(!*args) {SyntaxError();return;}
|
||||
if((strchr(args,'*')!=NULL) || (strchr(args,'?')!=NULL) ) { WriteOut(MSG_Get("SHELL_CMD_NO_WILD"));return;}
|
||||
|
@ -207,6 +220,7 @@ void DOS_Shell::CMD_RENAME(char * args){
|
|||
}
|
||||
|
||||
void DOS_Shell::CMD_ECHO(char * args){
|
||||
HELP("ECHO");
|
||||
if (!*args) {
|
||||
if (echo) { WriteOut(MSG_Get("SHELL_CMD_ECHO_ON"));}
|
||||
else { WriteOut(MSG_Get("SHELL_CMD_ECHO_OFF"));}
|
||||
|
@ -230,10 +244,12 @@ void DOS_Shell::CMD_ECHO(char * args){
|
|||
|
||||
|
||||
void DOS_Shell::CMD_EXIT(char * args) {
|
||||
exit=true;
|
||||
HELP("EXIT");
|
||||
exit = true;
|
||||
};
|
||||
|
||||
void DOS_Shell::CMD_CHDIR(char * args) {
|
||||
HELP("CHDIR");
|
||||
StripSpaces(args);
|
||||
if (!*args) {
|
||||
Bit8u drive=DOS_GetDefaultDrive()+'A';
|
||||
|
@ -248,6 +264,7 @@ void DOS_Shell::CMD_CHDIR(char * args) {
|
|||
};
|
||||
|
||||
void DOS_Shell::CMD_MKDIR(char * args) {
|
||||
HELP("MKDIR");
|
||||
StripSpaces(args);
|
||||
char * rem=ScanCMDRemain(args);
|
||||
if (rem) {
|
||||
|
@ -260,6 +277,7 @@ void DOS_Shell::CMD_MKDIR(char * args) {
|
|||
};
|
||||
|
||||
void DOS_Shell::CMD_RMDIR(char * args) {
|
||||
HELP("RMDIR");
|
||||
StripSpaces(args);
|
||||
char * rem=ScanCMDRemain(args);
|
||||
if (rem) {
|
||||
|
@ -296,6 +314,7 @@ static void FormatNumber(Bitu num,char * buf) {
|
|||
}
|
||||
|
||||
void DOS_Shell::CMD_DIR(char * args) {
|
||||
HELP("DIR");
|
||||
char numformat[16];
|
||||
char path[DOS_PATHLENGTH];
|
||||
|
||||
|
@ -437,6 +456,7 @@ void DOS_Shell::CMD_DIR(char * args) {
|
|||
}
|
||||
|
||||
void DOS_Shell::CMD_COPY(char * args) {
|
||||
HELP("COPY");
|
||||
static char defaulttarget[] = ".";
|
||||
StripSpaces(args);
|
||||
/* Command uses dta so set it to our internal dta */
|
||||
|
@ -550,6 +570,7 @@ void DOS_Shell::CMD_COPY(char * args) {
|
|||
}
|
||||
|
||||
void DOS_Shell::CMD_SET(char * args) {
|
||||
HELP("SET");
|
||||
StripSpaces(args);
|
||||
std::string line;
|
||||
if (!*args) {
|
||||
|
@ -595,6 +616,7 @@ void DOS_Shell::CMD_SET(char * args) {
|
|||
}
|
||||
|
||||
void DOS_Shell::CMD_IF(char * args) {
|
||||
HELP("IF");
|
||||
StripSpaces(args);
|
||||
bool has_not=false;
|
||||
char * comp=strchr(args,'=');
|
||||
|
@ -659,6 +681,7 @@ void DOS_Shell::CMD_IF(char * args) {
|
|||
}
|
||||
|
||||
void DOS_Shell::CMD_GOTO(char * args) {
|
||||
HELP("GOTO");
|
||||
StripSpaces(args);
|
||||
if (!bf) return;
|
||||
if (*args &&(*args==':')) args++;
|
||||
|
@ -672,11 +695,13 @@ void DOS_Shell::CMD_GOTO(char * args) {
|
|||
}
|
||||
}
|
||||
|
||||
void DOS_Shell::CMD_SHIFT(char * /*args*/ ) {
|
||||
void DOS_Shell::CMD_SHIFT(char * args ) {
|
||||
HELP("SHIFT");
|
||||
if(bf) bf->Shift();
|
||||
}
|
||||
|
||||
void DOS_Shell::CMD_TYPE(char * args) {
|
||||
HELP("TYPE");
|
||||
StripSpaces(args);
|
||||
if (!*args) {
|
||||
WriteOut(MSG_Get("SHELL_SYNTAXERROR"));
|
||||
|
@ -701,15 +726,18 @@ nextfile:
|
|||
}
|
||||
|
||||
void DOS_Shell::CMD_REM(char * args) {
|
||||
HELP("REM");
|
||||
}
|
||||
|
||||
void DOS_Shell::CMD_PAUSE(char * args){
|
||||
HELP("PAUSE");
|
||||
WriteOut(MSG_Get("SHELL_CMD_PAUSE"));
|
||||
Bit8u c;Bit16u n=1;
|
||||
DOS_ReadFile (STDIN,&c,&n);
|
||||
}
|
||||
|
||||
void DOS_Shell::CMD_CALL(char * args){
|
||||
HELP("CALL");
|
||||
this->call=true; /* else the old batchfile will be closed first */
|
||||
this->ParseLine(args);
|
||||
this->call=false;
|
||||
|
@ -719,6 +747,7 @@ void DOS_Shell::CMD_SUBST (char * args) {
|
|||
/* If more that one type can be substed think of something else
|
||||
* E.g. make basedir member dos_drive instead of localdrive
|
||||
*/
|
||||
HELP("SUBST");
|
||||
localDrive* ldp=0;
|
||||
char mountstring[DOS_PATHLENGTH+CROSS_LEN+20];
|
||||
char temp_str[2] = { 0,0 };
|
||||
|
@ -771,6 +800,7 @@ void DOS_Shell::CMD_SUBST (char * args) {
|
|||
}
|
||||
|
||||
void DOS_Shell::CMD_LOADHIGH(char *args){
|
||||
HELP("LOADHIGH");
|
||||
Bit16u umb_start=dos_infoblock.GetStartOfUMBChain();
|
||||
Bit8u umb_flag=dos_infoblock.GetUMBChainState();
|
||||
Bit8u old_memstrat=DOS_GetMemAllocStrategy()&0xff;
|
||||
|
@ -785,6 +815,7 @@ void DOS_Shell::CMD_LOADHIGH(char *args){
|
|||
}
|
||||
|
||||
void DOS_Shell::CMD_CHOICE(char * args){
|
||||
HELP("CHOICE");
|
||||
static char defchoice[3] = {'y','n',0};
|
||||
char *rem = NULL, *ptr;
|
||||
bool optN = ScanCMDBool(args,"N");
|
||||
|
@ -837,10 +868,12 @@ void DOS_Shell::CMD_CHOICE(char * args){
|
|||
}
|
||||
|
||||
void DOS_Shell::CMD_ATTRIB(char *args){
|
||||
HELP("ATTRIB");
|
||||
// No-Op for now.
|
||||
}
|
||||
|
||||
void DOS_Shell::CMD_PATH(char *args){
|
||||
HELP("PATH");
|
||||
if(args && *args && strlen(args)){
|
||||
char pathstring[DOS_PATHLENGTH+CROSS_LEN+20]={ 0 };
|
||||
strcpy(pathstring,"set PATH=");
|
||||
|
@ -860,6 +893,7 @@ void DOS_Shell::CMD_PATH(char *args){
|
|||
}
|
||||
|
||||
void DOS_Shell::CMD_VER(char *args) {
|
||||
HELP("VER");
|
||||
if(args && *args) {
|
||||
char* word = StripWord(args);
|
||||
if(strcasecmp(word,"set")) return;
|
||||
|
|
Loading…
Add table
Reference in a new issue