diff --git a/src/gui.c b/src/gui.c index c53a02d..9c34910 100644 --- a/src/gui.c +++ b/src/gui.c @@ -169,8 +169,6 @@ const char* end_wipe_footer = "B=[Toggle between dark\\blank\\blue screen] Ctrl+ const char* rounds_footer = "Left=Erase Esc=Cancel Ctrl+C=Quit"; const char* selection_footer_text_entry = "Esc=Cancel Return=Submit Ctrl+C=Quit"; -const char* wipes_finished_footer = "Wipe finished - press enter to exit. Logged to STDOUT"; - /* The number of lines available in the terminal */ int stdscr_lines; @@ -6067,6 +6065,53 @@ void* nwipe_gui_status( void* ptr ) /* Spinner character */ char spinner_string[2]; + /* Create the finish message, this changes based on whether PDF creation is enabled + * and whether a logfile has been specified + */ + char finish_message[NWIPE_GUI_FOOTER_W + 132]; + if( nwipe_options.logfile[0] == 0 && nwipe_options.PDF_enable != 0 ) + { + snprintf( finish_message, + sizeof( finish_message ), + "Wipe finished - press enter to create pdfs & exit. Logged to STDOUT" ); + } + else + { + if( nwipe_options.logfile[0] != 0 && nwipe_options.PDF_enable != 0 ) + { + snprintf( finish_message, + sizeof( finish_message ), + "Wipe finished - press enter to create pdfs & exit. Logged to %s", + nwipe_options.logfile ); + } + else + { + if( nwipe_options.logfile[0] != 0 && nwipe_options.PDF_enable == 0 ) + { + snprintf( finish_message, + sizeof( finish_message ), + "Wipe finished - press enter to exit (pdfs disabled in config). Logged to %s", + nwipe_options.logfile ); + } + else + { + if( nwipe_options.logfile[0] == 0 && nwipe_options.PDF_enable == 0 ) + { + snprintf( finish_message, + sizeof( finish_message ), + "Wipe finished - press enter to exit (pdfs disabled in config). Logged to STDOUT" ); + } + else + { + /* This is a catch all something unexpected happens with the above logic */ + snprintf( finish_message, + sizeof( finish_message ), + "Wipe finished - press enter to exit. Logged to STDOUT" ); + } + } + } + } + /* We count time from when this function is first called. */ static time_t nwipe_time_start = 0; @@ -6224,7 +6269,7 @@ void* nwipe_gui_status( void* ptr ) else { /* and if the wipes have finished a different footer is required */ - nwipe_gui_create_all_windows_on_terminal_resize( 0, wipes_finished_footer ); + nwipe_gui_create_all_windows_on_terminal_resize( 0, finish_message ); } } @@ -6242,7 +6287,7 @@ void* nwipe_gui_status( void* ptr ) if( nwipe_active == 0 || terminate_signal == 1 ) { - nwipe_gui_title( footer_window, wipes_finished_footer ); + nwipe_gui_title( footer_window, finish_message ); // Refresh the footer_window ; wnoutrefresh( footer_window ); @@ -6625,19 +6670,7 @@ void* nwipe_gui_status( void* ptr ) } /* End of while loop */ - if( nwipe_options.logfile[0] == '\0' ) - { - nwipe_gui_title( footer_window, wipes_finished_footer ); - } - else - { - char finish_message[NWIPE_GUI_FOOTER_W]; - snprintf( finish_message, - sizeof( finish_message ), - "Wipe finished - press enter to exit. Logged to %s", - nwipe_options.logfile ); - nwipe_gui_title( footer_window, finish_message ); - } + nwipe_gui_title( footer_window, finish_message ); terminate_signal = 1; return NULL; diff --git a/src/logging.c b/src/logging.c index cb01e98..ca103ef 100644 --- a/src/logging.c +++ b/src/logging.c @@ -892,7 +892,8 @@ void nwipe_log_summary( nwipe_context_t** ptr, int nwipe_selected ) serial_no ); /* Create the PDF report/certificate */ - if( strcmp( nwipe_options.PDFreportpath, "noPDF" ) != 0 ) + if( nwipe_options.PDF_enable == 1 ) + // if( strcmp( nwipe_options.PDFreportpath, "noPDF" ) != 0 ) { /* to have some progress indication. can help if there are many/slow disks */ fprintf( stderr, "." ); diff --git a/src/options.c b/src/options.c index d145c9c..95050db 100644 --- a/src/options.c +++ b/src/options.c @@ -398,6 +398,23 @@ int nwipe_options_parse( int argc, char** argv ) nwipe_options.PDFreportpath[strlen( optarg )] = '\0'; strncpy( nwipe_options.PDFreportpath, optarg, sizeof( nwipe_options.PDFreportpath ) ); + + /* Command line options will override what's in nwipe.conf */ + if( strcmp( nwipe_options.PDFreportpath, "noPDF" ) == 0 ) + { + nwipe_options.PDF_enable = 0; + nwipe_conf_update_setting( "PDF_Certificate.PDF_Enable", "DISABLED" ); + } + else + { + if( strcmp( nwipe_options.PDFreportpath, "." ) ) + { + /* and if the user has specified a PDF path then enable PDF */ + nwipe_options.PDF_enable = 1; + nwipe_conf_update_setting( "PDF_Certificate.PDF_Enable", "ENABLED" ); + } + } + break; case 'e': /* exclude drives option */ diff --git a/src/version.c b/src/version.c index 4bd301b..48b3369 100644 --- a/src/version.c +++ b/src/version.c @@ -4,7 +4,7 @@ * used by configure to dynamically assign those values * to documentation files. */ -const char* version_string = "0.35.4"; +const char* version_string = "0.35.5"; const char* program_name = "nwipe"; const char* author_name = "Martijn van Brummelen"; const char* email_address = "git@brumit.nl"; @@ -14,4 +14,4 @@ Modifications to original dwipe Copyright Andy Beverley \n\ This is free software; see the source for copying conditions.\n\ There is NO warranty; not even for MERCHANTABILITY or FITNESS\n\ FOR A PARTICULAR PURPOSE.\n"; -const char* banner = "nwipe 0.35.4"; +const char* banner = "nwipe 0.35.5";