show default & set default command added
Hello, I fixed the show/set default commands and tested on the following host platform: OSX(x64), Linux(arm), FreeBSD(x86), Windows(x64), OpenVMS(VAX). The commands are very simple and the code is the same for all the *nix and VMS, and it is a little different for Windows. Andrea
This commit is contained in:
parent
0f2ed31b33
commit
715bc12d3b
1 changed files with 43 additions and 0 deletions
43
scp.c
43
scp.c
|
@ -219,6 +219,11 @@
|
|||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#if defined(_WIN32)
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if defined(HAVE_DLOPEN) /* Dynamic Readline support */
|
||||
|
@ -328,6 +333,7 @@ t_stat set_dev_enbdis (DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr);
|
|||
t_stat set_dev_debug (DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr);
|
||||
t_stat set_unit_enbdis (DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr);
|
||||
t_stat ssh_break (FILE *st, char *cptr, int32 flg);
|
||||
t_stat set_default_cmd (int32 flg, char *cptr);
|
||||
t_stat show_cmd_fi (FILE *ofile, int32 flag, char *cptr);
|
||||
t_stat show_config (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr);
|
||||
t_stat show_queue (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr);
|
||||
|
@ -341,6 +347,7 @@ t_stat show_dev_logicals (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *
|
|||
t_stat show_dev_modifiers (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr);
|
||||
t_stat show_dev_show_commands (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr);
|
||||
t_stat show_version (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr);
|
||||
t_stat show_default (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr);
|
||||
t_stat show_break (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr);
|
||||
t_stat show_on (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr);
|
||||
t_stat show_device (FILE *st, DEVICE *dptr, int32 flag);
|
||||
|
@ -638,6 +645,7 @@ static CTAB cmd_table[] = {
|
|||
" enable console debugging to the\n"
|
||||
" specified destination {LOG,STDOUT or filename)\n"
|
||||
"set console NODEBUG disable console debugging\n"
|
||||
"set default <dir> set the default directory\n"
|
||||
"set log log_file specify the log destination\n"
|
||||
" (STDOUT,DEBUG or filename)\n"
|
||||
"set nolog disables any currently active logging\n"
|
||||
|
@ -687,6 +695,7 @@ static CTAB cmd_table[] = {
|
|||
"sh{ow} th{rottle} show simulation rate\n"
|
||||
"sh{ow} a{synch} show asynchronouse I/O state\n"
|
||||
"sh{ow} ve{rsion} show simulator version\n"
|
||||
"sh{ow} def{ault} show current directory\n"
|
||||
"sh{ow} <dev> RADIX show device display radix\n"
|
||||
"sh{ow} <dev> DEBUG show device debug flags\n"
|
||||
"sh{ow} <dev> MODIFIERS show device modifiers\n"
|
||||
|
@ -1755,6 +1764,7 @@ C1TAB *ctbr, *glbr;
|
|||
static CTAB set_glob_tab[] = {
|
||||
{ "CONSOLE", &sim_set_console, 0 },
|
||||
{ "BREAK", &brk_cmd, SSH_ST },
|
||||
{ "DEFAULT", &set_default_cmd, 1 },
|
||||
{ "NOBREAK", &brk_cmd, SSH_CL },
|
||||
{ "TELNET", &sim_set_telnet, 0 }, /* deprecated */
|
||||
{ "NOTELNET", &sim_set_notelnet, 0 }, /* deprecated */
|
||||
|
@ -2034,6 +2044,7 @@ static SHTAB show_glob_tab[] = {
|
|||
{ "NAMES", &show_log_names, 0 },
|
||||
{ "SHOW", &show_show_commands, 0 },
|
||||
{ "VERSION", &show_version, 1 },
|
||||
{ "DEFAULT", &show_default, 0 },
|
||||
{ "CONSOLE", &sim_show_console, 0 },
|
||||
{ "BREAK", &show_break, 0 },
|
||||
{ "LOG", &sim_show_log, 0 }, /* deprecated */
|
||||
|
@ -2540,6 +2551,38 @@ if (dptr->modifiers) {
|
|||
return SCPE_OK;
|
||||
}
|
||||
|
||||
/* Show/change the current working directiory commands */
|
||||
|
||||
t_stat show_default (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
char *wd = _getcwd(NULL, 0);
|
||||
fprintf (st, "%s\n", wd);
|
||||
free(wd);
|
||||
#else
|
||||
char buffer[PATH_MAX];
|
||||
char *wd = getcwd(buffer, PATH_MAX);
|
||||
fprintf (st, "%s\n", wd);
|
||||
#endif
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
t_stat set_default_cmd (int32 flg, char *cptr)
|
||||
{
|
||||
if ((!cptr) || (*cptr == 0))
|
||||
return SCPE_2FARG;
|
||||
sim_trim_endspc(cptr);
|
||||
#if defined(_WIN32)
|
||||
if (_chdir(cptr) != 0) {
|
||||
#else
|
||||
if (chdir(cptr) != 0) {
|
||||
#endif
|
||||
printf("Unable to change to: %s\n", cptr);
|
||||
return SCPE_IOERR & SCPE_NOMESSAGE;
|
||||
}
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
/* Breakpoint commands */
|
||||
|
||||
t_stat brk_cmd (int32 flg, char *cptr)
|
||||
|
|
Loading…
Add table
Reference in a new issue