1
0
Fork 0

added delete

removed a strange include


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@581
This commit is contained in:
Peter Veenstra 2002-12-17 18:31:08 +00:00
parent 22f9949b9d
commit a8cacc5c63
4 changed files with 24 additions and 5 deletions

View file

@ -186,7 +186,8 @@ void SHELL_Init() {
MSG_Add("SHELL_ILLEGAL_SWITCH","Illegal switch: %s\n");
MSG_Add("SHELL_CMD_CHDIR_ERROR","Unable to change to: %s\n");
MSG_Add("SHELL_CMD_MKDIR_ERROR","Unable to make: %s\n");
MSG_Add("SHELL_CMD_RMDIR_ERROR","Unable to remove: %\n");
MSG_Add("SHELL_CMD_RMDIR_ERROR","Unable to remove: %s\n");
MSG_Add("SHELL_CMD_DEL_ERROR","Unable to delete: %s\n");
MSG_Add("SHELL_SYNTAXERROR","The syntax of the command is incorrect.\n");
MSG_Add("SHELL_CMD_SET_NOT_SET","Environment variable %s not defined\n");
MSG_Add("SHELL_CMD_SET_OUT_OF_SPACE","Not enough environment space left.\n");
@ -217,8 +218,9 @@ void SHELL_Init() {
MSG_Add("SHELL_CMD_GOTO_HELP","Jump to a labeled line 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_RENAME_WILD","This is a simple Rename, no wildcards allowed!\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");
/* Regular startup */
call_shellstop=CALLBACK_Allocate();
/* Setup the startup CS:IP to kill the last running machine when exitted */

View file

@ -20,7 +20,6 @@
#include <string.h>
#include "shell_inc.h"
#include "cpu.h"
BatchFile::BatchFile(DOS_Shell * host,char * name, char * cmd_line) {

View file

@ -28,6 +28,8 @@ static SHELL_Cmd cmd_list[]={
"CLS", 0, &DOS_Shell::CMD_CLS, "SHELL_CMD_CLS_HELP",
// "COPY", 0, &DOS_Shell::CMD_COPY, "Copy Files.",
"DIR", 0, &DOS_Shell::CMD_DIR, "SHELL_CMD_DIR_HELP",
"DEL", 1, &DOS_Shell::CMD_DELETE, "SHELL_CMD_DELETE_HELP",
"DELETE", 0, &DOS_Shell::CMD_DELETE, "SHELL_CMD_DELETE_HELP",
"ECHO", 0, &DOS_Shell::CMD_ECHO, "SHELL_CMD_ECHO_HELP",
"EXIT", 0, &DOS_Shell::CMD_EXIT, "SHELL_CMD_EXIT_HELP",
"HELP", 0, &DOS_Shell::CMD_HELP, "SHELL_CMD_HELP_HELP",
@ -39,7 +41,7 @@ static SHELL_Cmd cmd_list[]={
"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",
"REN", 0, &DOS_Shell::CMD_RENAME, "SHELL_CMD_RENAME_HELP",
"REN", 1, &DOS_Shell::CMD_RENAME, "SHELL_CMD_RENAME_HELP",
/*
"CHDIR", 0, &DOS_Shell::CMD_CHDIR, "Change Directory",
"MKDIR", 0, &DOS_Shell::CMD_MKDIR, "Make Directory",
@ -57,6 +59,7 @@ void DOS_Shell::DoCommand(char * line) {
if (*line==32) break;
if (*line=='/') break;
if ((*line=='.') && (*(line+1)=='.')) break;
// if ((*line=='.') && (*(line+1)==0)) break;
*cmd_write++=*line++;
}
*cmd_write=0;
@ -81,6 +84,20 @@ void DOS_Shell::CMD_CLS(char * args) {
CALLBACK_RunRealInt(0x10);
};
void DOS_Shell::CMD_DELETE(char * args) {
char * rem=ScanCMDRemain(args);
if (rem) {
WriteOut(MSG_Get("SHELL_ILLEGAL_SWITCH"),rem);
return;
}
if((strchr(args,'*')!=NULL) || (strchr(args,'?')!=NULL) ) { WriteOut(MSG_Get("SHELL_CMD_NO_WILD"));return;}
if (!DOS_UnlinkFile(args)) {
WriteOut(MSG_Get("SHELL_CMD_DEL_ERROR"),args);
}
};
void DOS_Shell::CMD_HELP(char * args){
/* Print the help */
WriteOut(MSG_Get("SHELL_CMD_HELP"));
@ -94,7 +111,7 @@ void DOS_Shell::CMD_HELP(char * args){
void DOS_Shell::CMD_RENAME(char * args){
if(!*args) {SyntaxError();return;}
if((strchr(args,'*')!=NULL) || (strchr(args,'?')!=NULL) ) { WriteOut(MSG_Get("SHELL_CMD_RENAME_WILD"));}
if((strchr(args,'*')!=NULL) || (strchr(args,'?')!=NULL) ) { WriteOut(MSG_Get("SHELL_CMD_NO_WILD"));return;}
char * arg2 =StripWord(args);
DOS_Rename(args,arg2);
}

View file

@ -66,6 +66,7 @@ public:
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);