diff --git a/scp.c b/scp.c index c8dc1c14..77e1a85c 100644 --- a/scp.c +++ b/scp.c @@ -970,6 +970,9 @@ static const char simh_help[] = "+set log log_file specify the log destination\n" "++++++++ (STDOUT,DEBUG or filename)\n" "+set nolog disables any currently active logging\n" + "4Switches\n" + " By default, log output is written at the end of the specified log file.\n" + " A new log file can created if the -N switch is used on the command line.\n" #define HLP_SET_DEBUG "*Commands SET Debug" /***************** 80 character line width template *************************/ "3Debug\n" @@ -994,6 +997,9 @@ static const char simh_help[] = "5-P\n" " The -P switch adds the output of the PC (Program Counter) to each debug\n" " message.\n" + "5-N\n" + " The -N switch causes a new/empty file to be written to. The default\n" + " is to append to an existing debug log file.\n" #define HLP_SET_BREAK "*Commands SET Breakpoints" "3Breakpoints\n" "+set break set breakpoints\n" diff --git a/sim_console.c b/sim_console.c index b665cb3a..05fb42a8 100644 --- a/sim_console.c +++ b/sim_console.c @@ -1612,7 +1612,10 @@ else { return SCPE_MEM; get_glyph_nc (filename, gbuf, 0); /* reparse */ strncpy ((*pref)->name, gbuf, sizeof((*pref)->name)-1); - *pf = sim_fopen (gbuf, (binary ? "a+b" : "a+")); /* open file */ + if (sim_switches & SWMASK ('N')) /* if a new log file is requested */ + *pf = sim_fopen (gbuf, (binary ? "w+b" : "w+"));/* then open an empty file */ + else /* otherwise */ + *pf = sim_fopen (gbuf, (binary ? "a+b" : "a+"));/* append to an existing file */ if (*pf == NULL) { /* error? */ free (*pref); *pref = NULL;