SCP: Add DEL/RM command to facilitate portable command files
This commit is contained in:
parent
8882cebe27
commit
7a1b35ae12
2 changed files with 23 additions and 0 deletions
22
scp.c
22
scp.c
|
@ -1023,6 +1023,12 @@ static const char simh_help[] =
|
||||||
#define HLP_CAT "*Commands Displaying_Files CAT"
|
#define HLP_CAT "*Commands Displaying_Files CAT"
|
||||||
"3CAT\n"
|
"3CAT\n"
|
||||||
"++CAT {file} display a file contents\n"
|
"++CAT {file} display a file contents\n"
|
||||||
|
#define HLP_DEL "*Commands Displaying_Files CAT"
|
||||||
|
"3DEL\n"
|
||||||
|
"++DEL {file} deletes a file\n"
|
||||||
|
#define HLP_RM "*Commands Displaying_Files CAT"
|
||||||
|
"3RM\n"
|
||||||
|
"++RM {file} deletes a file\n"
|
||||||
#define HLP_SET "*Commands SET"
|
#define HLP_SET "*Commands SET"
|
||||||
"2SET\n"
|
"2SET\n"
|
||||||
/***************** 80 character line width template *************************/
|
/***************** 80 character line width template *************************/
|
||||||
|
@ -1821,6 +1827,8 @@ static CTAB cmd_table[] = {
|
||||||
{ "LS", &dir_cmd, 0, HLP_LS },
|
{ "LS", &dir_cmd, 0, HLP_LS },
|
||||||
{ "TYPE", &type_cmd, 0, HLP_TYPE },
|
{ "TYPE", &type_cmd, 0, HLP_TYPE },
|
||||||
{ "CAT", &type_cmd, 0, HLP_CAT },
|
{ "CAT", &type_cmd, 0, HLP_CAT },
|
||||||
|
{ "DEL", &delete_cmd, 0, HLP_DEL },
|
||||||
|
{ "RM", &delete_cmd, 0, HLP_RM },
|
||||||
{ "SET", &set_cmd, 0, HLP_SET },
|
{ "SET", &set_cmd, 0, HLP_SET },
|
||||||
{ "SHOW", &show_cmd, 0, HLP_SHOW },
|
{ "SHOW", &show_cmd, 0, HLP_SHOW },
|
||||||
{ "DO", &do_cmd, 1, HLP_DO },
|
{ "DO", &do_cmd, 1, HLP_DO },
|
||||||
|
@ -5215,6 +5223,20 @@ fclose (file);
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t_stat delete_cmd (int32 flg, CONST char *cptr)
|
||||||
|
{
|
||||||
|
char lbuf[4*CBUFSIZE];
|
||||||
|
|
||||||
|
if ((!cptr) || (*cptr == 0))
|
||||||
|
return SCPE_2FARG;
|
||||||
|
lbuf[sizeof(lbuf)-1] = '\0';
|
||||||
|
strncpy (lbuf, cptr, sizeof(lbuf)-1);
|
||||||
|
sim_trim_endspc(lbuf);
|
||||||
|
if (!remove (lbuf))
|
||||||
|
return SCPE_OK;
|
||||||
|
return sim_messagef (SCPE_ARG, "%s\n", strerror (errno));
|
||||||
|
}
|
||||||
|
|
||||||
/* Breakpoint commands */
|
/* Breakpoint commands */
|
||||||
|
|
||||||
t_stat brk_cmd (int32 flg, CONST char *cptr)
|
t_stat brk_cmd (int32 flg, CONST char *cptr)
|
||||||
|
|
1
scp.h
1
scp.h
|
@ -90,6 +90,7 @@ t_stat set_default_cmd (int32 flg, CONST char *cptr);
|
||||||
t_stat pwd_cmd (int32 flg, CONST char *cptr);
|
t_stat pwd_cmd (int32 flg, CONST char *cptr);
|
||||||
t_stat dir_cmd (int32 flg, CONST char *cptr);
|
t_stat dir_cmd (int32 flg, CONST char *cptr);
|
||||||
t_stat type_cmd (int32 flg, CONST char *cptr);
|
t_stat type_cmd (int32 flg, CONST char *cptr);
|
||||||
|
t_stat delete_cmd (int32 flg, CONST char *cptr);
|
||||||
t_stat brk_cmd (int32 flag, CONST char *ptr);
|
t_stat brk_cmd (int32 flag, CONST char *ptr);
|
||||||
t_stat do_cmd (int32 flag, CONST char *ptr);
|
t_stat do_cmd (int32 flag, CONST char *ptr);
|
||||||
t_stat goto_cmd (int32 flag, CONST char *ptr);
|
t_stat goto_cmd (int32 flag, CONST char *ptr);
|
||||||
|
|
Loading…
Add table
Reference in a new issue