- Timestamp:
- Mar 7, 2024, 12:52:46 AM (4 months ago)
- Location:
- branches/3.3/mondo/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mondo/src/common/libmondo-archive.c
r3856 r3858 2981 2981 2982 2982 /*@ buffers ************************************************** */ 2983 char *tmp; 2984 2985 malloc_string(tmp); 2983 char *tmp = NULL; 2984 2986 2985 assert(bkpinfo != NULL); 2987 2988 // I should really check if there are any slices or tarballs to be copied to CD-R(W)'s; the odds are approx. 1 in a million that there are no files here, so I'll just go ahead & make one more CD anyway 2989 2990 sprintf(tmp, "Writing the final ISO"); 2986 // I should really check if there are any slices or tarballs to be copied to CD-R(W)'s; the odds are approx. 1 in a million that there are no files here, so I'll just go ahead & make one more CD anyway 2987 2988 tmp = mr_center_string("Writing the final ISO", 80); 2991 2989 log_msg(2, tmp); 2992 center_string(tmp, 80);2993 2990 if (!g_text_mode) { 2994 2991 newtPushHelpLine(tmp); 2995 2992 } 2993 mr_free(tmp); 2996 2994 res = write_iso_and_go_on(TRUE); 2997 2995 if (!g_text_mode) { … … 2999 2997 } 3000 2998 log_msg(2, "Returning from writing final ISO (res=%d)", res); 3001 paranoid_free(tmp);3002 2999 return (res); 3003 3000 } -
branches/3.3/mondo/src/common/libmondo-fifo.c
r3840 r3858 106 106 } 107 107 if (bufsize) { 108 mr_asprintf(g_call_to_buffer, 109 "buffer -m %d%c -p%d -B -s%ld -%c %s 2>> %s", bufsize, 'm', 108 mr_asprintf(g_call_to_buffer, "buffer -m %d%c -p%d -B -s%ld -%c %s 2>> %s", bufsize, 'm', 110 109 (direction == 'r') ? 20 : 75, internal_tape_block_size, 111 110 keych, device, MONDO_LOGFILE); -
branches/3.3/mondo/src/common/libmondo-string-EXT.h
r3855 r3858 5 5 extern char *build_partition_name(char *partition, const char *drive, 6 6 int partno); 7 extern void center_string(char *in_out, int width);8 7 extern char *commarize(char *); 9 8 extern char *disklist_entry_to_string(struct list_of_disks *disklist, -
branches/3.3/mondo/src/common/libmondo-string.c
r3851 r3858 73 73 /** 74 74 * Pad a string on both sides so it appears centered. 75 * @param in _outThe string to be center-padded (modified).75 * @param in The string to be center-padded (modified). 76 76 * @param width The width of the final result. 77 77 */ … … 106 106 return(out); 107 107 } 108 109 /**110 * Pad a string on both sides so it appears centered.111 * @param in_out The string to be center-padded (modified).112 * @param width The width of the final result.113 */114 void center_string(char *in_out, int width)115 {116 char scratch[MAX_STR_LEN];117 char *p;118 int i; /* purpose */119 int len; /* purpose */120 int mid; /* purpose */121 int x; /* purpose */122 123 assert(in_out != NULL);124 assert(width > 2);125 126 if (strlen(in_out) == 0) {127 return;128 }129 for (p = in_out; *p == ' '; p++);130 strcpy(scratch, p);131 strip_spaces(scratch);132 len = (int) strlen(scratch);133 mid = width / 2;134 x = mid - len / 2;135 for (i = 0; i < x; i++) {136 in_out[i] = ' ';137 }138 in_out[i] = '\0';139 strcat(in_out, scratch);140 for (i = x + len ; i < width - 1; i++) {141 in_out[i] = ' ';142 }143 in_out[i] = '\0';144 }145 146 108 147 109 /** … … 235 197 * @return The left-padded string. 236 198 * @note The returned string points to static storage that will be overwritten with each call. 237 * @bug Why does center_string() modify its argument but leftpad_string() returns a modified copy?238 199 */ 239 200 char *leftpad_string(char *incoming, int width) -
branches/3.3/mondo/src/common/libmondo-string.h
r3552 r3858 4 4 5 5 char *build_partition_name(char *partition, const char *drive, int partno); 6 void center_string(char *in_out, int width);7 6 char *commarize(char *); 8 7 char *disklist_entry_to_string(struct list_of_disks *disklist, int lino); -
branches/3.3/mondo/src/common/libmondo-verify.h
r1713 r3858 91 91 extern bool ask_me_yes_or_no(char *); 92 92 extern char *calc_checksum_of_file(char *filename); 93 extern void center_string(char *, int);94 93 extern void close_evalcall_form(void); 95 94 extern int closein_tape(); -
branches/3.3/mondo/src/common/newt-specific-EXT.h
r3852 r3858 23 23 extern void update_evalcall_form(int curr); 24 24 extern void update_progress_form(char *blurb3); 25 extern void update_progress_form_full(char *blurb1, char *blurb2,26 char *blurb3);27 28 29 30 31 25 32 26 extern t_bkptype which_backup_media_type(bool); -
branches/3.3/mondo/src/common/newt-specific.c
r3856 r3858 61 61 extern bool g_fail_immediately; 62 62 63 /**64 * Padding below the Newt components, to overcome bugs in Newt.65 */66 char g_haharrrrr[500];67 68 69 63 newtComponent g_timeline = NULL, ///< The line of the progress form that shows the time elapsed/remaining 70 64 g_percentline = NULL, ///< The line of the progress form that shows the percent completed/remaining … … 76 70 g_label = NULL; ///< ????? @bug ????? 77 71 78 /**79 * Padding above the Newt components, to overcome bugs in Newt.80 */81 char g_jim_lad_yarr[500];82 72 char **err_log_lines = NULL, ///< The list of log lines to show on the screen. 83 73 g_blurb_str_1[MAX_NEWT_COMMENT_LEN] = "", ///< The string for line 1 of the blurb in the progress form … … 91 81 long g_isoform_starttime; ///< The time (in seconds since the epoch) that the evalcall form was opened. 92 82 int g_isoform_old_progress = -1; ///< The most recent progress update of the evalcall form (percent). 93 char g_isoform_header_str [MAX_STR_LEN] = " "; ///< The string for the evalcall form title.83 char g_isoform_header_str = NULL; ///< The string for the evalcall form title. 94 84 int g_mysterious_dot_counter; ///< The counter for the twirling baton (/ | \\ - ...) on percentage less than 3 95 85 int g_noof_log_lines = 6; ///< The number of lines to show in the log at the bottom of the screen. … … 446 436 paranoid_free(bkpinfo); 447 437 438 /* free global vars */ 439 mr_free(g_isoform_header_str); 440 448 441 free_libmondo_global_strings(); 449 442 free_newt_stuff(); … … 614 607 615 608 assert(ttl != NULL); 616 malloc_string(tmp); 617 strcpy(g_isoform_header_str, ttl); 609 //strcpy(g_isoform_header_str, ttl); 618 610 if (g_text_mode) { 619 611 log_msg(0, ttl); 620 612 } else { 621 strcpy(tmp, ttl); 622 center_string(tmp, 80); 613 tmp = mr_center_string(ttl, 80); 623 614 newtPushHelpLine(tmp); 624 } 625 center_string(g_isoform_header_str, 36); 615 mr_free(tmp); 616 } 617 mr_free(g_isoform_header_str); 618 g_isoform_header_str = mr_center_string(ttl, 36); 626 619 g_isoform_starttime = get_time(); 627 620 if (g_text_mode) { … … 644 637 } 645 638 update_evalcall_form(0); 646 paranoid_free(tmp);647 639 } 648 640 … … 661 653 662 654 /*@ buffers ********************************************************* */ 663 char *b1c ;655 char *b1c = NULL; 664 656 char *blurb1 = NULL; 665 657 char *blurb2 = NULL; … … 668 660 /*@ initialize ****************************************************** */ 669 661 g_mysterious_dot_counter = 0; 670 671 malloc_string(b1c);672 662 673 663 assert(title != NULL); … … 683 673 strcpy(blurb3, b3); 684 674 685 strcpy(b1c, b1); 686 center_string(b1c, 80); 675 b1c = mr_center_string(b1c, 80); 687 676 if (max_val <= 0) { 688 677 max_val = 1; … … 714 703 } 715 704 update_progress_form_full(blurb1, blurb2, blurb3); 716 paranoid_free(b1c);705 mr_free(b1c); 717 706 paranoid_free(blurb1); 718 707 paranoid_free(blurb2); … … 836 825 } 837 826 838 blurb = malloc(MAX_NEWT_COMMENT_LEN); 839 strcpy(blurb, b); 840 text = newtTextboxReflowed(2, 1, blurb, 48, 5, 5, 0); 827 text = newtTextboxReflowed(2, 1, b, 48, 5, 5, 0); 841 828 mr_asprintf(original_contents, "%s", output); 842 829 output[0] = '\0'; … … 853 840 myForm = newtForm(NULL, NULL, 0); 854 841 newtFormAddComponents(myForm, text, type_here, b_1, b_2, NULL); 855 center_string(blurb, 80);842 blurb = mr_center_string(b, 80); 856 843 newtPushHelpLine(blurb); 844 mr_free(blurb); 857 845 b_res = newtRunForm(myForm); 858 846 strcpy(output, entry_value); … … 860 848 newtFormDestroy(myForm); 861 849 newtPopWindow(); 862 paranoid_free(blurb);863 850 864 851 if (b_res == b_2) { … … 916 903 } 917 904 905 /* not sure it's useful to shrink here 918 906 prompt = malloc(MAX_NEWT_COMMENT_LEN); 919 907 strncpy(prompt, p, MAX_NEWT_COMMENT_LEN - 1); 920 908 prompt[MAX_NEWT_COMMENT_LEN - 1] = '\0'; 921 909 text = newtTextboxReflowed(1, 1, prompt, 40, 5, 5, 0); 910 */ 911 text = newtTextboxReflowed(1, 1, p, 40, 5, 5, 0); 922 912 b_1 = newtButton(20 - ((button2[0] != '\0') ? strlen(button1) + 2 : strlen(button1) / 2), newtTextboxGetNumLines(text) + 3, button1); 923 913 if (button2[0] != '\0') { … … 929 919 myForm = newtForm(NULL, NULL, 0); 930 920 newtFormAddComponents(myForm, text, b_1, b_2, NULL); 931 center_string(prompt, 80);921 prompt = mr_center_string(p, 80); 932 922 newtPushHelpLine(prompt); 923 mr_free(prompt); 933 924 b_res = newtRunForm(myForm); 934 925 newtPopHelpLine(); … … 936 927 newtPopWindow(); 937 928 if (b_res == b_1) { 938 paranoid_free(prompt);939 929 return (TRUE); 940 930 } else { 941 paranoid_free(prompt);942 931 return (FALSE); 943 932 } … … 1139 1128 long time_total_est = 0L; 1140 1129 1130 char *blurb1_str = NULL; 1131 char *blurb2_str = NULL; 1132 char *blurb3_str = NULL; 1133 1141 1134 /*@ int ******************************************************* */ 1142 1135 int percentage = 0; … … 1201 1194 mr_asprintf(percentline_str, " %3d%% done %3d%% to go", percentage, 100 - percentage); 1202 1195 1203 center_string(blurb1, 54);1204 center_string(blurb2, 54);1205 center_string(blurb3, 54);1196 blurb1_str = mr_center_string(blurb1, 54); 1197 blurb2_str = mr_center_string(blurb2, 54); 1198 blurb3_str = mr_center_string(blurb3, 54); 1206 1199 if (g_blurb1) { 1207 newtLabelSetText(g_blurb1, blurb1 );1200 newtLabelSetText(g_blurb1, blurb1_str); 1208 1201 } 1209 1202 if (g_blurb2) { 1210 newtLabelSetText(g_blurb2, blurb3); 1203 // Not a typo but ridiculous ! 1204 newtLabelSetText(g_blurb2, blurb3_str); 1211 1205 } 1212 1206 if (g_blurb3) { 1213 newtLabelSetText(g_blurb3, blurb2); 1207 // Not a typo but ridiculous ! 1208 newtLabelSetText(g_blurb3, blurb2_str); 1214 1209 } 1215 1210 newtScaleSet(g_scale, (unsigned long long) g_current_progress); … … 1223 1218 } 1224 1219 mr_free(percentline_str); 1220 mr_free(blurb1_str); 1221 mr_free(blurb2_str); 1222 mr_free(blurb3_str); 1225 1223 1226 1224 newtDrawForm(g_progressForm); -
branches/3.3/mondo/src/mondorestore/mondo-rstr-newt.h
r3158 r3858 39 39 extern long get_time(void); 40 40 extern char *last_line_of_file(char *); 41 extern void center_string(char *, int);42 41 extern bool does_file_exist(char *); 43 42 extern void finish(int); … … 181 180 void update_evalcall_form(int); 182 181 void update_progress_form(char *); 183 void update_progress_form_full(char *, char *, char *);184 182 char which_restore_mode(void); 185 183 void write_variableINT_to_raid_var_line(struct raid_device_record *, int,
Note:
See TracChangeset
for help on using the changeset viewer.