[1] | 1 | /* newt-specific.c
|
---|
[99] | 2 | $Id: newt-specific.c 3377 2015-05-06 11:10:17Z bruno $
|
---|
[1] | 3 |
|
---|
| 4 | subroutines which do display-type things
|
---|
| 5 | and use the newt library to do them
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 |
|
---|
| 9 | /**
|
---|
| 10 | * @file
|
---|
| 11 | * Functions for doing display-type things with the Newt library.
|
---|
| 12 | */
|
---|
| 13 |
|
---|
| 14 | #define MAX_NEWT_COMMENT_LEN 200
|
---|
| 15 |
|
---|
| 16 | #if __cplusplus
|
---|
| 17 | extern "C" {
|
---|
| 18 | #endif
|
---|
| 19 |
|
---|
| 20 | #include "my-stuff.h"
|
---|
[2211] | 21 | #include "mr_mem.h"
|
---|
[3194] | 22 | #include "mr_str.h"
|
---|
[1] | 23 | #include "mondostructures.h"
|
---|
| 24 | #include "newt-specific.h"
|
---|
| 25 | #include "libmondo-string-EXT.h"
|
---|
| 26 | #include "libmondo-files-EXT.h"
|
---|
| 27 | #include "libmondo-devices-EXT.h"
|
---|
| 28 | #include "libmondo-tools-EXT.h"
|
---|
| 29 | #include "libmondo-fork-EXT.h"
|
---|
[541] | 30 | #include "libmondo-gui-EXT.h"
|
---|
| 31 | #include "lib-common-externs.h"
|
---|
[1] | 32 |
|
---|
[1316] | 33 | extern char *MONDO_LOGFILE;
|
---|
| 34 |
|
---|
[1665] | 35 | extern struct s_bkpinfo *bkpinfo;
|
---|
| 36 |
|
---|
[1] | 37 | /*@unused@*/
|
---|
[99] | 38 | //static char cvsid[] = "$Id: newt-specific.c 3377 2015-05-06 11:10:17Z bruno $";
|
---|
[1] | 39 |
|
---|
[128] | 40 | extern pid_t g_mastermind_pid;
|
---|
[2030] | 41 | /*
|
---|
[128] | 42 | extern char *g_tmpfs_mountpt;
|
---|
[2030] | 43 | */
|
---|
[128] | 44 | extern char *g_boot_mountpt;
|
---|
[792] | 45 | extern char *ps_options;
|
---|
[928] | 46 | extern char *ps_proc_id;
|
---|
[1] | 47 |
|
---|
[128] | 48 | extern void set_signals(int);
|
---|
[1] | 49 |
|
---|
| 50 | /**
|
---|
| 51 | * @addtogroup globalGroup
|
---|
| 52 | * @{
|
---|
| 53 | */
|
---|
| 54 | /**
|
---|
| 55 | * Whether we are currently in a nested call of fatal_error().
|
---|
| 56 | */
|
---|
[128] | 57 | bool g_exiting = FALSE;
|
---|
[1] | 58 |
|
---|
[3141] | 59 | // Decide whether we should continue to ask questions or exit (cron use case)
|
---|
| 60 | extern bool g_fail_immediately;
|
---|
| 61 |
|
---|
[1] | 62 | /**
|
---|
| 63 | * Padding below the Newt components, to overcome bugs in Newt.
|
---|
| 64 | */
|
---|
[128] | 65 | char g_haharrrrr[500];
|
---|
[1] | 66 |
|
---|
| 67 |
|
---|
[128] | 68 | newtComponent g_timeline = NULL, ///< The line of the progress form that shows the time elapsed/remaining
|
---|
| 69 | g_percentline = NULL, ///< The line of the progress form that shows the percent completed/remaining
|
---|
| 70 | g_scale = NULL, ///< The progress bar component in the progress form
|
---|
| 71 | g_progressForm = NULL, ///< The progress form component itself
|
---|
| 72 | g_blurb1 = NULL, ///< The component for line 1 of the blurb in the progress form
|
---|
| 73 | g_blurb2 = NULL, ///< The component for line 2 of the blurb in the progress form
|
---|
| 74 | g_blurb3 = NULL, ///< The component for line 3 (updated continuously) of the blurb in the progress form
|
---|
| 75 | g_label = NULL; ///< ????? @bug ?????
|
---|
[1] | 76 |
|
---|
| 77 | /**
|
---|
| 78 | * Padding above the Newt components, to overcome bugs in Newt.
|
---|
| 79 | */
|
---|
[128] | 80 | char g_jim_lad_yarr[500];
|
---|
| 81 | char **err_log_lines = NULL, ///< The list of log lines to show on the screen.
|
---|
| 82 | g_blurb_str_1[MAX_NEWT_COMMENT_LEN] = "", ///< The string for line 1 of the blurb in the progress form
|
---|
| 83 | g_blurb_str_2[MAX_NEWT_COMMENT_LEN] = "", ///< The string for line 2 of the blurb in the progress form
|
---|
| 84 | g_blurb_str_3[MAX_NEWT_COMMENT_LEN] = ""; ///< The string for line 3 (updated continuously) of the blurb in the progress form
|
---|
| 85 | newtComponent g_isoform_main = NULL, ///< The evalcall form component itself
|
---|
| 86 | g_isoform_header = NULL, ///< The component for the evalcall form title
|
---|
| 87 | g_isoform_scale = NULL, ///< The progress bar component in the evalcall form
|
---|
| 88 | g_isoform_timeline = NULL, ///< The line of the evalcall form that shows the time elapsed/remaining
|
---|
| 89 | g_isoform_pcline = NULL; ///< The line of the evalcall form that shows the percent completed/remaining
|
---|
| 90 | long g_isoform_starttime; ///< The time (in seconds since the epoch) that the evalcall form was opened.
|
---|
| 91 | int g_isoform_old_progress = -1; ///< The most recent progress update of the evalcall form (percent).
|
---|
| 92 | char g_isoform_header_str[MAX_STR_LEN] = " "; ///< The string for the evalcall form title.
|
---|
| 93 | int g_mysterious_dot_counter; ///< The counter for the twirling baton (/ | \\ - ...) on percentage less than 3
|
---|
| 94 | int g_noof_log_lines = 6; ///< The number of lines to show in the log at the bottom of the screen.
|
---|
| 95 | int g_noof_rows = 25; ///< The number of rows on the screen.
|
---|
[1] | 96 |
|
---|
[128] | 97 | int g_currentY = 3; ///< The row to write background progress messages to. Incremented each time a message is written.
|
---|
| 98 | extern int g_current_media_number;
|
---|
| 99 | pid_t g_main_pid = 0; ///< The PID of the main Mondo process.
|
---|
[3191] | 100 | long g_maximum_progress = 999L; ///< The maximum amount of progress (100%) for the currently opened progress form.
|
---|
[128] | 101 | long g_current_progress = -999; ///< The current amount of progress (filelist #, etc.) for the currently opened progress form.
|
---|
[3191] | 102 | long g_start_time = 0L; ///< The time (in seconds since the epoch) that the progress form was opened.
|
---|
[128] | 103 | bool g_text_mode = TRUE; ///< If FALSE, use a newt interface; if TRUE, use an ugly (but more compatible) dumb terminal interface.
|
---|
[2380] | 104 | char *g_selfmounted_isodir; ///< Holds the NETFS mountpoint if mounted via mondoarchive.
|
---|
[1] | 105 |
|
---|
| 106 | /* @} - end of globalGroup */
|
---|
| 107 |
|
---|
[128] | 108 | void popup_and_OK(char *);
|
---|
[1] | 109 |
|
---|
| 110 |
|
---|
| 111 | /**
|
---|
| 112 | * @addtogroup guiGroup
|
---|
| 113 | * @{
|
---|
| 114 | */
|
---|
| 115 | /**
|
---|
| 116 | * Ask the user a yes/no question.
|
---|
| 117 | * @param prompt The question to ask the user.
|
---|
| 118 | * @return TRUE for yes; FALSE for no.
|
---|
| 119 | */
|
---|
[128] | 120 | bool ask_me_yes_or_no(char *prompt) {
|
---|
[1] | 121 |
|
---|
[128] | 122 | /*@ buffers ********************************************************** */
|
---|
[3191] | 123 | int i = 0;
|
---|
| 124 | char *tmp = NULL;
|
---|
[1] | 125 |
|
---|
[3141] | 126 | assert_string_is_neither_NULL_nor_zerolength(prompt);
|
---|
[1] | 127 |
|
---|
[3141] | 128 | if (g_fail_immediately) {
|
---|
| 129 | // We consider the user aborted by using the -F option
|
---|
| 130 | log_msg(3, "Exiting at first interaction request due to -F");
|
---|
| 131 | finish(1);
|
---|
| 132 | }
|
---|
[128] | 133 | if (g_text_mode) {
|
---|
| 134 | while (1) {
|
---|
[3191] | 135 | sync();
|
---|
| 136 | printf("---promptdialogYN---1--- %s\n---promptdialogYN---Q--- [yes] [no] ---\n--> ", prompt);
|
---|
| 137 | mr_getline(tmp, stdin);
|
---|
[128] | 138 | if (tmp[strlen(tmp) - 1] == '\n')
|
---|
| 139 | tmp[strlen(tmp) - 1] = '\0';
|
---|
[1] | 140 |
|
---|
[128] | 141 | i = (int) strlen(tmp);
|
---|
| 142 | if (i > 0 && tmp[i - 1] < 32) {
|
---|
| 143 | tmp[i - 1] = '\0';
|
---|
| 144 | }
|
---|
[541] | 145 | if (strstr("yesYES", tmp)) {
|
---|
[3191] | 146 | mr_free(tmp);
|
---|
[128] | 147 | return (TRUE);
|
---|
[541] | 148 | } else if (strstr("NOno", tmp)) {
|
---|
[3191] | 149 | mr_free(tmp);
|
---|
[128] | 150 | return (FALSE);
|
---|
| 151 | } else {
|
---|
[3191] | 152 | sync();
|
---|
| 153 | printf("Please enter either YES or NO (or yes or no, or y or n, or...)\n");
|
---|
[128] | 154 | }
|
---|
| 155 | }
|
---|
| 156 | } else {
|
---|
[541] | 157 | return (popup_with_buttons(prompt, "Yes", "No"));
|
---|
[128] | 158 | }
|
---|
| 159 | }
|
---|
[1] | 160 |
|
---|
| 161 |
|
---|
| 162 | /**
|
---|
| 163 | * Give the user the opportunity to continue the current operation (OK)
|
---|
| 164 | * or cancel it (Cancel).
|
---|
| 165 | * @param prompt The string to be displayed.
|
---|
| 166 | * @return TRUE for OK, FALSE for Cancel.
|
---|
| 167 | */
|
---|
[128] | 168 | bool ask_me_OK_or_cancel(char *prompt) {
|
---|
[1] | 169 |
|
---|
[128] | 170 | /*@ buffer *********************************************************** */
|
---|
[3191] | 171 | char *tmp = NULL;
|
---|
[128] | 172 | int i;
|
---|
[1] | 173 |
|
---|
[3141] | 174 | assert_string_is_neither_NULL_nor_zerolength(prompt);
|
---|
| 175 | if (g_fail_immediately) {
|
---|
| 176 | // We consider the user aborted by using the -F option
|
---|
| 177 | log_msg(3, "Exiting at first interaction request due to -F");
|
---|
| 178 | finish(1);
|
---|
| 179 | }
|
---|
[3191] | 180 |
|
---|
[128] | 181 | if (g_text_mode) {
|
---|
[3191] | 182 | sync();
|
---|
| 183 | printf("---promptdialogOKC---1--- %s\n---promptdialogOKC---Q--- [OK] [Cancel] ---\n--> ", prompt);
|
---|
| 184 | mr_getline(tmp, stdin);
|
---|
[128] | 185 | if (tmp[strlen(tmp) - 1] == '\n')
|
---|
| 186 | tmp[strlen(tmp) - 1] = '\0';
|
---|
[1] | 187 |
|
---|
[128] | 188 | i = (int) strlen(tmp);
|
---|
| 189 | if (i > 0 && tmp[i - 1] < 32) {
|
---|
| 190 | tmp[i - 1] = '\0';
|
---|
| 191 | }
|
---|
[541] | 192 | if (strstr("okOKOkYESyes", tmp)) {
|
---|
[3191] | 193 | mr_free(tmp);
|
---|
[128] | 194 | return (TRUE);
|
---|
| 195 | } else {
|
---|
[3191] | 196 | mr_free(tmp);
|
---|
[128] | 197 | return (FALSE);
|
---|
| 198 | }
|
---|
| 199 | } else {
|
---|
[541] | 200 | return (popup_with_buttons(prompt, " Okay ", "Cancel"));
|
---|
[128] | 201 | }
|
---|
[1] | 202 | }
|
---|
| 203 |
|
---|
| 204 |
|
---|
| 205 |
|
---|
| 206 | /**
|
---|
| 207 | * Close the currently opened evalcall form.
|
---|
| 208 | */
|
---|
[128] | 209 | void
|
---|
| 210 | close_evalcall_form(void) {
|
---|
| 211 | if (g_text_mode) {
|
---|
| 212 | return;
|
---|
| 213 | }
|
---|
| 214 | if (g_isoform_main == NULL) {
|
---|
| 215 | return;
|
---|
| 216 | }
|
---|
| 217 | update_evalcall_form(100);
|
---|
| 218 | usleep(500000);
|
---|
| 219 | if (g_text_mode) {
|
---|
| 220 | log_msg(2, "Closing evalcall form");
|
---|
| 221 | return;
|
---|
| 222 | }
|
---|
| 223 | newtPopHelpLine();
|
---|
| 224 | newtFormDestroy(g_isoform_main);
|
---|
| 225 | newtPopWindow();
|
---|
[2290] | 226 |
|
---|
| 227 | /* Reset globals */
|
---|
[128] | 228 | g_isoform_main = NULL;
|
---|
| 229 | g_isoform_old_progress = -1;
|
---|
[2290] | 230 | g_isoform_header = NULL;
|
---|
| 231 | g_isoform_scale = NULL;
|
---|
| 232 | g_isoform_timeline = NULL;
|
---|
| 233 | g_isoform_pcline = NULL;
|
---|
| 234 | }
|
---|
[1] | 235 |
|
---|
| 236 | /**
|
---|
| 237 | * Close the currently opened progress form.
|
---|
| 238 | */
|
---|
[128] | 239 | void
|
---|
| 240 | close_progress_form() {
|
---|
| 241 | if (g_text_mode) {
|
---|
| 242 | return;
|
---|
| 243 | }
|
---|
| 244 | if (g_current_progress == -999) {
|
---|
[3191] | 245 | log_msg(2, "Trying to close the progress form when it ain't open!");
|
---|
[128] | 246 | return;
|
---|
| 247 | }
|
---|
| 248 | g_current_progress = g_maximum_progress;
|
---|
| 249 | update_progress_form("Complete");
|
---|
| 250 | sleep(1);
|
---|
| 251 | if (g_text_mode) {
|
---|
| 252 | log_msg(2, "Closing progress form");
|
---|
| 253 | return;
|
---|
| 254 | }
|
---|
| 255 | newtPopHelpLine();
|
---|
| 256 | newtFormDestroy(g_progressForm);
|
---|
| 257 | newtPopWindow();
|
---|
[2290] | 258 |
|
---|
| 259 | /* Reset globals */
|
---|
[128] | 260 | g_progressForm = NULL;
|
---|
| 261 | g_current_progress = -999;
|
---|
[2290] | 262 | g_timeline = NULL;
|
---|
| 263 | g_percentline = NULL;
|
---|
| 264 | g_scale = NULL;
|
---|
| 265 |
|
---|
[128] | 266 | }
|
---|
[1] | 267 |
|
---|
[792] | 268 | /**
|
---|
| 269 | * Kill any process containing the string @p str surrounded by spaces in its commandline.
|
---|
| 270 | */
|
---|
| 271 | void kill_anything_like_this(char *str) {
|
---|
[1] | 272 |
|
---|
[792] | 273 | char *tmp = NULL;
|
---|
[1850] | 274 | char *tmp1 = NULL;
|
---|
[1] | 275 |
|
---|
[3185] | 276 | mr_asprintf(tmp,"ps %s | grep \" %s \" | grep -v \"grep\" | awk '{print %s;}'", ps_options, str , ps_proc_id);
|
---|
[1294] | 277 | run_program_and_log_output(tmp, TRUE);
|
---|
[1850] | 278 | if (strlen(tmp) > 0) {
|
---|
[3185] | 279 | mr_asprintf(tmp1,"kill `%s`", tmp);
|
---|
[1850] | 280 | run_program_and_log_output(tmp1, TRUE);
|
---|
[3191] | 281 | mr_free(tmp1);
|
---|
[1850] | 282 | }
|
---|
[3191] | 283 | mr_free(tmp);
|
---|
[792] | 284 | }
|
---|
[1] | 285 |
|
---|
[792] | 286 |
|
---|
[1] | 287 | /**
|
---|
| 288 | * Exit Mondo with a fatal error.
|
---|
| 289 | * @param error_string The error message to present to the user before exiting.
|
---|
| 290 | * @note This function never returns.
|
---|
| 291 | */
|
---|
[3191] | 292 | void fatal_error(char *error_string) {
|
---|
| 293 |
|
---|
[128] | 294 | /*@ buffers ***************************************************** */
|
---|
[3191] | 295 | char *command = NULL;
|
---|
[128] | 296 | static bool already_exiting = FALSE;
|
---|
[1] | 297 |
|
---|
[128] | 298 | /*@ end vars **************************************************** */
|
---|
[1] | 299 |
|
---|
[128] | 300 | set_signals(FALSE); // link to external func
|
---|
| 301 | g_exiting = TRUE;
|
---|
| 302 | log_msg(1, "Fatal error received - '%s'", error_string);
|
---|
| 303 | printf("Fatal error... %s\n", error_string);
|
---|
| 304 | if (getpid() == g_mastermind_pid) {
|
---|
| 305 | log_msg(2, "mastermind %d is exiting", (int) getpid());
|
---|
| 306 | kill(g_main_pid, SIGTERM);
|
---|
| 307 | finish(1);
|
---|
| 308 | }
|
---|
[1] | 309 |
|
---|
[128] | 310 | if (getpid() != g_main_pid) {
|
---|
| 311 | if (g_mastermind_pid != 0 && getpid() != g_mastermind_pid) {
|
---|
| 312 | log_msg(2, "non-m/m %d is exiting", (int) getpid());
|
---|
| 313 | kill(g_main_pid, SIGTERM);
|
---|
| 314 | finish(1);
|
---|
| 315 | }
|
---|
| 316 | }
|
---|
[1] | 317 |
|
---|
[128] | 318 | log_msg(3, "OK, I think I'm the main PID.");
|
---|
| 319 | if (already_exiting) {
|
---|
| 320 | log_msg(3, "...I'm already exiting. Give me time, Julian!");
|
---|
| 321 | finish(1);
|
---|
| 322 | }
|
---|
[1] | 323 |
|
---|
[128] | 324 | already_exiting = TRUE;
|
---|
| 325 | log_msg(2, "I'm going to do some cleaning up now.");
|
---|
| 326 | paranoid_system("killall mindi 2> /dev/null");
|
---|
| 327 | kill_anything_like_this("/mondo/do-not");
|
---|
[3154] | 328 | kill_anything_like_this("mondo.tmp");
|
---|
[296] | 329 | kill_anything_like_this("ntfsclone");
|
---|
[128] | 330 | sync();
|
---|
[1] | 331 |
|
---|
[3060] | 332 | if (chdir("/")) {
|
---|
| 333 | // FIXME
|
---|
| 334 | }
|
---|
[128] | 335 | if (g_selfmounted_isodir) {
|
---|
[3191] | 336 | mr_asprintf(command, "umount -d %s", g_selfmounted_isodir);
|
---|
[128] | 337 | run_program_and_log_output(command, 5);
|
---|
[3191] | 338 | mr_free(command);
|
---|
| 339 | mr_asprintf(command, "rmdir %s", g_selfmounted_isodir);
|
---|
[128] | 340 | run_program_and_log_output(command, 5);
|
---|
[3191] | 341 | mr_free(command);
|
---|
[128] | 342 | }
|
---|
[99] | 343 |
|
---|
[128] | 344 | if (!g_text_mode) {
|
---|
[3191] | 345 | log_msg(0, "-------FATAL ERROR---------");
|
---|
[128] | 346 | log_msg(0, error_string);
|
---|
| 347 | }
|
---|
[1] | 348 |
|
---|
[128] | 349 | printf("---FATALERROR--- %s\n", error_string);
|
---|
[3191] | 350 | printf("If you require technical support, please contact the mailing list.\n");
|
---|
[541] | 351 | printf("See http://www.mondorescue.org for details.\n");
|
---|
[3191] | 352 | printf("The list's members can help you, if you attach that file to your e-mail.\n");
|
---|
[541] | 353 | printf("Log file: %s\n", MONDO_LOGFILE);
|
---|
| 354 | printf("Mondo has aborted.\n");
|
---|
[128] | 355 | if (!g_main_pid) {
|
---|
| 356 | log_msg(3, "FYI - g_main_pid is blank");
|
---|
| 357 | }
|
---|
| 358 | finish(254);
|
---|
| 359 | }
|
---|
[1] | 360 |
|
---|
[2241] | 361 | /* Free memory allocated for newt */
|
---|
| 362 | void free_newt_stuff() {
|
---|
[1] | 363 |
|
---|
[2241] | 364 | int i;
|
---|
[1] | 365 |
|
---|
[2241] | 366 | for (i = 0; i < g_noof_log_lines; i++) {
|
---|
| 367 | mr_free(err_log_lines[i]);
|
---|
| 368 | }
|
---|
| 369 | mr_free(err_log_lines);
|
---|
| 370 | }
|
---|
| 371 |
|
---|
| 372 |
|
---|
| 373 |
|
---|
[1] | 374 | /**
|
---|
| 375 | * Exit Mondo normally.
|
---|
| 376 | * @param signal The exit code (0 indicates a successful backup; 1 for Mondo means the
|
---|
| 377 | * user aborted; 254 means a fatal error occured).
|
---|
| 378 | * @note This function never returns.
|
---|
| 379 | */
|
---|
[3191] | 380 | void finish(int signal) {
|
---|
| 381 |
|
---|
[1708] | 382 | char *command = NULL;
|
---|
[1] | 383 |
|
---|
[2910] | 384 | /* Before removing dir, make sure we're out of them */
|
---|
[3060] | 385 | if (chdir("/tmp")) {
|
---|
| 386 | // FIXME
|
---|
| 387 | }
|
---|
[2878] | 388 | run_program_and_log_output("umount -d " MNT_CDROM, FALSE);
|
---|
[128] | 389 | if (g_selfmounted_isodir) {
|
---|
[3185] | 390 | mr_asprintf(command, "umount -d %s", g_selfmounted_isodir);
|
---|
[128] | 391 | run_program_and_log_output(command, 1);
|
---|
[3191] | 392 | mr_free(command);
|
---|
| 393 |
|
---|
[3185] | 394 | mr_asprintf(command, "rmdir %s", g_selfmounted_isodir);
|
---|
[128] | 395 | run_program_and_log_output(command, 1);
|
---|
[3191] | 396 | mr_free(command);
|
---|
[128] | 397 | }
|
---|
[2241] | 398 | if (bkpinfo->tmpdir) {
|
---|
| 399 | log_msg(8,"tempdir is %s",bkpinfo->tmpdir);
|
---|
| 400 | if (strstr(bkpinfo->tmpdir ,"mondo.tmp.") != NULL) {
|
---|
[2907] | 401 | log_msg(8,"erasing tempdir %s",bkpinfo->tmpdir);
|
---|
[3185] | 402 | mr_asprintf(command, "rm -Rf %s", bkpinfo->tmpdir);
|
---|
[3060] | 403 | paranoid_system(command);
|
---|
[2697] | 404 | mr_free(command);
|
---|
[2241] | 405 | }
|
---|
[1999] | 406 | }
|
---|
[2241] | 407 | if (bkpinfo->scratchdir) {
|
---|
| 408 | log_msg(8,"scratchdir is %s", bkpinfo->scratchdir);
|
---|
| 409 | if (strstr(bkpinfo->scratchdir ,"mondo.scratch.") != NULL) {
|
---|
[2907] | 410 | log_msg(8,"erasing scratchdir %s",bkpinfo->scratchdir);
|
---|
[3185] | 411 | mr_asprintf(command, "rm -Rf %s", bkpinfo->scratchdir);
|
---|
[3060] | 412 | paranoid_system(command);
|
---|
[2697] | 413 | mr_free(command);
|
---|
[2241] | 414 | }
|
---|
| 415 | }
|
---|
| 416 | /* Free all allocated strings in bkpinfo */
|
---|
[2380] | 417 | mr_free(bkpinfo->netfs_user);
|
---|
| 418 | mr_free(bkpinfo->netfs_proto);
|
---|
[3208] | 419 | mr_free(bkpinfo->netfs_remote_dir);
|
---|
[2424] | 420 | mr_free(bkpinfo->exclude_devs);
|
---|
[2697] | 421 | mr_free(bkpinfo->exclude_paths);
|
---|
[3292] | 422 | mr_free(bkpinfo->include_paths);
|
---|
[2769] | 423 | mr_free(bkpinfo->subdir);
|
---|
[2241] | 424 | /* Then free the structure */
|
---|
[1703] | 425 | paranoid_free(bkpinfo);
|
---|
[3191] | 426 |
|
---|
[128] | 427 | free_libmondo_global_strings();
|
---|
[2241] | 428 | free_newt_stuff();
|
---|
[3191] | 429 | if (!g_text_mode) {
|
---|
| 430 | if (does_file_exist("/THIS-IS-A-RAMDISK")) {
|
---|
| 431 | log_msg(1, "Calling newtFinished()");
|
---|
| 432 | newtFinished();
|
---|
| 433 | } else {
|
---|
| 434 | log_msg(1, "Calling newtSuspend()");
|
---|
| 435 | newtSuspend();
|
---|
| 436 | }
|
---|
| 437 | }
|
---|
| 438 | printf("Execution run ended; result=%d\n", signal);
|
---|
| 439 | printf("Type 'less %s' to see the output log\n", MONDO_LOGFILE);
|
---|
[128] | 440 | exit(signal);
|
---|
| 441 | }
|
---|
[1] | 442 |
|
---|
| 443 |
|
---|
| 444 | /**
|
---|
| 445 | * Log the last @p g_noof_log_lines lines of @p filename that match @p
|
---|
| 446 | * grep_for_me to the screen.
|
---|
| 447 | * @param filename The file to give the end of.
|
---|
| 448 | * @param grep_for_me If not "", then only give lines in @p filename that match this regular expression.
|
---|
| 449 | */
|
---|
[3191] | 450 | void log_file_end_to_screen(char *filename, char *grep_for_me) {
|
---|
[1] | 451 |
|
---|
[128] | 452 | /*@ buffers ********************************************************** */
|
---|
[2700] | 453 | char *command = NULL;
|
---|
| 454 | char *tmp = NULL;
|
---|
[3060] | 455 | char *p = NULL;
|
---|
[1] | 456 |
|
---|
[128] | 457 | /*@ pointers ********************************************************* */
|
---|
| 458 | FILE *fin;
|
---|
[1] | 459 |
|
---|
[128] | 460 | /*@ int ************************************************************** */
|
---|
| 461 | int i = 0;
|
---|
[1] | 462 |
|
---|
[128] | 463 | assert_string_is_neither_NULL_nor_zerolength(filename);
|
---|
| 464 | assert(grep_for_me != NULL);
|
---|
[1] | 465 |
|
---|
[128] | 466 | if (!does_file_exist(filename)) {
|
---|
| 467 | return;
|
---|
[1] | 468 | }
|
---|
[128] | 469 | if (grep_for_me[0] != '\0') {
|
---|
[3191] | 470 | mr_asprintf(command, "grep '%s' %s | tail -n%d", grep_for_me, filename, g_noof_log_lines);
|
---|
[128] | 471 | } else {
|
---|
[3191] | 472 | mr_asprintf(command, "tail -n%d %s", g_noof_log_lines, filename);
|
---|
[1] | 473 | }
|
---|
[128] | 474 | fin = popen(command, "r");
|
---|
| 475 | if (!fin) {
|
---|
| 476 | log_OS_error(command);
|
---|
| 477 | } else {
|
---|
| 478 | for (i = 0; i < g_noof_log_lines; i++) {
|
---|
| 479 | for (err_log_lines[i][0] = '\0';
|
---|
| 480 | strlen(err_log_lines[i]) < 2 && !feof(fin);) {
|
---|
[3060] | 481 | p = fgets(err_log_lines[i], MAX_NEWT_COMMENT_LEN, fin);
|
---|
| 482 | if (!p) {
|
---|
| 483 | // FIXME
|
---|
| 484 | }
|
---|
[1274] | 485 | /* Commented to make valgrind happy and avoid crash
|
---|
[128] | 486 | strip_spaces(err_log_lines[i]);
|
---|
[1274] | 487 | */
|
---|
[128] | 488 | if (!strncmp(err_log_lines[i], "root:", 5)) {
|
---|
[3185] | 489 | mr_asprintf(tmp, "%s", err_log_lines[i] + 6);
|
---|
[2700] | 490 | strncpy(err_log_lines[i], tmp, (size_t)MAX_NEWT_COMMENT_LEN);
|
---|
| 491 | mr_free(tmp);
|
---|
[128] | 492 | }
|
---|
| 493 | if (feof(fin)) {
|
---|
| 494 | break;
|
---|
| 495 | }
|
---|
| 496 | }
|
---|
| 497 | }
|
---|
| 498 | paranoid_pclose(fin);
|
---|
| 499 | }
|
---|
[2700] | 500 | mr_free(command);
|
---|
[128] | 501 | refresh_log_screen();
|
---|
[1] | 502 | }
|
---|
| 503 |
|
---|
| 504 |
|
---|
| 505 | /**
|
---|
| 506 | * Log a message to the screen.
|
---|
| 507 | * @param fmt A printf-style format string to write. The following parameters are its arguments.
|
---|
| 508 | * @note The message is also written to the logfile.
|
---|
| 509 | */
|
---|
[3191] | 510 | void log_to_screen(const char *fmt, ...) {
|
---|
[1] | 511 |
|
---|
[128] | 512 | /*@ int ************************************************************** */
|
---|
| 513 | int i = 0;
|
---|
| 514 | int j = 0;
|
---|
| 515 | va_list args;
|
---|
[1] | 516 |
|
---|
[128] | 517 | /*@ buffers ********************************************************** */
|
---|
| 518 | char *output;
|
---|
[1] | 519 |
|
---|
[128] | 520 | malloc_string(output);
|
---|
[1] | 521 |
|
---|
[128] | 522 | va_start(args, fmt);
|
---|
[2700] | 523 | vsnprintf(output, MAX_STR_LEN-1, fmt, args);
|
---|
[128] | 524 | log_msg(0, output);
|
---|
| 525 | output[80] = '\0';
|
---|
| 526 | va_end(args);
|
---|
| 527 | i = (int) strlen(output);
|
---|
| 528 | if (i > 0 && output[i - 1] < 32) {
|
---|
| 529 | output[i - 1] = '\0';
|
---|
| 530 | }
|
---|
[1] | 531 |
|
---|
[128] | 532 | if (err_log_lines) {
|
---|
| 533 | for (i = 1; i < g_noof_log_lines; i++) {
|
---|
| 534 | strcpy(err_log_lines[i - 1],
|
---|
| 535 | " ");
|
---|
| 536 | strcpy(err_log_lines[i - 1], err_log_lines[i]);
|
---|
| 537 | }
|
---|
| 538 | }
|
---|
| 539 | while (strlen(output) > 0 && output[strlen(output) - 1] < 32) {
|
---|
| 540 | output[strlen(output) - 1] = '\0';
|
---|
| 541 | }
|
---|
| 542 | for (j = 0; j < (int) strlen(output); j++) {
|
---|
| 543 | if (output[j] < 32) {
|
---|
| 544 | output[j] = ' ';
|
---|
| 545 | }
|
---|
| 546 | }
|
---|
| 547 | if (err_log_lines)
|
---|
| 548 | strcpy(err_log_lines[g_noof_log_lines - 1], output);
|
---|
| 549 | if (g_text_mode) {
|
---|
| 550 | printf("%s\n", output);
|
---|
| 551 | } else {
|
---|
| 552 | refresh_log_screen();
|
---|
| 553 | }
|
---|
| 554 | paranoid_free(output);
|
---|
[1] | 555 | }
|
---|
| 556 |
|
---|
| 557 |
|
---|
| 558 |
|
---|
| 559 |
|
---|
| 560 | /**
|
---|
| 561 | * Write a string to the root window at (@p x, @p y) and also to the logfile.
|
---|
| 562 | * @param y The row to write the string to.
|
---|
| 563 | * @param x The column to write the string to.
|
---|
| 564 | * @param output The string to write.
|
---|
| 565 | */
|
---|
[3191] | 566 | void mvaddstr_and_log_it(int y, int x, char *output) {
|
---|
| 567 |
|
---|
[128] | 568 | assert_string_is_neither_NULL_nor_zerolength(output);
|
---|
| 569 | log_msg(0, output);
|
---|
| 570 | if (g_text_mode) {
|
---|
| 571 | printf("%s\n", output);
|
---|
| 572 | } else {
|
---|
| 573 | newtDrawRootText(x, y, output);
|
---|
| 574 | newtRefresh();
|
---|
| 575 | }
|
---|
| 576 | }
|
---|
[1] | 577 |
|
---|
| 578 |
|
---|
| 579 |
|
---|
| 580 |
|
---|
| 581 | /**
|
---|
| 582 | * Open an evalcall form with title @p ttl.
|
---|
| 583 | * @param ttl The title to use for the evalcall form.
|
---|
| 584 | */
|
---|
[3191] | 585 | void open_evalcall_form(char *ttl) {
|
---|
[1] | 586 |
|
---|
[128] | 587 | /*@ buffers ********************************************************* */
|
---|
[3191] | 588 | char *tmp = NULL;
|
---|
[1] | 589 |
|
---|
[128] | 590 | /*@ initialize ****************************************************** */
|
---|
| 591 | g_isoform_old_progress = -1;
|
---|
| 592 | g_mysterious_dot_counter = 0;
|
---|
[1] | 593 |
|
---|
[128] | 594 | assert(ttl != NULL);
|
---|
[3191] | 595 | malloc_string(tmp);
|
---|
| 596 | strcpy(g_isoform_header_str, ttl);
|
---|
[128] | 597 | if (g_text_mode) {
|
---|
[3191] | 598 | log_msg(0, ttl);
|
---|
[128] | 599 | } else {
|
---|
[3191] | 600 | strcpy(tmp, ttl);
|
---|
[128] | 601 | center_string(tmp, 80);
|
---|
| 602 | newtPushHelpLine(tmp);
|
---|
| 603 | }
|
---|
| 604 | center_string(g_isoform_header_str, 36);
|
---|
| 605 | g_isoform_starttime = get_time();
|
---|
| 606 | if (g_text_mode) {
|
---|
| 607 | log_msg(0, g_isoform_header_str);
|
---|
| 608 | } else {
|
---|
| 609 | g_isoform_header = newtLabel(1, 1, g_isoform_header_str);
|
---|
| 610 | g_isoform_scale = newtScale(3, 3, 34, 100);
|
---|
[3191] | 611 | newtCenteredWindow(40, 7, ttl);
|
---|
[3292] | 612 | if (g_isoform_main != NULL) {
|
---|
| 613 | newtFormDestroy(g_isoform_main);
|
---|
| 614 | }
|
---|
[128] | 615 | g_isoform_main = newtForm(NULL, NULL, 0);
|
---|
[2881] | 616 | g_isoform_timeline = newtLabel(1, 5, " ");
|
---|
| 617 | g_isoform_pcline = newtLabel(1, 6, " ");
|
---|
[128] | 618 | newtFormAddComponents(g_isoform_main, g_isoform_timeline,
|
---|
| 619 | g_isoform_pcline, g_isoform_header,
|
---|
| 620 | g_isoform_scale, NULL);
|
---|
[2879] | 621 | newtDrawForm(g_isoform_main);
|
---|
[128] | 622 | newtRefresh();
|
---|
| 623 | }
|
---|
| 624 | update_evalcall_form(0);
|
---|
| 625 | paranoid_free(tmp);
|
---|
| 626 | }
|
---|
[1] | 627 |
|
---|
| 628 |
|
---|
| 629 |
|
---|
| 630 | /**
|
---|
| 631 | * Open a progress form with title @p title.
|
---|
| 632 | * @param title The title to use for the progress form (will be put in the title bar on Newt).
|
---|
| 633 | * @param b1 The first line of the blurb; generally static.
|
---|
| 634 | * @param b2 The second line of the blurb; generally static.
|
---|
| 635 | * @param b3 The third line of the blurb; generally dynamic (it is passed
|
---|
| 636 | * to update_evalcall_form() every time).
|
---|
| 637 | * @param max_val The maximum amount of progress (number of filesets, etc.)
|
---|
| 638 | */
|
---|
[3191] | 639 | void open_progress_form(char *title, char *b1, char *b2, char *b3, long max_val) {
|
---|
[1] | 640 |
|
---|
[128] | 641 | /*@ buffers ********************************************************* */
|
---|
| 642 | char *b1c;
|
---|
[3191] | 643 | char *blurb1 = NULL;
|
---|
| 644 | char *blurb2 = NULL;
|
---|
| 645 | char *blurb3 = NULL;
|
---|
[1] | 646 |
|
---|
[128] | 647 | /*@ initialize ****************************************************** */
|
---|
| 648 | g_mysterious_dot_counter = 0;
|
---|
[1] | 649 |
|
---|
[128] | 650 | malloc_string(b1c);
|
---|
[1] | 651 |
|
---|
[128] | 652 | assert(title != NULL);
|
---|
| 653 | assert(b1 != NULL);
|
---|
| 654 | assert(b2 != NULL);
|
---|
| 655 | assert(b3 != NULL);
|
---|
[1] | 656 |
|
---|
[3235] | 657 | malloc_string(blurb1);
|
---|
| 658 | malloc_string(blurb2);
|
---|
| 659 | malloc_string(blurb3);
|
---|
| 660 | strcpy(blurb1, b1);
|
---|
| 661 | strcpy(blurb2, b2);
|
---|
| 662 | strcpy(blurb3, b3);
|
---|
[3191] | 663 |
|
---|
[128] | 664 | strcpy(b1c, b1);
|
---|
| 665 | center_string(b1c, 80);
|
---|
| 666 | if (max_val <= 0) {
|
---|
| 667 | max_val = 1;
|
---|
| 668 | }
|
---|
[1] | 669 |
|
---|
[128] | 670 | g_start_time = get_time();
|
---|
| 671 | g_maximum_progress = max_val;
|
---|
| 672 | g_current_progress = 0;
|
---|
| 673 | strcpy(g_blurb_str_1, blurb1);
|
---|
| 674 | strcpy(g_blurb_str_2, blurb3);
|
---|
| 675 | strcpy(g_blurb_str_3, blurb2);
|
---|
| 676 | if (g_text_mode) {
|
---|
| 677 | log_msg(0, blurb1);
|
---|
| 678 | log_msg(0, blurb2);
|
---|
| 679 | log_msg(0, blurb3);
|
---|
| 680 | } else {
|
---|
| 681 | g_blurb1 = newtLabel(2, 1, blurb1);
|
---|
| 682 | g_blurb2 = newtLabel(2, 2, blurb3);
|
---|
| 683 | g_blurb3 = newtLabel(2, 4, blurb2);
|
---|
| 684 | newtCenteredWindow(60, 11, title);
|
---|
[3191] | 685 | g_scale = newtScale(3, 6, 54, (long long)g_maximum_progress);
|
---|
[128] | 686 | g_progressForm = newtForm(NULL, NULL, 0);
|
---|
[2886] | 687 | g_percentline = newtLabel(10, 9, " ");
|
---|
| 688 | g_timeline = newtLabel(10, 8, " ");
|
---|
[3191] | 689 | newtFormAddComponents(g_progressForm, g_percentline, g_timeline, g_scale, g_blurb1, g_blurb3, g_blurb2, NULL);
|
---|
[128] | 690 | newtPushHelpLine(b1c);
|
---|
[2879] | 691 | newtDrawForm(g_progressForm);
|
---|
[128] | 692 | newtRefresh();
|
---|
| 693 | }
|
---|
| 694 | update_progress_form_full(blurb1, blurb2, blurb3);
|
---|
| 695 | paranoid_free(b1c);
|
---|
[3235] | 696 | paranoid_free(blurb1);
|
---|
| 697 | paranoid_free(blurb2);
|
---|
| 698 | paranoid_free(blurb3);
|
---|
[128] | 699 | }
|
---|
| 700 |
|
---|
[1] | 701 | /**
|
---|
| 702 | * Give a message to the user in the form of a dialog box (under Newt).
|
---|
| 703 | * @param prompt The message.
|
---|
| 704 | */
|
---|
[3191] | 705 | void popup_and_OK(char *prompt) {
|
---|
| 706 |
|
---|
[128] | 707 | char ch;
|
---|
[1] | 708 |
|
---|
[128] | 709 | assert_string_is_neither_NULL_nor_zerolength(prompt);
|
---|
[1] | 710 |
|
---|
[128] | 711 | log_msg(0, prompt);
|
---|
| 712 | if (g_text_mode) {
|
---|
[3191] | 713 | printf("---promptpopup---1--- %s\n---promptpopup---Q--- [OK] ---\n--> ", prompt);
|
---|
[128] | 714 | while (((ch = getchar()) != '\n') && (ch != EOF));
|
---|
| 715 | } else {
|
---|
[541] | 716 | (void) popup_with_buttons(prompt, " OK ", "");
|
---|
[128] | 717 | }
|
---|
| 718 | }
|
---|
[1] | 719 |
|
---|
| 720 | /**
|
---|
| 721 | * Ask the user to enter a value.
|
---|
| 722 | * @param title The title of the dialog box.
|
---|
| 723 | * @param b The blurb (e.g. what you want the user to enter).
|
---|
[3377] | 724 | * @param input The string to initialize the user's answer with.
|
---|
| 725 | * @return value needs to be freed up by caller
|
---|
| 726 | */
|
---|
| 727 | char *mr_popup_and_get_string(char *title, char *b, char *input) {
|
---|
| 728 |
|
---|
| 729 | /*@ newt ************************************************************ */
|
---|
| 730 | newtComponent myForm;
|
---|
| 731 | newtComponent b_1;
|
---|
| 732 | newtComponent b_2;
|
---|
| 733 | newtComponent b_res;
|
---|
| 734 | newtComponent text;
|
---|
| 735 | newtComponent type_here;
|
---|
| 736 |
|
---|
| 737 | char *entry_value = NULL;
|
---|
| 738 | char *blurb = NULL;
|
---|
| 739 | char *out = NULL;
|
---|
| 740 |
|
---|
| 741 | assert_string_is_neither_NULL_nor_zerolength(title);
|
---|
| 742 | assert(b != NULL);
|
---|
| 743 |
|
---|
| 744 | if (g_text_mode) {
|
---|
| 745 | printf("---promptstring---1--- %s\n---promptstring---2--- %s\n---promptstring---Q---\n--> ", title, b);
|
---|
| 746 | mr_getline(out, stdin);
|
---|
| 747 | if (out[strlen(out) - 1] == '\n')
|
---|
| 748 | out[strlen(out) - 1] = '\0';
|
---|
| 749 | return(out);
|
---|
| 750 | }
|
---|
| 751 |
|
---|
| 752 | assert(input != NULL);
|
---|
| 753 | text = newtTextboxReflowed(2, 1, b, 48, 5, 5, 0);
|
---|
| 754 | type_here = newtEntry(2, newtTextboxGetNumLines(text) + 2, input, 50, (void *) &entry_value, NEWT_FLAG_RETURNEXIT);
|
---|
| 755 | b_1 = newtButton(6, newtTextboxGetNumLines(text) + 4, " OK ");
|
---|
| 756 | b_2 = newtButton(18, newtTextboxGetNumLines(text) + 4, "Cancel");
|
---|
| 757 | newtCenteredWindow(54, newtTextboxGetNumLines(text) + 9, title);
|
---|
| 758 | myForm = newtForm(NULL, NULL, 0);
|
---|
| 759 | newtFormAddComponents(myForm, text, type_here, b_1, b_2, NULL);
|
---|
| 760 | blurb = mr_center_string(b, 80);
|
---|
| 761 | newtPushHelpLine(blurb);
|
---|
| 762 | b_res = newtRunForm(myForm);
|
---|
| 763 |
|
---|
| 764 | newtPopHelpLine();
|
---|
| 765 | newtFormDestroy(myForm);
|
---|
| 766 | newtPopWindow();
|
---|
| 767 | mr_free(blurb);
|
---|
| 768 |
|
---|
| 769 | if (b_res != b_2) {
|
---|
| 770 | out = entry_value;
|
---|
| 771 | }
|
---|
| 772 | return(out);
|
---|
| 773 | }
|
---|
| 774 |
|
---|
| 775 | /**
|
---|
| 776 | * Ask the user to enter a value.
|
---|
| 777 | * @param title The title of the dialog box.
|
---|
| 778 | * @param b The blurb (e.g. what you want the user to enter).
|
---|
[1] | 779 | * @param output The string to put the user's answer in.
|
---|
| 780 | * @param maxsize The size in bytes allocated to @p output.
|
---|
| 781 | * @return TRUE if the user pressed OK, FALSE if they pressed Cancel.
|
---|
| 782 | */
|
---|
[3191] | 783 | bool popup_and_get_string(char *title, char *b, char *output, int maxsize) {
|
---|
[1] | 784 |
|
---|
[128] | 785 | /*@ newt ************************************************************ */
|
---|
| 786 | newtComponent myForm;
|
---|
| 787 | newtComponent b_1;
|
---|
| 788 | newtComponent b_2;
|
---|
| 789 | newtComponent b_res;
|
---|
| 790 | newtComponent text;
|
---|
| 791 | newtComponent type_here;
|
---|
[1] | 792 |
|
---|
[128] | 793 | /*@ pointers ********************************************************* */
|
---|
| 794 | char *entry_value;
|
---|
[1] | 795 |
|
---|
[128] | 796 | /*@ buffers ********************************************************** */
|
---|
[3191] | 797 | char *blurb = NULL;
|
---|
[3060] | 798 | char *p;
|
---|
[3191] | 799 | char *original_contents = NULL;
|
---|
[1] | 800 |
|
---|
[128] | 801 | assert_string_is_neither_NULL_nor_zerolength(title);
|
---|
| 802 | assert(b != NULL);
|
---|
| 803 | assert(output != NULL);
|
---|
[1] | 804 |
|
---|
[128] | 805 | if (g_text_mode) {
|
---|
[3191] | 806 | printf("---promptstring---1--- %s\n---promptstring---2--- %s\n---promptstring---Q---\n--> ", title, b);
|
---|
[3060] | 807 | p = fgets(output, maxsize, stdin);
|
---|
| 808 | if (!p) {
|
---|
| 809 | // FIXME
|
---|
| 810 | }
|
---|
[128] | 811 | if (output[strlen(output) - 1] == '\n')
|
---|
| 812 | output[strlen(output) - 1] = '\0';
|
---|
| 813 | return (TRUE);
|
---|
| 814 | }
|
---|
[3191] | 815 |
|
---|
| 816 | blurb = malloc(MAX_NEWT_COMMENT_LEN);
|
---|
[128] | 817 | strcpy(blurb, b);
|
---|
| 818 | text = newtTextboxReflowed(2, 1, blurb, 48, 5, 5, 0);
|
---|
[3191] | 819 | mr_asprintf(original_contents, "%s", output);
|
---|
[128] | 820 | output[0] = '\0';
|
---|
[3191] | 821 | type_here = newtEntry(2, newtTextboxGetNumLines(text) + 2, original_contents, 50,
|
---|
[1] | 822 | #ifdef __cplusplus
|
---|
[128] | 823 | 0, NEWT_FLAG_RETURNEXIT
|
---|
[1] | 824 | #else
|
---|
[128] | 825 | (void *) &entry_value, NEWT_FLAG_RETURNEXIT
|
---|
[1] | 826 | #endif
|
---|
[128] | 827 | );
|
---|
[541] | 828 | b_1 = newtButton(6, newtTextboxGetNumLines(text) + 4, " OK ");
|
---|
| 829 | b_2 = newtButton(18, newtTextboxGetNumLines(text) + 4, "Cancel");
|
---|
[128] | 830 | newtCenteredWindow(54, newtTextboxGetNumLines(text) + 9, title);
|
---|
| 831 | myForm = newtForm(NULL, NULL, 0);
|
---|
| 832 | newtFormAddComponents(myForm, text, type_here, b_1, b_2, NULL);
|
---|
| 833 | center_string(blurb, 80);
|
---|
| 834 | newtPushHelpLine(blurb);
|
---|
| 835 | b_res = newtRunForm(myForm);
|
---|
| 836 | strcpy(output, entry_value);
|
---|
| 837 | newtPopHelpLine();
|
---|
| 838 | newtFormDestroy(myForm);
|
---|
| 839 | newtPopWindow();
|
---|
[3191] | 840 | paranoid_free(blurb);
|
---|
| 841 |
|
---|
[128] | 842 | if (b_res == b_2) {
|
---|
| 843 | strcpy(output, original_contents);
|
---|
[3191] | 844 | mr_free(original_contents);
|
---|
[128] | 845 | return (FALSE);
|
---|
| 846 | } else {
|
---|
[3191] | 847 | mr_free(original_contents);
|
---|
[128] | 848 | return (TRUE);
|
---|
| 849 | }
|
---|
| 850 | }
|
---|
[1] | 851 |
|
---|
| 852 |
|
---|
| 853 | /**
|
---|
| 854 | * Pop up a dialog box with user-defined buttons.
|
---|
| 855 | * @param p The text to put in the dialog box.
|
---|
| 856 | * @param button1 The label on the first button.
|
---|
| 857 | * @param button2 The label on the second button, or "" if you only want one button.
|
---|
| 858 | * @return TRUE if @p button1 was pushed, FALSE otherwise.
|
---|
| 859 | */
|
---|
[3191] | 860 | bool popup_with_buttons(char *p, char *button1, char *button2) {
|
---|
[1] | 861 |
|
---|
[128] | 862 | /*@ buffers *********************************************************** */
|
---|
[3191] | 863 | char *prompt = NULL;
|
---|
[1] | 864 |
|
---|
[128] | 865 | /*@ newt ************************************************************** */
|
---|
| 866 | newtComponent myForm;
|
---|
| 867 | newtComponent b_1;
|
---|
| 868 | newtComponent b_2;
|
---|
| 869 | newtComponent b_res;
|
---|
| 870 | newtComponent text;
|
---|
[1] | 871 |
|
---|
[128] | 872 | assert_string_is_neither_NULL_nor_zerolength(p);
|
---|
| 873 | assert(button1 != NULL);
|
---|
| 874 | assert(button2 != NULL);
|
---|
| 875 | if (g_text_mode) {
|
---|
| 876 | if (strlen(button2) == 0) {
|
---|
| 877 | printf("%s (%s) --> ", p, button1);
|
---|
| 878 | } else {
|
---|
| 879 | printf("%s (%s or %s) --> ", p, button1, button2);
|
---|
| 880 | }
|
---|
[3191] | 881 | mr_getline(prompt, stdin);
|
---|
| 882 | while (strcmp(prompt, button1) && (strlen(button2) == 0 || strcmp(prompt, button2))) {
|
---|
[128] | 883 | printf("--> ");
|
---|
[3191] | 884 | mr_free(prompt);
|
---|
| 885 | mr_getline(prompt, stdin);
|
---|
[128] | 886 | }
|
---|
[2136] | 887 | if (!strcmp(prompt, button1)) {
|
---|
[3191] | 888 | mr_free(prompt);
|
---|
[128] | 889 | return (TRUE);
|
---|
| 890 | } else {
|
---|
[3191] | 891 | mr_free(prompt);
|
---|
[128] | 892 | return (FALSE);
|
---|
| 893 | }
|
---|
| 894 | }
|
---|
[1] | 895 |
|
---|
[3191] | 896 | prompt = malloc(MAX_NEWT_COMMENT_LEN);
|
---|
[877] | 897 | strncpy(prompt, p, MAX_NEWT_COMMENT_LEN - 1);
|
---|
[883] | 898 | prompt[MAX_NEWT_COMMENT_LEN - 1] = '\0';
|
---|
[128] | 899 | text = newtTextboxReflowed(1, 1, prompt, 40, 5, 5, 0);
|
---|
[3191] | 900 | b_1 = newtButton(20 - ((button2[0] != '\0') ? strlen(button1) + 2 : strlen(button1) / 2), newtTextboxGetNumLines(text) + 3, button1);
|
---|
[128] | 901 | if (button2[0] != '\0') {
|
---|
[3191] | 902 | b_2 = newtButton(24, newtTextboxGetNumLines(text) + 3, button2);
|
---|
[128] | 903 | } else {
|
---|
| 904 | b_2 = NULL;
|
---|
| 905 | }
|
---|
[541] | 906 | newtCenteredWindow(46, newtTextboxGetNumLines(text) + 7, "Alert");
|
---|
[128] | 907 | myForm = newtForm(NULL, NULL, 0);
|
---|
| 908 | newtFormAddComponents(myForm, text, b_1, b_2, NULL);
|
---|
| 909 | center_string(prompt, 80);
|
---|
| 910 | newtPushHelpLine(prompt);
|
---|
| 911 | b_res = newtRunForm(myForm);
|
---|
| 912 | newtPopHelpLine();
|
---|
| 913 | newtFormDestroy(myForm);
|
---|
| 914 | newtPopWindow();
|
---|
| 915 | if (b_res == b_1) {
|
---|
| 916 | paranoid_free(prompt);
|
---|
| 917 | return (TRUE);
|
---|
| 918 | } else {
|
---|
| 919 | paranoid_free(prompt);
|
---|
| 920 | return (FALSE);
|
---|
| 921 | }
|
---|
| 922 | }
|
---|
[1] | 923 |
|
---|
| 924 |
|
---|
| 925 |
|
---|
[128] | 926 |
|
---|
[1] | 927 | /**
|
---|
| 928 | * Synchronize the log messages stored in @p err_log_lines with those shown
|
---|
| 929 | * on the screen.
|
---|
| 930 | */
|
---|
[3191] | 931 | void refresh_log_screen() {
|
---|
[1] | 932 |
|
---|
[128] | 933 | /*@ int *********************************************************** */
|
---|
| 934 | int i = 0;
|
---|
[1] | 935 |
|
---|
| 936 |
|
---|
[128] | 937 | if (g_text_mode || !err_log_lines) {
|
---|
| 938 | return;
|
---|
| 939 | }
|
---|
| 940 | for (i = g_noof_log_lines - 1; i >= 0; i--) {
|
---|
| 941 | newtDrawRootText(0, i + g_noof_rows - 1 - g_noof_log_lines,
|
---|
| 942 | " ");
|
---|
| 943 | }
|
---|
| 944 | newtRefresh();
|
---|
| 945 | for (i = g_noof_log_lines - 1; i >= 0; i--) {
|
---|
| 946 | err_log_lines[i][79] = '\0';
|
---|
| 947 | newtDrawRootText(0, i + g_noof_rows - 1 - g_noof_log_lines,
|
---|
| 948 | err_log_lines[i]);
|
---|
| 949 | }
|
---|
| 950 | newtRefresh();
|
---|
| 951 | }
|
---|
[1] | 952 |
|
---|
| 953 |
|
---|
| 954 | /**
|
---|
| 955 | * Set up the Newt graphical environment. If @p g_text_mode is TRUE, then
|
---|
| 956 | * only allocate some memory.
|
---|
| 957 | */
|
---|
[3191] | 958 | void setup_newt_stuff() {
|
---|
[1] | 959 |
|
---|
[128] | 960 | /*@ int *********************************************************** */
|
---|
| 961 | int i = 0;
|
---|
| 962 | int cols;
|
---|
[1] | 963 |
|
---|
[128] | 964 | if (!g_text_mode) {
|
---|
| 965 | newtInit();
|
---|
| 966 | newtCls();
|
---|
[3191] | 967 | newtPushHelpLine("Welcome to Mondo Rescue, by Dev Team and the Internet. All rights reversed.");
|
---|
[128] | 968 | newtDrawRootText(18, 0, WELCOME_STRING);
|
---|
| 969 | newtRefresh();
|
---|
| 970 | newtGetScreenSize(&cols, &g_noof_rows);
|
---|
| 971 | g_noof_log_lines = (g_noof_rows / 5) + 1;
|
---|
| 972 | }
|
---|
[1] | 973 |
|
---|
[3191] | 974 | err_log_lines = (char **) mr_malloc(sizeof(char *) * g_noof_log_lines);
|
---|
[1] | 975 |
|
---|
[128] | 976 | for (i = 0; i < g_noof_log_lines; i++) {
|
---|
[3191] | 977 | err_log_lines[i] = (char *) mr_malloc(MAX_NEWT_COMMENT_LEN);
|
---|
[128] | 978 | }
|
---|
[1] | 979 |
|
---|
[128] | 980 | for (i = 0; i < g_noof_log_lines; i++) {
|
---|
| 981 | err_log_lines[i][0] = '\0';
|
---|
| 982 | }
|
---|
| 983 | }
|
---|
[1] | 984 |
|
---|
| 985 |
|
---|
| 986 | /**
|
---|
| 987 | * Update the evalcall form to show (<tt>num</tt>/<tt>denom</tt>)*100 %.
|
---|
| 988 | * @param num The numerator of the ratio.
|
---|
| 989 | * @param denom The denomenator of the ratio.
|
---|
| 990 | */
|
---|
[3191] | 991 | void update_evalcall_form_ratio(int num, int denom) {
|
---|
[1] | 992 |
|
---|
[128] | 993 | /*@ long ************************************************************ */
|
---|
[3191] | 994 | long current_time = 0L;
|
---|
| 995 | long time_taken = 0L;
|
---|
| 996 | long time_total_est = 0L;
|
---|
| 997 | long time_remaining = 0L;
|
---|
[1] | 998 |
|
---|
[128] | 999 | /*@ buffers ********************************************************** */
|
---|
[3191] | 1000 | char *timeline_str = NULL;
|
---|
[2211] | 1001 | char *pcline_str = NULL;
|
---|
| 1002 | char *taskprogress = NULL;
|
---|
[1] | 1003 |
|
---|
[128] | 1004 | /*@ int ************************************************************** */
|
---|
| 1005 | int percentage = 0;
|
---|
| 1006 | int i = 0;
|
---|
| 1007 | int j = 0;
|
---|
[1] | 1008 |
|
---|
[128] | 1009 | if (num * 100 < denom) {
|
---|
| 1010 | percentage = 1;
|
---|
| 1011 | } else {
|
---|
| 1012 | percentage = (num * 100 + denom / 2) / denom;
|
---|
| 1013 | }
|
---|
| 1014 |
|
---|
| 1015 | current_time = get_time();
|
---|
| 1016 | time_taken = current_time - g_isoform_starttime;
|
---|
| 1017 | if (num) {
|
---|
| 1018 | time_total_est = time_taken * denom / num;
|
---|
| 1019 | time_remaining = time_total_est - time_taken;
|
---|
| 1020 | } else {
|
---|
[3191] | 1021 | time_remaining = 0L;
|
---|
[128] | 1022 | }
|
---|
| 1023 | if (!g_text_mode) {
|
---|
[1899] | 1024 | if (g_isoform_header) {
|
---|
| 1025 | newtLabelSetText(g_isoform_header, g_isoform_header_str);
|
---|
| 1026 | }
|
---|
[128] | 1027 | }
|
---|
| 1028 | g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27;
|
---|
[3205] | 1029 | if ((percentage < 3 && g_isoform_old_progress < 3) || percentage > g_isoform_old_progress) {
|
---|
[128] | 1030 | g_isoform_old_progress = percentage;
|
---|
[3191] | 1031 | mr_asprintf(timeline_str, "%2ld:%02ld taken %2ld:%02ld remaining", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
|
---|
[128] | 1032 | if (percentage < 3) {
|
---|
[3185] | 1033 | mr_asprintf(pcline_str, " Working");
|
---|
[128] | 1034 | for (j = 0; j < g_mysterious_dot_counter; j++) {
|
---|
[2211] | 1035 | mr_strcat(pcline_str, ".");
|
---|
[128] | 1036 | }
|
---|
| 1037 | for (; j < 27; j++) {
|
---|
[2211] | 1038 | mr_strcat(pcline_str, " ");
|
---|
[128] | 1039 | }
|
---|
[2211] | 1040 | mr_strcat(pcline_str, " %c", special_dot_char(g_mysterious_dot_counter));
|
---|
[128] | 1041 | } else {
|
---|
[3191] | 1042 | mr_asprintf(pcline_str, " %3d%% done %3d%% to go", percentage, 100 - percentage);
|
---|
[128] | 1043 | }
|
---|
| 1044 | if (g_text_mode) {
|
---|
[3185] | 1045 | mr_asprintf(taskprogress, "TASK: [");
|
---|
[128] | 1046 | for (i = 0; i < percentage; i += 5) {
|
---|
[2211] | 1047 | mr_strcat(taskprogress, "*");
|
---|
[128] | 1048 | }
|
---|
| 1049 | for (; i < 100; i += 5) {
|
---|
[2211] | 1050 | mr_strcat(taskprogress, ".");
|
---|
[128] | 1051 | }
|
---|
| 1052 | if (percentage >= 3) {
|
---|
[3191] | 1053 | mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage, (long) time_remaining / 60, (long) time_remaining % 60);
|
---|
| 1054 | printf("---evalcall---1--- %s\n", g_isoform_header_str);
|
---|
[1899] | 1055 | printf("---evalcall---2--- %s\n", taskprogress);
|
---|
| 1056 | printf("---evalcall---E---\n");
|
---|
[128] | 1057 | }
|
---|
[3191] | 1058 | mr_free(taskprogress);
|
---|
[128] | 1059 | } else {
|
---|
[3191] | 1060 | newtScaleSet(g_isoform_scale, (unsigned long long) percentage);
|
---|
[1899] | 1061 | if (g_isoform_pcline) {
|
---|
| 1062 | newtLabelSetText(g_isoform_pcline, pcline_str);
|
---|
| 1063 | }
|
---|
| 1064 | if ((percentage >= 3) && (g_isoform_timeline)) {
|
---|
[128] | 1065 | newtLabelSetText(g_isoform_timeline, timeline_str);
|
---|
| 1066 | }
|
---|
| 1067 | }
|
---|
[3191] | 1068 | mr_free(pcline_str);
|
---|
| 1069 | mr_free(timeline_str);
|
---|
[128] | 1070 | }
|
---|
| 1071 | if (!g_text_mode) {
|
---|
[2879] | 1072 | newtDrawForm(g_isoform_main);
|
---|
[128] | 1073 | newtRefresh();
|
---|
| 1074 | }
|
---|
[1] | 1075 | }
|
---|
| 1076 |
|
---|
| 1077 |
|
---|
| 1078 |
|
---|
| 1079 | /**
|
---|
| 1080 | * Update the evalcall form to show @p curr %.
|
---|
| 1081 | * @param curr The current amount of progress (percentage) in the evalcall form.
|
---|
| 1082 | */
|
---|
[3191] | 1083 | void update_evalcall_form(int curr) {
|
---|
| 1084 |
|
---|
[128] | 1085 | update_evalcall_form_ratio(curr, 100);
|
---|
[3191] | 1086 | }
|
---|
[1] | 1087 |
|
---|
| 1088 |
|
---|
| 1089 |
|
---|
| 1090 | /**
|
---|
| 1091 | * Update the progress form to show @p blurb3 and the current value of
|
---|
| 1092 | * @p g_maximum_progress.
|
---|
| 1093 | * @param blurb3 The new third line of the blurb; use @p g_blurb_str_2 (no, that's not a typo) to keep it the same.
|
---|
| 1094 | */
|
---|
[3191] | 1095 | void update_progress_form(char *blurb3) {
|
---|
| 1096 |
|
---|
[128] | 1097 | if (g_current_progress == -999) {
|
---|
| 1098 | return;
|
---|
| 1099 | }
|
---|
| 1100 | strcpy(g_blurb_str_2, blurb3);
|
---|
[3191] | 1101 | update_progress_form_full(g_blurb_str_1, g_blurb_str_2, g_blurb_str_3);
|
---|
| 1102 | }
|
---|
[1] | 1103 |
|
---|
| 1104 |
|
---|
| 1105 | /**
|
---|
| 1106 | * Update the progress form's complete blurb and show @p g_current_progress.
|
---|
| 1107 | * @param blurb1 The first line of the blurb. Use @p g_blurb_str_1 to keep it unchanged.
|
---|
| 1108 | * @param blurb2 The second line of the blurb. Use @p g_blurb_str_3 (no, that's not a typo) to keep it the same.
|
---|
| 1109 | * @param blurb3 The third line of the blurb. Use @p g_blurb_str_2 (no, that's not a typo either) to keep it the same.
|
---|
| 1110 | */
|
---|
[3191] | 1111 | void update_progress_form_full(char *blurb1, char *blurb2, char *blurb3) {
|
---|
| 1112 |
|
---|
[128] | 1113 | /*@ long ***************************************************** */
|
---|
[2374] | 1114 | long current_time = 0L;
|
---|
| 1115 | long time_taken = 0L;
|
---|
| 1116 | long time_remaining = 0L;
|
---|
| 1117 | long time_total_est = 0L;
|
---|
[1] | 1118 |
|
---|
[128] | 1119 | /*@ int ******************************************************* */
|
---|
| 1120 | int percentage = 0;
|
---|
| 1121 | int i = 0;
|
---|
[1] | 1122 |
|
---|
[128] | 1123 | /*@ buffers *************************************************** */
|
---|
[3191] | 1124 | char *percentline_str = NULL;
|
---|
| 1125 | char *timeline_str = NULL;
|
---|
[2211] | 1126 | char *taskprogress = NULL;
|
---|
[1] | 1127 |
|
---|
[128] | 1128 | if (!g_text_mode) {
|
---|
| 1129 | assert(blurb1 != NULL);
|
---|
| 1130 | assert(blurb2 != NULL);
|
---|
| 1131 | assert(blurb3 != NULL);
|
---|
| 1132 | assert(g_timeline != NULL);
|
---|
| 1133 | }
|
---|
[1] | 1134 |
|
---|
[128] | 1135 | current_time = get_time();
|
---|
| 1136 | time_taken = current_time - g_start_time;
|
---|
| 1137 | if (g_maximum_progress == 0) {
|
---|
| 1138 | percentage = 0;
|
---|
| 1139 | } else {
|
---|
| 1140 | if (g_current_progress > g_maximum_progress) {
|
---|
[3191] | 1141 | log_msg(0, "update_progress_form_full(%s,%s,%s) --- g_current_progress=%ld; g_maximum_progress=%ld", blurb1, blurb2, blurb3, g_current_progress, g_maximum_progress);
|
---|
[128] | 1142 | g_current_progress = g_maximum_progress;
|
---|
| 1143 | }
|
---|
[3191] | 1144 | percentage = (int) ((g_current_progress * 100L) / g_maximum_progress);
|
---|
[128] | 1145 | }
|
---|
| 1146 | if (percentage < 1) {
|
---|
| 1147 | percentage = 1;
|
---|
| 1148 | }
|
---|
| 1149 | if (percentage > 100) {
|
---|
| 1150 | percentage = 100;
|
---|
| 1151 | }
|
---|
| 1152 | if (g_current_progress) {
|
---|
[3191] | 1153 | time_total_est = time_taken * (long) g_maximum_progress / (long) g_current_progress;
|
---|
[128] | 1154 | time_remaining = time_total_est - time_taken;
|
---|
| 1155 | } else {
|
---|
[2374] | 1156 | time_remaining = 0L;
|
---|
[128] | 1157 | }
|
---|
| 1158 | g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27;
|
---|
| 1159 | if (g_text_mode) {
|
---|
[1899] | 1160 | printf("---progress-form---1--- %s\n", blurb1);
|
---|
| 1161 | printf("---progress-form---2--- %s\n", blurb2);
|
---|
| 1162 | printf("---progress-form---3--- %s\n", blurb3);
|
---|
[541] | 1163 | printf("---progress-form---E---\n");
|
---|
[3185] | 1164 | mr_asprintf(taskprogress, "TASK: [");
|
---|
[128] | 1165 | for (i = 0; i < percentage; i += 5) {
|
---|
[2211] | 1166 | mr_strcat(taskprogress, "*");
|
---|
[128] | 1167 | }
|
---|
| 1168 | for (; i < 100; i += 5) {
|
---|
[2211] | 1169 | mr_strcat(taskprogress, ".");
|
---|
[128] | 1170 | }
|
---|
| 1171 | if (percentage > 100) {
|
---|
[541] | 1172 | log_msg(2, "percentage = %d", percentage);
|
---|
[128] | 1173 | }
|
---|
[3191] | 1174 | mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage, (long) time_remaining / 60, (long) time_remaining % 60);
|
---|
[1899] | 1175 | printf("---progress-form---4--- %s\n", taskprogress);
|
---|
[2211] | 1176 | paranoid_free(taskprogress);
|
---|
[128] | 1177 | } else {
|
---|
[3191] | 1178 | mr_asprintf(timeline_str, "%2ld:%02ld taken %2ld:%02ld remaining ", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
|
---|
| 1179 | mr_asprintf(percentline_str, " %3d%% done %3d%% to go", percentage, 100 - percentage);
|
---|
| 1180 |
|
---|
[128] | 1181 | center_string(blurb1, 54);
|
---|
| 1182 | center_string(blurb2, 54);
|
---|
| 1183 | center_string(blurb3, 54);
|
---|
[1899] | 1184 | if (g_blurb1) {
|
---|
| 1185 | newtLabelSetText(g_blurb1, blurb1);
|
---|
| 1186 | }
|
---|
| 1187 | if (g_blurb2) {
|
---|
| 1188 | newtLabelSetText(g_blurb2, blurb3);
|
---|
| 1189 | }
|
---|
| 1190 | if (g_blurb3) {
|
---|
| 1191 | newtLabelSetText(g_blurb3, blurb2);
|
---|
| 1192 | }
|
---|
[128] | 1193 | newtScaleSet(g_scale, (unsigned long long) g_current_progress);
|
---|
[1899] | 1194 | if ((percentage >= 2) && (g_timeline)) {
|
---|
[128] | 1195 | newtLabelSetText(g_timeline, timeline_str);
|
---|
| 1196 | }
|
---|
[3191] | 1197 | mr_free(timeline_str);
|
---|
| 1198 |
|
---|
[1899] | 1199 | if (g_percentline) {
|
---|
| 1200 | newtLabelSetText(g_percentline, percentline_str);
|
---|
| 1201 | }
|
---|
[3191] | 1202 | mr_free(percentline_str);
|
---|
| 1203 |
|
---|
[2879] | 1204 | newtDrawForm(g_progressForm);
|
---|
[128] | 1205 | newtRefresh();
|
---|
| 1206 | }
|
---|
[1] | 1207 | }
|
---|
| 1208 |
|
---|
| 1209 |
|
---|
| 1210 | /**
|
---|
| 1211 | * Ask the user which backup media type they would like to use.
|
---|
| 1212 | * The choices are @p none (exit to shell), @c cdr, @c cdrw, @c dvd,
|
---|
[2380] | 1213 | * @c tape, @c cdstream, @c udev (only when @p g_text_mode is TRUE), @c netfs,
|
---|
[1] | 1214 | * and @c iso.
|
---|
| 1215 | * @param restoring TRUE if we're restoring, FALSE if we're backing up.
|
---|
| 1216 | * @return The backup type chosen, or @c none if the user chose "Exit to shell".
|
---|
| 1217 | */
|
---|
[3191] | 1218 | t_bkptype which_backup_media_type(bool restoring) {
|
---|
[1] | 1219 |
|
---|
[128] | 1220 | /*@ char ************************************************************ */
|
---|
| 1221 | t_bkptype output;
|
---|
[1] | 1222 |
|
---|
| 1223 |
|
---|
[128] | 1224 | /*@ newt ************************************************************ */
|
---|
[3191] | 1225 | char *title_sz = NULL;
|
---|
| 1226 | char *minimsg_sz = NULL;
|
---|
| 1227 | static t_bkptype possible_bkptypes[] = { none, cdr, cdrw, dvd, tape, cdstream, udev, netfs, iso };
|
---|
| 1228 | static char *possible_responses[] = { "none", "cdr", "cdrw", "dvd", "tape", "cdstream", "udev", "netfs", "iso", NULL };
|
---|
| 1229 | char *outstr = NULL;
|
---|
[128] | 1230 | t_bkptype backup_type;
|
---|
| 1231 | int i;
|
---|
[1] | 1232 |
|
---|
[128] | 1233 | newtComponent b1;
|
---|
| 1234 | newtComponent b2;
|
---|
| 1235 | newtComponent b3;
|
---|
| 1236 | newtComponent b4;
|
---|
| 1237 | newtComponent b5;
|
---|
| 1238 | newtComponent b6;
|
---|
| 1239 | newtComponent b7;
|
---|
| 1240 | newtComponent b8;
|
---|
| 1241 | newtComponent b_res;
|
---|
| 1242 | newtComponent myForm;
|
---|
[1] | 1243 |
|
---|
[128] | 1244 | if (g_text_mode) {
|
---|
| 1245 | for (backup_type = none; backup_type == none;) {
|
---|
[541] | 1246 | printf("Backup type (");
|
---|
[128] | 1247 | for (i = 0; possible_responses[i]; i++) {
|
---|
| 1248 | printf("%c%s", (i == 0) ? '\0' : ' ',
|
---|
| 1249 | possible_responses[i]);
|
---|
| 1250 | }
|
---|
| 1251 | printf(")\n--> ");
|
---|
[3191] | 1252 | mr_getline(outstr, stdin);
|
---|
| 1253 | mr_strip_spaces(outstr);
|
---|
[128] | 1254 | for (i = 0; possible_responses[i]; i++) {
|
---|
| 1255 | if (!strcmp(possible_responses[i], outstr)) {
|
---|
| 1256 | backup_type = possible_bkptypes[i];
|
---|
| 1257 | }
|
---|
| 1258 | }
|
---|
[3191] | 1259 | mr_free(outstr);
|
---|
[128] | 1260 | }
|
---|
| 1261 | return (backup_type);
|
---|
| 1262 | }
|
---|
| 1263 | newtDrawRootText(18, 0, WELCOME_STRING);
|
---|
| 1264 | if (restoring) {
|
---|
[3191] | 1265 | mr_asprintf(title_sz, "Please choose the backup media from which you want to read data.");
|
---|
| 1266 | mr_asprintf(minimsg_sz, "Read from:");
|
---|
[128] | 1267 | } else {
|
---|
[3191] | 1268 | mr_asprintf(title_sz, "Please choose the backup media to which you want to archive data.");
|
---|
| 1269 | mr_asprintf(minimsg_sz, "Backup to:");
|
---|
[128] | 1270 | }
|
---|
| 1271 | newtPushHelpLine(title_sz);
|
---|
| 1272 | newtCenteredWindow(34, 17, minimsg_sz);
|
---|
[541] | 1273 | b1 = newtButton(1, 1, "CD-R disks ");
|
---|
| 1274 | b2 = newtButton(17, 1, "CD-RW disks");
|
---|
| 1275 | b3 = newtButton(1, 9, "Tape drive ");
|
---|
[1703] | 1276 | b4 = newtButton(17, 5, "USB Key/Disk");
|
---|
[541] | 1277 | b5 = newtButton(1, 5, " DVD disks ");
|
---|
[2380] | 1278 | b6 = newtButton(17, 9, " Net mount ");
|
---|
[541] | 1279 | b7 = newtButton(1, 13, " Hard disk ");
|
---|
| 1280 | b8 = newtButton(17, 13, " Exit ");
|
---|
[128] | 1281 | myForm = newtForm(NULL, NULL, 0);
|
---|
| 1282 | newtFormAddComponents(myForm, b1, b5, b3, b7, b2, b4, b6, b8,
|
---|
| 1283 | NULL);
|
---|
| 1284 | b_res = newtRunForm(myForm);
|
---|
| 1285 | newtFormDestroy(myForm);
|
---|
| 1286 | newtPopWindow();
|
---|
| 1287 | if (b_res == b1) {
|
---|
| 1288 | output = cdr;
|
---|
| 1289 | } else if (b_res == b2) {
|
---|
| 1290 | output = cdrw;
|
---|
| 1291 | } else if (b_res == b3) {
|
---|
| 1292 | output = tape;
|
---|
| 1293 | } else if (b_res == b4) {
|
---|
[1703] | 1294 | output = usb;
|
---|
[128] | 1295 | } else if (b_res == b5) {
|
---|
| 1296 | output = dvd;
|
---|
| 1297 | } else if (b_res == b6) {
|
---|
[2380] | 1298 | output = netfs;
|
---|
[128] | 1299 | } else if (b_res == b7) {
|
---|
| 1300 | output = iso;
|
---|
| 1301 | } else {
|
---|
| 1302 | output = none;
|
---|
| 1303 | }
|
---|
| 1304 | newtPopHelpLine();
|
---|
[3191] | 1305 | mr_free(title_sz);
|
---|
| 1306 | mr_free(minimsg_sz);
|
---|
[128] | 1307 | return (output);
|
---|
| 1308 | }
|
---|
[1] | 1309 |
|
---|
| 1310 |
|
---|
| 1311 |
|
---|
| 1312 |
|
---|
| 1313 | /**
|
---|
[2771] | 1314 | * Ask the user which compression type they would like to use.
|
---|
[3207] | 1315 | * The choices are "bzip2", "gzip", "lzo", "lzma". NULL for exit
|
---|
[2771] | 1316 | */
|
---|
| 1317 | char *which_compression_type() {
|
---|
| 1318 |
|
---|
| 1319 | /*@ char ************************************************************ */
|
---|
| 1320 | char *output = NULL;
|
---|
| 1321 |
|
---|
| 1322 |
|
---|
| 1323 | /*@ newt ************************************************************ */
|
---|
| 1324 |
|
---|
| 1325 | newtComponent b1;
|
---|
| 1326 | newtComponent b2;
|
---|
| 1327 | newtComponent b3;
|
---|
[3191] | 1328 | newtComponent b4;
|
---|
[2771] | 1329 | newtComponent b5;
|
---|
| 1330 | newtComponent b_res;
|
---|
| 1331 | newtComponent myForm;
|
---|
| 1332 |
|
---|
| 1333 | newtDrawRootText(18, 0, WELCOME_STRING);
|
---|
| 1334 | newtPushHelpLine
|
---|
| 1335 | (" Please specify the type of compression that you want.");
|
---|
| 1336 | newtCenteredWindow(34, 13, "Type of compression?");
|
---|
| 1337 | b1 = newtButton(4, 1, "bzip2");
|
---|
| 1338 | b2 = newtButton(18, 1, "gzip");
|
---|
| 1339 | b3 = newtButton(4, 5, "lzo");
|
---|
[3191] | 1340 | b4 = newtButton(18, 5, "lzma");
|
---|
[2771] | 1341 | b5 = newtButton(4, 9, " Exit ");
|
---|
| 1342 | myForm = newtForm(NULL, NULL, 0);
|
---|
[3207] | 1343 | newtFormAddComponents(myForm, b1, b3, b2, b4, b5, NULL);
|
---|
[2771] | 1344 | b_res = newtRunForm(myForm);
|
---|
| 1345 | newtFormDestroy(myForm);
|
---|
| 1346 | newtPopWindow();
|
---|
| 1347 | if (b_res == b1) {
|
---|
[3185] | 1348 | mr_asprintf(output, "%s", "bzip2");
|
---|
[2771] | 1349 | } else if (b_res == b2) {
|
---|
[3185] | 1350 | mr_asprintf(output, "%s", "gzip");
|
---|
[2771] | 1351 | } else if (b_res == b3) {
|
---|
[3185] | 1352 | mr_asprintf(output, "%s", "lzo");
|
---|
[3191] | 1353 | } else if (b_res == b4) {
|
---|
| 1354 | mr_asprintf(output, "%s", "lzma");
|
---|
[2771] | 1355 | }
|
---|
| 1356 | newtPopHelpLine();
|
---|
| 1357 | return(output);
|
---|
| 1358 | }
|
---|
| 1359 |
|
---|
| 1360 |
|
---|
| 1361 | /**
|
---|
[1] | 1362 | * Ask the user how much compression they would like to use.
|
---|
| 1363 | * The choices are "None" (0), "Minimum" (1), "Average" (4), and "Maximum" (9).
|
---|
| 1364 | * @return The compression level (0-9) chosen, or -1 for "Exit".
|
---|
| 1365 | */
|
---|
[3191] | 1366 | int which_compression_level() {
|
---|
[1] | 1367 |
|
---|
[128] | 1368 | /*@ char ************************************************************ */
|
---|
| 1369 | int output = none;
|
---|
[1] | 1370 |
|
---|
| 1371 |
|
---|
[128] | 1372 | /*@ newt ************************************************************ */
|
---|
[1] | 1373 |
|
---|
[128] | 1374 | newtComponent b1;
|
---|
| 1375 | newtComponent b2;
|
---|
| 1376 | newtComponent b3;
|
---|
| 1377 | newtComponent b4;
|
---|
| 1378 | newtComponent b5;
|
---|
| 1379 | newtComponent b_res;
|
---|
| 1380 | newtComponent myForm;
|
---|
[1] | 1381 |
|
---|
[128] | 1382 | newtDrawRootText(18, 0, WELCOME_STRING);
|
---|
[3191] | 1383 | newtPushHelpLine(" Please specify the level of compression that you want.");
|
---|
[541] | 1384 | newtCenteredWindow(34, 13, "How much compression?");
|
---|
[3114] | 1385 | b1 = newtButton(4, 1, "Maximum (9)");
|
---|
| 1386 | b2 = newtButton(18, 1, "Average (4)");
|
---|
| 1387 | b3 = newtButton(4, 5, "Minimum (1)");
|
---|
| 1388 | b4 = newtButton(18, 5, " None (0) ");
|
---|
[541] | 1389 | b5 = newtButton(4, 9, " Exit ");
|
---|
[128] | 1390 | myForm = newtForm(NULL, NULL, 0);
|
---|
| 1391 | newtFormAddComponents(myForm, b1, b3, b2, b4, b5, NULL);
|
---|
| 1392 | b_res = newtRunForm(myForm);
|
---|
| 1393 | newtFormDestroy(myForm);
|
---|
| 1394 | newtPopWindow();
|
---|
| 1395 | if (b_res == b1) {
|
---|
| 1396 | output = 9;
|
---|
| 1397 | } else if (b_res == b2) {
|
---|
| 1398 | output = 4;
|
---|
| 1399 | } else if (b_res == b3) {
|
---|
| 1400 | output = 1;
|
---|
| 1401 | } else if (b_res == b4) {
|
---|
| 1402 | output = 0;
|
---|
| 1403 | } else if (b_res == b5) {
|
---|
| 1404 | output = -1;
|
---|
| 1405 | }
|
---|
| 1406 | newtPopHelpLine();
|
---|
| 1407 | return (output);
|
---|
| 1408 | }
|
---|
[1] | 1409 |
|
---|
| 1410 |
|
---|
| 1411 |
|
---|
| 1412 |
|
---|
| 1413 |
|
---|
| 1414 | /**
|
---|
| 1415 | * Load @p source_file (a list of files) into @p filelist. There can be no more than
|
---|
| 1416 | * @p ARBITRARY_MAXIMUM entries.
|
---|
| 1417 | * @param filelist The filelist structure to load @p source_file into.
|
---|
| 1418 | * @param source_file The file containing a list of filenames to load into @p filelist.
|
---|
| 1419 | */
|
---|
[3191] | 1420 | int load_filelist_into_array(struct s_filelist *filelist, char *source_file) {
|
---|
| 1421 |
|
---|
[128] | 1422 | int i;
|
---|
[1662] | 1423 | int j = 0;
|
---|
[128] | 1424 | bool done;
|
---|
[3191] | 1425 | char *tmp = NULL;
|
---|
[1662] | 1426 | char *tmp1 = NULL;
|
---|
| 1427 | FILE *fin, *fout;
|
---|
[128] | 1428 | struct s_filelist_entry dummy_fle;
|
---|
[1] | 1429 |
|
---|
[128] | 1430 | assert(filelist != NULL);
|
---|
| 1431 | assert_string_is_neither_NULL_nor_zerolength(source_file);
|
---|
[1] | 1432 |
|
---|
[2230] | 1433 | log_it("entering");
|
---|
[128] | 1434 | if (!(fin = fopen(source_file, "r"))) {
|
---|
| 1435 | log_OS_error(source_file);
|
---|
| 1436 | log_msg(2, "Can't open %s; therefore, cannot popup list",
|
---|
| 1437 | source_file);
|
---|
| 1438 | return (1);
|
---|
| 1439 | }
|
---|
[1662] | 1440 |
|
---|
[3185] | 1441 | mr_asprintf(tmp1,"%s/icantfindthesefiles.txt",bkpinfo->tmpdir);
|
---|
[1662] | 1442 | if (!(fout = fopen(tmp1, "a"))) {
|
---|
| 1443 | log_msg(2, "Can't write to %s", tmp1);
|
---|
[3191] | 1444 | mr_free(tmp1);
|
---|
[1662] | 1445 | return(1);
|
---|
| 1446 | }
|
---|
| 1447 |
|
---|
[128] | 1448 | log_msg(2, "Loading %s", source_file);
|
---|
[3191] | 1449 | for (filelist->entries = 0; filelist->entries <= ARBITRARY_MAXIMUM; ) {
|
---|
| 1450 | mr_free(tmp);
|
---|
[128] | 1451 | if (feof(fin)) {
|
---|
| 1452 | break;
|
---|
| 1453 | }
|
---|
[3191] | 1454 | mr_getline(tmp, fin);
|
---|
[128] | 1455 | i = (int) strlen(tmp);
|
---|
| 1456 | if (i < 2) {
|
---|
[3191] | 1457 | continue;
|
---|
[128] | 1458 | }
|
---|
| 1459 | if (tmp[i - 1] < 32) {
|
---|
| 1460 | tmp[--i] = '\0';
|
---|
| 1461 | }
|
---|
| 1462 | if (i < 2) {
|
---|
[3191] | 1463 | continue;
|
---|
[128] | 1464 | }
|
---|
[1662] | 1465 | if (!does_file_exist(tmp) && !feof(fin)) {
|
---|
| 1466 | j++;
|
---|
| 1467 | fprintf(fout, "%s\n", tmp);
|
---|
[3191] | 1468 | continue;
|
---|
[128] | 1469 | }
|
---|
[3191] | 1470 | filelist->el[filelist->entries].severity = severity_of_difference(tmp, NULL);
|
---|
[128] | 1471 | strcpy(filelist->el[filelist->entries].filename, tmp);
|
---|
| 1472 | if (feof(fin)) {
|
---|
| 1473 | break;
|
---|
| 1474 | }
|
---|
[3191] | 1475 | filelist->entries++;
|
---|
[128] | 1476 | }
|
---|
[3191] | 1477 | mr_free(tmp);
|
---|
[128] | 1478 | paranoid_fclose(fin);
|
---|
[1662] | 1479 | paranoid_fclose(fout);
|
---|
| 1480 | if (j > 0) {
|
---|
| 1481 | log_to_screen("%d files listed in %s/changed.files have been deleted since backup was made\nand are referenced in %s", j, bkpinfo->tmpdir,tmp1);
|
---|
| 1482 | }
|
---|
[3191] | 1483 | mr_free(tmp1);
|
---|
[128] | 1484 | if (filelist->entries >= ARBITRARY_MAXIMUM) {
|
---|
[541] | 1485 | log_to_screen("Arbitrary limits suck, man!");
|
---|
[128] | 1486 | return (1);
|
---|
| 1487 | }
|
---|
| 1488 | for (done = FALSE; !done;) {
|
---|
| 1489 | done = TRUE;
|
---|
| 1490 | for (i = 0; i < filelist->entries - 1; i++) {
|
---|
[1] | 1491 | // if (strcmp(filelist->el[i].filename, filelist->el[i+1].filename) > 0)
|
---|
[128] | 1492 | if (filelist->el[i].severity < filelist->el[i + 1].severity
|
---|
| 1493 | || (filelist->el[i].severity ==
|
---|
| 1494 | filelist->el[i + 1].severity
|
---|
| 1495 | && strcmp(filelist->el[i].filename,
|
---|
| 1496 | filelist->el[i + 1].filename) > 0)) {
|
---|
| 1497 | memcpy((void *) &dummy_fle,
|
---|
| 1498 | (void *) &(filelist->el[i]),
|
---|
| 1499 | sizeof(struct s_filelist_entry));
|
---|
| 1500 | memcpy((void *) &(filelist->el[i]),
|
---|
| 1501 | (void *) &(filelist->el[i + 1]),
|
---|
| 1502 | sizeof(struct s_filelist_entry));
|
---|
| 1503 | memcpy((void *) &(filelist->el[i + 1]),
|
---|
| 1504 | (void *) &dummy_fle,
|
---|
| 1505 | sizeof(struct s_filelist_entry));
|
---|
| 1506 | log_msg(2, "Swapping %s and %s",
|
---|
| 1507 | filelist->el[i].filename,
|
---|
| 1508 | filelist->el[i + 1].filename);
|
---|
| 1509 | done = FALSE;
|
---|
| 1510 | }
|
---|
| 1511 | }
|
---|
| 1512 | }
|
---|
[2230] | 1513 | log_it("leaving");
|
---|
[128] | 1514 | return (0);
|
---|
| 1515 | }
|
---|
[1] | 1516 |
|
---|
| 1517 |
|
---|
| 1518 | /**
|
---|
| 1519 | * Generate a pretty string based on @p flentry.
|
---|
| 1520 | * @param flentry The filelist entry to stringify.
|
---|
| 1521 | * @return The string form of @p flentry.
|
---|
| 1522 | * @note The returned value points to static storage that will be overwritten with each call.
|
---|
| 1523 | */
|
---|
[3191] | 1524 | char *filelist_entry_to_string(struct s_filelist_entry *flentry) {
|
---|
[128] | 1525 | static char comment[100];
|
---|
[2211] | 1526 | char *tmp = NULL;
|
---|
[1] | 1527 |
|
---|
[3191] | 1528 | log_msg(8, "entering");
|
---|
[128] | 1529 | assert(flentry != NULL);
|
---|
| 1530 | if (flentry->severity == 0) {
|
---|
[3185] | 1531 | mr_asprintf(tmp, "0 ");
|
---|
[128] | 1532 | } else if (flentry->severity == 1) {
|
---|
[3185] | 1533 | mr_asprintf(tmp, "low ");
|
---|
[128] | 1534 | } else if (flentry->severity == 2) {
|
---|
[3185] | 1535 | mr_asprintf(tmp, "med ");
|
---|
[128] | 1536 | } else {
|
---|
[3185] | 1537 | mr_asprintf(tmp, "high");
|
---|
[128] | 1538 | }
|
---|
[2211] | 1539 | mr_strcat(tmp, " ");
|
---|
| 1540 | mr_strcat(tmp, flentry->filename);
|
---|
| 1541 | strncpy(comment, tmp, 99);
|
---|
[3191] | 1542 | mr_free(tmp);
|
---|
[2211] | 1543 |
|
---|
[2230] | 1544 | log_it("leaving");
|
---|
[128] | 1545 | return (comment);
|
---|
| 1546 | }
|
---|
[1] | 1547 |
|
---|
| 1548 |
|
---|
| 1549 | /**
|
---|
| 1550 | * Pop up a list containing the filenames in @p source_file and the severity if they have changed since the
|
---|
| 1551 | * last backup. There can be no more than @p ARBITRARY_MAXIMUM files in @p source_file.
|
---|
| 1552 | * @param source_file The file containing a list of changed files.
|
---|
| 1553 | */
|
---|
[3191] | 1554 | void popup_changelist_from_file(char *source_file) {
|
---|
| 1555 |
|
---|
| 1556 | char *reason = NULL;
|
---|
[128] | 1557 | newtComponent myForm;
|
---|
| 1558 | newtComponent bClose;
|
---|
| 1559 | newtComponent bSelect;
|
---|
| 1560 | newtComponent b_res;
|
---|
| 1561 | newtComponent fileListbox;
|
---|
| 1562 | newtComponent headerMsg;
|
---|
[1] | 1563 |
|
---|
[128] | 1564 | /*@ ???? ************************************************************ */
|
---|
| 1565 | void *curr_choice;
|
---|
| 1566 | void *keylist[ARBITRARY_MAXIMUM];
|
---|
[1] | 1567 |
|
---|
[128] | 1568 | /*@ int ************************************************************* */
|
---|
| 1569 | int currline = 0;
|
---|
| 1570 | int finished = FALSE;
|
---|
[738] | 1571 |
|
---|
| 1572 | /*@ long ************************************************************ */
|
---|
| 1573 | long i = 0;
|
---|
[128] | 1574 | long lng = 0;
|
---|
[1] | 1575 |
|
---|
[128] | 1576 | /*@ buffers ********************************************************* */
|
---|
[3191] | 1577 | char *tmp = NULL;
|
---|
| 1578 | char *differ_sz = NULL;
|
---|
[1] | 1579 |
|
---|
[128] | 1580 | struct s_filelist *filelist;
|
---|
| 1581 | assert_string_is_neither_NULL_nor_zerolength(source_file);
|
---|
| 1582 | if (g_text_mode) {
|
---|
| 1583 | log_msg(2, "Text mode. Therefore, no popup list.");
|
---|
[3191] | 1584 | return;
|
---|
[128] | 1585 | }
|
---|
| 1586 | log_msg(2, "Examining file %s", source_file);
|
---|
[1] | 1587 |
|
---|
[128] | 1588 | lng = count_lines_in_file(source_file);
|
---|
| 1589 | if (lng < 1) {
|
---|
| 1590 | log_msg(2, "No lines in file. Therefore, no popup list.");
|
---|
[3191] | 1591 | return;
|
---|
[128] | 1592 | } else if (lng >= ARBITRARY_MAXIMUM) {
|
---|
| 1593 | log_msg(2, "Too many files differ for me to list.");
|
---|
[3191] | 1594 | return;
|
---|
[128] | 1595 | }
|
---|
[1] | 1596 |
|
---|
[128] | 1597 | filelist = (struct s_filelist *) malloc(sizeof(struct s_filelist));
|
---|
| 1598 | fileListbox =
|
---|
| 1599 | newtListbox(2, 2, 12, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
|
---|
| 1600 | newtListboxClear(fileListbox);
|
---|
[1] | 1601 |
|
---|
[128] | 1602 | if (load_filelist_into_array(filelist, source_file)) {
|
---|
[3191] | 1603 | log_msg(2, "Can't open %s; therefore, cannot popup list", source_file);
|
---|
[128] | 1604 | return;
|
---|
| 1605 | }
|
---|
[3191] | 1606 | log_msg(2, "%d files loaded into filelist array", filelist->entries);
|
---|
[128] | 1607 | for (i = 0; i < filelist->entries; i++) {
|
---|
| 1608 | keylist[i] = (void *) i;
|
---|
| 1609 | newtListboxAppendEntry(fileListbox,
|
---|
| 1610 | filelist_entry_to_string(&
|
---|
| 1611 | (filelist->
|
---|
| 1612 | el[i])),
|
---|
| 1613 | keylist[i]);
|
---|
| 1614 | }
|
---|
[3191] | 1615 | mr_asprintf(differ_sz, " %ld files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.", i);
|
---|
[128] | 1616 | newtPushHelpLine(differ_sz);
|
---|
[3191] | 1617 | mr_free(differ_sz);
|
---|
| 1618 |
|
---|
[541] | 1619 | bClose = newtCompactButton(10, 15, " Close ");
|
---|
| 1620 | bSelect = newtCompactButton(30, 15, " Select ");
|
---|
[3191] | 1621 | mr_asprintf(tmp, "%-10s %-20s", "Priority", "Filename");
|
---|
[128] | 1622 | headerMsg = newtLabel(2, 1, tmp);
|
---|
[3191] | 1623 | mr_free(tmp);
|
---|
| 1624 |
|
---|
[541] | 1625 | newtOpenWindow(5, 4, 70, 16, "Non-matching files");
|
---|
[128] | 1626 | myForm = newtForm(NULL, NULL, 0);
|
---|
[3191] | 1627 | newtFormAddComponents(myForm, headerMsg, fileListbox, bClose, bSelect, NULL);
|
---|
| 1628 |
|
---|
[128] | 1629 | while (!finished) {
|
---|
| 1630 | b_res = newtRunForm(myForm);
|
---|
| 1631 | if (b_res == bClose) {
|
---|
| 1632 | finished = TRUE;
|
---|
| 1633 | } else {
|
---|
| 1634 | curr_choice = newtListboxGetCurrent(fileListbox);
|
---|
| 1635 | for (i = 0;
|
---|
| 1636 | i < filelist->entries && keylist[i] != curr_choice;
|
---|
| 1637 | i++);
|
---|
| 1638 | if (i == filelist->entries && filelist->entries > 0) {
|
---|
[541] | 1639 | log_to_screen("I don't know what that button does!");
|
---|
[128] | 1640 | } else {
|
---|
| 1641 | currline = i;
|
---|
| 1642 | if (filelist->entries > 0) {
|
---|
[3191] | 1643 | malloc_string(reason);
|
---|
[3194] | 1644 | severity_of_difference(filelist->el[currline].filename, &reason);
|
---|
[3191] | 1645 | mr_asprintf(tmp, "%s --- %s", filelist->el[currline].filename, reason);
|
---|
| 1646 |
|
---|
[128] | 1647 | popup_and_OK(tmp);
|
---|
[3191] | 1648 | mr_free(tmp);
|
---|
| 1649 | paranoid_free(reason);
|
---|
[128] | 1650 | }
|
---|
| 1651 | }
|
---|
| 1652 | }
|
---|
| 1653 | }
|
---|
| 1654 | newtFormDestroy(myForm);
|
---|
| 1655 | newtPopWindow();
|
---|
| 1656 | newtPopHelpLine();
|
---|
| 1657 | return;
|
---|
[1] | 1658 | }
|
---|
| 1659 |
|
---|
| 1660 | /* @} - end of guiGroup */
|
---|
| 1661 |
|
---|
| 1662 |
|
---|
| 1663 | #if __cplusplus
|
---|
[128] | 1664 | } /* extern "C" */
|
---|
[1] | 1665 | #endif
|
---|