- Timestamp:
- Oct 27, 2005, 10:03:00 PM (20 years ago)
- Location:
- trunk/mondo
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/configure.in
r41 r87 89 89 #x86_64*) 90 90 ARCH=i386 91 CPPFLAGS="$CPPFLAGS -D__IA32__ "91 CPPFLAGS="$CPPFLAGS -D__IA32__ -Wall" 92 92 ;; 93 93 ia64*) 94 94 ARCH=ia64 95 CPPFLAGS="$CPPFLAGS -D__IA64__ "95 CPPFLAGS="$CPPFLAGS -D__IA64__ -Wall" 96 96 ;; 97 97 *) … … 140 140 AC_TYPE_SIGNAL 141 141 AC_FUNC_VPRINTF 142 AC_CHECK_FUNCS([bzero getcwd memmove memset mkdir mkfifo setenv strcasecmp strchr strerror strrchr strstr ])142 AC_CHECK_FUNCS([bzero getcwd memmove memset mkdir mkfifo setenv strcasecmp strchr strerror strrchr strstr getline asprintf trunc vasprintf]) 143 143 144 144 if test -n "$qt_includes"; then -
trunk/mondo/mondo/common/libmondo-archive.c
r75 r87 2 2 3 3 subroutines to handle the archiving of files 4 5 4 */ 6 5 … … 514 513 * - @c media_size 515 514 * - @c nonbootable_backup 516 * - @c scratchdir517 515 * - @c tmpdir 518 516 * - @c use_lzo … … 528 526 /*@ buffer ************************************************************ */ 529 527 char *tmp; 530 char *scratchdir;531 528 char *command; 532 529 char *use_lzo_sz; … … 871 868 872 869 // popup_and_OK("Pausing"); 873 874 870 res = run_program_and_log_to_screen(command, 875 871 "Generating boot+data disks"); … … 1508 1504 (misc_counter_that_is_not_important + 1) % 5; 1509 1505 /* BERLIOS: media_usage_comment was NOT initialized !!! */ 1510 /* maybe : */ 1511 asprintf(&media_usage_comment, "%s", 1512 percent_media_full_comment(bkpinfo)); 1506 /* maybe */ 1507 tmp = percent_media_full_comment(bkpinfo); 1508 asprintf(&media_usage_comment, "%s", tmp); 1509 paranoid_free(tmp); 1513 1510 if (!misc_counter_that_is_not_important) { 1514 1511 update_progress_form(media_usage_comment); … … 1535 1532 sleep(5); 1536 1533 } 1537 asprintf(&media_usage_comment, "%s", 1538 percent_media_full_comment(bkpinfo)); 1534 tmp = percent_media_full_comment(bkpinfo); 1535 asprintf(&media_usage_comment, "%s", tmp); 1536 paranoid_free(tmp); 1539 1537 /* copy to CD (scratchdir) ... and an actual CD-R if necessary */ 1540 1538 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { … … 1644 1642 char *message_to_screen; 1645 1643 char *sz_blank_disk; 1646 char *fnam;1647 1644 char *tmp2; 1648 1645 char *tmp3; … … 2186 2183 } 2187 2184 2188 asprintf(&media_usage_comment, "%s", 2189 percent_media_full_comment(bkpinfo)); 2185 tmp = percent_media_full_comment(bkpinfo); 2186 asprintf(&media_usage_comment, "%s", tmp); 2187 paranoid_free(tmp); 2190 2188 2191 2189 /* copy to CD (scratchdir) ... and an actual CD-R if necessary */ … … 3167 3165 bkpinfo->tmpdir, suffix)); 3168 3166 3169 asprintf(&tmp, "%s", percent_media_full_comment(bkpinfo));3167 tmp = percent_media_full_comment(bkpinfo); 3170 3168 update_progress_form(tmp); 3171 3169 paranoid_free(tmp); … … 3380 3378 asprintf(&tmp, "Writing the final ISO"); 3381 3379 log_msg(2, tmp); 3382 /* BERLIOS: that function seems strange to me3383 3384 3380 /* BERLIOS: center_string is now broken 3381 center_string(tmp, 80); 3382 */ 3385 3383 #ifndef _XWIN 3386 3384 if (!g_text_mode) { -
trunk/mondo/mondo/common/libmondo-devices.c
r86 r87 2213 2213 ("I, Mojo Jojo, shall defeat those pesky Powerpuff Girls!"); 2214 2214 } 2215 2216 2215 if (archiving_to_media) { 2217 2216 … … 2364 2363 log_it("boot_device = '%s' (loader=%c)", bkpinfo->boot_device, 2365 2364 bkpinfo->boot_loader); 2365 log_it("prefix = %s", bkpinfo->prefix); 2366 2366 if (bkpinfo->media_size[0] < 0) { 2367 2367 if (archiving_to_media) { … … 2892 2892 char *command; 2893 2893 char *fdisk; 2894 struct stat buf;2895 2894 2896 2895 malloc_string(tmp); … … 2900 2899 // BERLIOS: Do that temporarily: we need to put back parted2fdisk everywhere 2901 2900 #ifdef __IA64__ 2901 struct stat buf; 2902 2902 2903 sprintf(fdisk, "/usr/local/bin/fdisk"); 2903 2904 if (stat(fdisk, &buf) != 0) { -
trunk/mondo/mondo/common/libmondo-filelist.c
r59 r87 1337 1337 /*@ int **************************************************** */ 1338 1338 int res = 0; 1339 // patch by Herman Kuster1340 // end patch1341 1339 int *p_res = &res; 1342 1340 1343 1341 /*@ buffers ************************************************ */ 1344 // char command[MAX_STR_LEN*2];1345 1346 /*@ i don't have any idea ********************************** */1347 1342 1348 1343 assert(bkpinfo != NULL); -
trunk/mondo/mondo/common/libmondo-files.c
r59 r87 699 699 * @return The return value of @c mkdir. 700 700 */ 701 /* BERLIOS: This function shouldn't call system at all */ 701 702 int make_hole_for_dir(char *outdir_fname) 702 703 { … … 717 718 * @bug Return value unnecessary. 718 719 */ 720 /* BERLIOS: This function shouldn't call system at all */ 719 721 int make_hole_for_file(char *outfile_fname) 720 722 { … … 1310 1312 sprintf(tmp, 1311 1313 "Your backup will probably occupy a single CD/tape/ISO. Maybe two."); 1312 } else if (scratchLL > 4) {1313 sprintf(tmp,1314 "Your backup will occupy one meeeeellion media! (maybe %s)",1315 number_to_text((int) (scratchLL + 1)));1316 1314 } else { 1317 1315 sprintf(tmp, "Your backup will occupy approximately %s media.", -
trunk/mondo/mondo/common/libmondo-mountlist.c
r59 r87 381 381 char *tmp; 382 382 char *device; 383 char *mountpoint;384 383 385 384 /*@ long *********************************************************** */ -
trunk/mondo/mondo/common/libmondo-raid.c
r45 r87 905 905 char *stub; 906 906 char *incoming = NULL; 907 char *raid_devname;908 907 char *p, *q, *r; 909 908 int diskno; -
trunk/mondo/mondo/common/libmondo-string.c
r58 r87 68 68 /** 69 69 * Pad a string on both sides so it appears centered. 70 * @param in_out The string to be center-padded (modified). 70 * @param in_out The string to be center-padded (modified). The caller needs to free this string 71 71 * @param width The width of the final result. 72 72 */ … … 74 74 { 75 75 char *scratch; 76 char *out; 76 77 char *p; 77 78 int i; /* purpose */ … … 87 88 } 88 89 for (p = in_out; *p == ' '; p++); 89 asprintf(&scratch, "%s",p);90 asprintf(&scratch, p); 90 91 len = (int) strlen(scratch); 91 92 mid = width / 2; … … 95 96 } 96 97 in_out[i] = '\0'; 97 strcat(in_out, scratch);98 asprintf(&out, "%s%s", in_out, scratch); 98 99 paranoid_free(scratch); 100 in_out = out; 99 101 } 100 102 … … 863 865 int severity_of_difference(char *fn, char *out_reason) 864 866 { 865 int sev ;867 int sev = 0; 866 868 char *reason; 867 869 char *filename; 868 870 869 malloc_string(reason); 870 // out_reason might be null on purpose, so don't bomb if it is :) OK? 871 // out_reason might be null on purpose, so don't bomb if it is :) OK? 871 872 assert_string_is_neither_NULL_nor_zerolength(fn); 872 873 if (!strncmp(fn, MNT_RESTORING, strlen(MNT_RESTORING))) { … … 878 879 } 879 880 880 sev = 3;881 sprintf(reason,882 "Changed since backup. Consider running a differential backup in a day or two.");883 881 if (!strncmp(filename, "/var/", 5)) { 884 882 sev = 2; 885 sprintf(reason,883 asprintf(&reason, 886 884 "/var's contents will change regularly, inevitably."); 887 885 } 888 886 if (!strncmp(filename, "/home", 5)) { 889 887 sev = 2; 890 sprintf(reason,888 asprintf(&reason, 891 889 "It's in your /home partiton. Therefore, it is important."); 892 890 } 893 891 if (!strncmp(filename, "/usr/", 5)) { 894 892 sev = 3; 895 sprintf(reason,893 asprintf(&reason, 896 894 "You may have installed/removed software during the backup."); 897 895 } 898 896 if (!strncmp(filename, "/etc/", 5)) { 899 897 sev = 3; 900 sprintf(reason,898 asprintf(&reason, 901 899 "Do not edit config files while backing up your PC."); 902 900 } … … 904 902 || !strcmp(filename, "/etc/mtab")) { 905 903 sev = 1; 906 sprintf(reason, "This file changes all the time. It's OK.");904 asprintf(&reason, "This file changes all the time. It's OK."); 907 905 } 908 906 if (!strncmp(filename, "/root/", 6)) { 909 907 sev = 3; 910 sprintf(reason, "Were you compiling/editing something in /root?");908 asprintf(&reason, "Were you compiling/editing something in /root?"); 911 909 } 912 910 if (!strncmp(filename, "/root/.", 7)) { 913 911 sev = 2; 914 sprintf(reason, "Temp or 'dot' files changed in /root.");912 asprintf(&reason, "Temp or 'dot' files changed in /root."); 915 913 } 916 914 if (!strncmp(filename, "/var/lib/", 9)) { 917 915 sev = 2; 918 sprintf(reason, "Did you add/remove software during backing?");916 asprintf(&reason, "Did you add/remove software during backing?"); 919 917 } 920 918 if (!strncmp(filename, "/var/lib/rpm", 12)) { 921 919 sev = 3; 922 sprintf(reason, "Did you add/remove software during backing?");920 asprintf(&reason, "Did you add/remove software during backing?"); 923 921 } 924 922 if (!strncmp(filename, "/var/lib/slocate", 16)) { 925 923 sev = 1; 926 sprintf(reason,924 asprintf(&reason, 927 925 "The 'update' daemon ran during backup. This does not affect the integrity of your backup."); 928 926 } … … 931 929 || !strcmp(filename + strlen(filename) - 4, ".log")) { 932 930 sev = 1; 933 sprintf(reason,931 asprintf(&reason, 934 932 "Log files change frequently as the computer runs. Fret not."); 935 933 } 936 934 if (!strncmp(filename, "/var/spool", 10)) { 937 935 sev = 1; 938 sprintf(reason,936 asprintf(&reason, 939 937 "Background processes or printers were active. This does not affect the integrity of your backup."); 940 938 } 941 939 if (!strncmp(filename, "/var/spool/mail", 10)) { 942 940 sev = 2; 943 sprintf(reason, "Mail was sent/received during backup.");941 asprintf(&reason, "Mail was sent/received during backup."); 944 942 } 945 943 if (filename[strlen(filename) - 1] == '~') { 946 944 sev = 1; 947 sprintf(reason,945 asprintf(&reason, 948 946 "Backup copy of another file which was modified recently."); 949 947 } 950 948 if (strstr(filename, "cache")) { 951 949 sev = 1; 952 sprintf(reason,950 asprintf(&reason, 953 951 "Part of a cache of data. Caches change from time to time. Don't worry."); 954 952 } … … 958 956 || strstr(filename, "/.Xauthority")) { 959 957 sev = 1; 960 sprintf(reason,958 asprintf(&reason, 961 959 "Temporary file (a lockfile, perhaps) used by software such as X or KDE to register its presence."); 962 960 } 963 961 paranoid_free(filename); 964 962 965 if (out_reason) { 966 strcpy(out_reason, reason); 967 } 968 paranoid_free(reason); 963 if (sev == 0) { 964 sev = 3; 965 asprintf(&reason, 966 "Changed since backup. Consider running a differential backup in a day or two."); 967 } 968 969 out_reason = reason; 969 970 return (sev); 970 971 } … … 1000 1001 * - @c bkpinfo->media_size 1001 1002 * - @c bkpinfo->scratchdir 1002 * @return The string indicating media fill. 1003 * @return The string indicating media fill. Needs to be freed by caller 1003 1004 * @note The returned string points to static storage that will be overwritten with each call. 1004 1005 */ … … 1006 1007 { 1007 1008 /*@ int *********************************************** */ 1008 int percentage; 1009 int percentage = 0; 1010 int i; 1009 1011 int j; 1010 1012 1011 1013 /*@ buffers ******************************************* */ 1012 static char outstr[MAX_STR_LEN]; 1013 char *pos_w_commas, *tmp; 1014 char *outstr; 1015 char *tmp; 1016 char *tmp1; 1017 char *tmp2; 1018 char *prepstr; 1019 char *p; 1014 1020 1015 1021 assert(bkpinfo != NULL); 1016 malloc_string(pos_w_commas); 1017 malloc_string(tmp); 1018 sprintf(tmp, "%lld", g_tape_posK); 1019 strcpy(pos_w_commas, commarize(tmp)); 1020 1021 1022 1023 if (bkpinfo->media_size[g_current_media_number] <= 0) 1024 // { fatal_error( "percentage_media_full_comment() - unknown media size"); } 1025 { 1026 sprintf(outstr, "Volume %d: %s kilobytes archived so far", 1027 g_current_media_number, pos_w_commas); 1022 1023 if (bkpinfo->media_size[g_current_media_number] <= 0) { 1024 asprintf(&tmp, "%lld", g_tape_posK); 1025 asprintf(&outstr, "Volume %d: %s kilobytes archived so far", 1026 g_current_media_number, commarize(tmp)); 1027 paranoid_free(tmp); 1028 1028 return (outstr); 1029 1029 } … … 1034 1034 (int) (g_tape_posK / 10 / 1035 1035 bkpinfo->media_size[g_current_media_number]); 1036 if (percentage > 100) { 1037 percentage = 100; 1038 } 1039 sprintf(outstr, "Volume %d: [", g_current_media_number); 1036 asprintf(&prepstr, "Volume %d: [", g_current_media_number); 1040 1037 } else { 1041 1038 percentage = 1042 1039 (int) (space_occupied_by_cd(bkpinfo->scratchdir) * 100 / 1024 / 1043 1040 bkpinfo->media_size[g_current_media_number]); 1044 sprintf(outstr, "%s %d: [",1041 asprintf(&prepstr, "%s %d: [", 1045 1042 media_descriptor_string(bkpinfo->backup_media_type), 1046 1043 g_current_media_number); 1047 1044 } 1048 for (j = 0; j < percentage; j += 5) { 1049 strcat(outstr, "*"); 1050 } 1051 for (; j < 100; j += 5) { 1052 strcat(outstr, "."); 1053 } 1054 j = (int) strlen(outstr); 1055 sprintf(outstr + j, "] %d%% used", percentage); 1056 paranoid_free(pos_w_commas); 1057 paranoid_free(tmp); 1045 if (percentage > 100) { 1046 percentage = 100; 1047 } 1048 j = trunc(percentage/5); 1049 tmp1 = (char *)malloc((j + 1) * sizeof(char)); 1050 for (i = 0, p = tmp1 ; i < j ; i++, p++) { 1051 *p = '*'; 1052 } 1053 *p = '\0'; 1054 1055 tmp2 = (char *)malloc((20 - j + 1) * sizeof(char)); 1056 for (i = 0, p = tmp2 ; i < 20 - j ; i++, p++) { 1057 *p = '.'; 1058 } 1059 *p = '\0'; 1060 1061 /* BERLIOS There is a bug here I can't solve for the moment. If you 1062 * replace %% in the asprintf below by 'percent' it just works, but 1063 * like this it creates a huge number. Memory pb somewhere */ 1064 /* 1065 log_it("percentage: %d", percentage); 1066 asprintf(&outstr, "%s%s%s] %3d%% used", prepstr, tmp1, tmp2, percentage); 1067 */ 1068 asprintf(&outstr, "%s%s%s] %3d percent used", prepstr, tmp1, tmp2, percentage); 1069 paranoid_free(prepstr); 1070 paranoid_free(tmp1); 1071 paranoid_free(tmp2); 1058 1072 return (outstr); 1059 1073 } -
trunk/mondo/mondo/common/libmondo-tools.c
r75 r87 719 719 fprintf(stderr, "Type 'man mondoarchive' for help.\n"); 720 720 } 721 sprintf(tmp, "%s", MONDO_TMPISOS); /* added #define 22 apr 2002 */721 sprintf(tmp, "%s", MONDO_TMPISOS); 722 722 if (does_file_exist(tmp)) { 723 723 unlink(tmp); -
trunk/mondo/mondo/common/libmondo-verify.c
r59 r87 815 815 816 816 /*@ buffers ******************************************************** */ 817 char *tmp;818 817 char *orig_fname, *logical_fname; 819 818 char *comment; -
trunk/mondo/mondo/common/my-stuff.h
r59 r87 1 /* my-stuff.h 2 $Id$ 3 . 4 5 6 07/14 7 - ARCH_THREADS is now 2; buffers, 4 8 9 07/10 10 - added acl, xattr stuff 11 12 06/19 13 - added AUX_VER 14 15 06/14 16 - added DO_MBR_PLEASE 17 18 04/17 19 - replaced INTERNAL_TAPE_BLK_SIZE with g_internal_tape_block_size 20 and DEFAULT_INTERNAL_TAPE_BLOCK_SIZE 21 22 04/13 23 - log_msg is now calling standard_log_debug_msg, not the alias (log_debug_msg) 24 25 04/03/2004 26 - added star and SELINUX support 27 28 11/20/2003 29 - boot from isolinux.bin, not mindi-boot.2880.img 30 31 11/15 32 - reduced SLICE_SIZE from 8192 to 4096 33 34 10/08 35 - set p-i-h volsize to 1GB 36 37 10/21 38 - added MNT_CDROM and FREELOADER 39 40 10/11 41 - added DEFAULT_DVD_DISK_SIZE 42 - added PARTIMAGE_DEBUG_LEVEL 43 44 09/27 45 - better logging 46 47 09/24 48 - added MR_LOGFILE="/tmp/mondo-restore.log" 49 50 09/22 51 - added bool, FALSE, TRUE 52 53 09/20 54 - increasd PPCFG_RAMDISK_SIZE to 150 55 56 09/12 57 - reduced MAX_STR_LEN from 512 to 460 58 59 09/10 60 - moved PPCFG_RAMDISK_SIZE here 61 62 09/05 63 - better config.h stuff 64 65 06/05 66 - changed fgrep to grep 67 68 05/19 69 - added CP_BIN 70 71 05/05 72 - added #include <sys/param.h> and sys/sem.h and ioctl.h 73 74 05/03 75 - added kill_anything_like_this() 76 77 04/24/2003 78 - added *STUB #define's 79 80 11/22/2002 81 - added INTERNAL_TAPE_BLK_SIZE 82 83 10/10 84 - use #define to create XMondo-friendly log file name if appropriate 85 86 08/30 87 - changed ARBITRARY_MAXIMUM to 512 88 89 08/26 90 - set MAX_STR_LEN at 512 but halved it within many _structures_ 91 - changed ARBITRARY_MAXIMUM to 128 92 93 08/08 94 - added '#include <signal.h>' 95 - added WELCOME_STRING 96 97 06/19 98 - changed tape block size from 8192 to 65536 99 100 04/08 101 - added manual_cd_tray flag to bkpinfo 102 103 03/31 104 - added restore_path to struct s_bkpinfo 105 106 03/21 107 - updated version# to 1.42 108 109 02/20 110 - added bkpinfo->using_cdstream 111 112 02/06 113 - added MONDO_VERSION 114 115 02/02 116 - added MONDO_CFG_FILE 117 - added SLICE_SIZE 118 119 01/31 120 - removed MINDI_HOME: it is unnecessary 121 - replaced MONDO_HOME with variable g_mondo_home 122 123 01/25 124 - added MONDO_HOME, MINDI_HOME 125 126 01/21 127 - added s_node{} structure 128 129 01/17 130 - added sys/shm.h, types.h, ipc.h 131 132 01/02/2002 133 - added that groovy bkpinfo{} stuff 134 135 11/29/2001 136 - added raidlist{} struct 137 138 08/27 139 - stuff 140 */ 1 /* $Id$ */ 141 2 142 3 #define AUX_VER "2.05_berlios" 143 144 4 #define HAVE_MALLOC 1 145 146 5 147 6 // Extra info for ACLs and SELINUX users … … 155 14 * The main header file for Mondo. 156 15 */ 16 #ifndef _MY_STUFF_H_ 17 #define _MY_STUFF_H_ 18 19 /* Required for the use of asprintf */ 20 #define __USE_GNU 21 22 #include <stdio.h> 157 23 158 24 #if !defined(bool) && !defined(__cplusplus) … … 165 31 #endif 166 32 167 #ifndef _MY_STUFF_H_168 #define _MY_STUFF_H_169 170 33 #ifdef HAVE_CONFIG_H 171 34 #include <config.h> … … 175 38 #include <getopt.h> 176 39 #endif 40 177 41 #include <sys/types.h> 178 42 #include <sys/shm.h> … … 181 45 #include <sys/sem.h> 182 46 #include <sys/param.h> 183 #include <stdio.h> 47 184 48 #include <stdlib.h> 185 49 #ifndef __USE_FILE_OFFSET64 … … 528 392 #define DEFAULT_MR_LOGLEVEL 4 529 393 530 /* Required for the use of asprintf */531 #define _GNU_SOURCE532 533 394 #endif /* _MY_STUFF_H_ */ -
trunk/mondo/mondo/common/newt-specific.c
r75 r87 49 49 bool g_exiting = FALSE; 50 50 51 /**52 * Padding below the Newt components, to overcome bugs in Newt.53 */54 char g_haharrrrr[500];55 56 57 51 newtComponent g_timeline = NULL, ///< The line of the progress form that shows the time elapsed/remaining 58 52 g_percentline = NULL, ///< The line of the progress form that shows the percent completed/remaining … … 67 61 * Padding above the Newt components, to overcome bugs in Newt. 68 62 */ 69 char g_jim_lad_yarr[500];70 63 char **err_log_lines = NULL, ///< The list of log lines to show on the screen. 71 g_blurb_str_1[MAX_NEWT_COMMENT_LEN] = "", ///< The string for line 1 of the blurb in the progress form72 g_blurb_str_2[MAX_NEWT_COMMENT_LEN] = "", ///< The string for line 2 of the blurb in the progress form73 g_blurb_str_3[MAX_NEWT_COMMENT_LEN] = ""; ///< The string for line 3 (updated continuously) of the blurb in the progress form64 *g_blurb_str_1, ///< The string for line 1 of the blurb in the progress form 65 *g_blurb_str_2, ///< The string for line 2 of the blurb in the progress form 66 *g_blurb_str_3; ///< The string for line 3 (updated continuously) of the blurb in the progress form 74 67 newtComponent g_isoform_main = NULL, ///< The evalcall form component itself 75 68 g_isoform_header = NULL, ///< The component for the evalcall form title … … 79 72 long g_isoform_starttime; ///< The time (in seconds since the epoch) that the evalcall form was opened. 80 73 int g_isoform_old_progress = -1; ///< The most recent progress update of the evalcall form (percent). 81 char g_isoform_header_str[MAX_STR_LEN] = " "; ///< The string for the evalcall form title.74 char *g_isoform_header_str; ///< The string for the evalcall form title. 82 75 int g_mysterious_dot_counter; ///< The counter for the twirling baton (/ | \\ - ...) on percentage less than 3 83 76 int g_noof_log_lines = 6; ///< The number of lines to show in the log at the bottom of the screen. … … 91 84 long g_start_time = 0; ///< The time (in seconds since the epoch) that the progress form was opened. 92 85 bool g_text_mode = TRUE; ///< If FALSE, use a newt interface; if TRUE, use an ugly (but more compatible) dumb terminal interface. 93 char g_xmondo_stdin[MAX_NEWT_COMMENT_LEN], ///< ... @bug Unneeded w/current XMondo.94 g_xmondo_stdout[MAX_NEWT_COMMENT_LEN]; ///< .... @bug Unneeded w/current XMondo.95 86 bool g_called_by_xmondo = FALSE; ///< @bug Unneeded w/current XMondo. 96 87 char *g_erase_tmpdir_and_scratchdir; ///< The command to run to erase the tmpdir and scratchdir at the end of Mondo. … … 255 246 fatal_error(char *error_string) { 256 247 /*@ buffers ***************************************************** */ 257 char fatalstr[MAX_NEWT_COMMENT_LEN] = 258 "-------FATAL ERROR---------"; 248 char *fatalstr; 259 249 char *tmp; 260 250 char *command; … … 264 254 /*@ end vars **************************************************** */ 265 255 266 malloc_string(command);256 asprintf(&fatalstr, "-------FATAL ERROR---------"); 267 257 set_signals(FALSE); // link to external func 268 258 g_exiting = TRUE; 269 log_msg(1, " Fatal error received - '%s'", error_string);270 printf(" Fatal error... %s\n", error_string);259 log_msg(1, "%s - '%s'", fatalstr, error_string); 260 printf("%s - %s\n", fatalstr, error_string); 271 261 if (getpid() == g_mastermind_pid) { 272 262 log_msg(2, "mastermind %d is exiting", (int) getpid()); … … 323 313 } 324 314 325 printf("---FATALERROR--- %s\n", error_string);326 315 system 327 316 ("cat /var/log/mondo-archive.log | gzip -9 > /tmp/MA.log.gz 2> /dev/null"); 328 317 if (!strstr(g_version, "cvs") && !strstr(g_version, "svn")) { 329 318 printf 330 ("Please try the snapshot (the version with 'cvs' and the date in its filename)");319 ("Please try the latest SVN version "); 331 320 printf 332 ("to see if that fixes the problem. 321 ("to see if that fixes the problem.\nPlease don't bother the mailing list with"); 333 322 printf 334 ("your problem UNTIL you've tried the snapshot. 323 ("your problem UNTIL you've tried the snapshot.\nThe snapshot contains bugfixes"); 335 324 printf 336 ("which might help you. Go to http://www.mondorescue.org/download/download.html");337 printf(" For more information.\n");325 ("which might help you.\nGo to http://mondorescue.berlios.de"); 326 printf(" for more information.\n"); 338 327 log_msg(0, 339 328 "Please DON'T contact the mailing list. Try the SNAPSHOTS."); … … 565 554 g_isoform_old_progress = -1; 566 555 g_mysterious_dot_counter = 0; 567 malloc_string(title);568 malloc_string(tmp);569 556 570 557 assert(ttl != NULL); 571 strcpy(title, ttl); 572 strcpy(g_isoform_header_str, title); 573 // center_string (title, 80); 558 asprintf(&title, ttl); 559 // BERLIOS: We need to unallocate it somewhere 560 asprintf(&g_isoform_header_str, title); 561 // center_string (title, 80); 574 562 if (g_text_mode) { 575 563 log_msg(0, title); 576 564 } else { 577 strcpy(tmp, title); 578 center_string(tmp, 80); 565 asprintf(&tmp, title); 566 /* BERLIOS: center_string is now broken replace it ! */ 567 //center_string(tmp, 80); 579 568 newtPushHelpLine(tmp); 580 } 581 center_string(g_isoform_header_str, 36); 569 paranoid_free(tmp); 570 } 571 /* BERLIOS: center_string is now broken replace it ! */ 572 //center_string(g_isoform_header_str, 36); 582 573 g_isoform_starttime = get_time(); 583 574 if (g_text_mode) { … … 597 588 } 598 589 update_evalcall_form(0); 599 paranoid_free(tmp);600 590 paranoid_free(title); 601 591 } … … 625 615 g_mysterious_dot_counter = 0; 626 616 627 malloc_string(b1c);628 malloc_string(blurb1);629 malloc_string(blurb2);630 malloc_string(blurb3);631 632 617 assert(title != NULL); 633 618 assert(b1 != NULL); … … 635 620 assert(b3 != NULL); 636 621 637 strcpy(blurb1, b1); 638 strcpy(blurb2, b2); 639 strcpy(blurb3, b3); 640 strcpy(b1c, b1); 641 center_string(b1c, 80); 622 asprintf(&blurb1, b1); 623 asprintf(&blurb2, b2); 624 asprintf(&blurb3, b3); 625 asprintf(&b1c, b1); 626 /* BERLIOS: center_string is now broken replace it ! */ 627 //center_string(b1c, 80); 642 628 if (max_val <= 0) { 643 629 max_val = 1; … … 647 633 g_maximum_progress = max_val; 648 634 g_current_progress = 0; 649 strcpy(g_blurb_str_1, blurb1); 650 strcpy(g_blurb_str_2, blurb3); 651 strcpy(g_blurb_str_3, blurb2); 635 // BERLIOS: We need to unallocate them 636 asprintf(&g_blurb_str_1, blurb1); 637 asprintf(&g_blurb_str_2, blurb3); 638 asprintf(&g_blurb_str_3, blurb2); 652 639 if (g_text_mode) { 653 640 log_msg(0, blurb1); … … 724 711 char *original_contents; 725 712 726 blurb = malloc(MAX_NEWT_COMMENT_LEN);727 original_contents = malloc(MAX_NEWT_COMMENT_LEN);728 713 assert_string_is_neither_NULL_nor_zerolength(title); 729 714 assert(b != NULL); … … 737 722 if (output[strlen(output) - 1] == '\n') 738 723 output[strlen(output) - 1] = '\0'; 739 paranoid_free(blurb);740 paranoid_free(original_contents);741 724 return (TRUE); 742 725 } 743 strcpy(blurb, b);726 asprintf(&blurb, b); 744 727 text = newtTextboxReflowed(2, 1, blurb, 48, 5, 5, 0); 745 strcpy(original_contents, output);728 asprintf(&original_contents, output); 746 729 output[0] = '\0'; 747 730 type_here = … … 760 743 myForm = newtForm(NULL, NULL, 0); 761 744 newtFormAddComponents(myForm, text, type_here, b_1, b_2, NULL); 762 center_string(blurb, 80); 745 /* BERLIOS: center_string is now broken replace it ! */ 746 //center_string(blurb, 80); 763 747 newtPushHelpLine(blurb); 748 paranoid_free(blurb); 764 749 b_res = newtRunForm(myForm); 765 750 strcpy(output, entry_value); … … 769 754 if (b_res == b_2) { 770 755 strcpy(output, original_contents); 771 paranoid_free(blurb);772 756 paranoid_free(original_contents); 773 757 return (FALSE); 774 758 } else { 775 paranoid_free(blurb);776 759 paranoid_free(original_contents); 777 760 return (TRUE); … … 790 773 791 774 /*@ buffers *********************************************************** */ 792 char *prompt, *tmp; 775 char *prompt; 776 char *tmp = NULL; 777 size_t n = 0; 793 778 794 779 /*@ newt ************************************************************** */ … … 799 784 newtComponent text; 800 785 801 prompt = malloc(MAX_NEWT_COMMENT_LEN);802 tmp = malloc(MAX_NEWT_COMMENT_LEN);803 786 assert_string_is_neither_NULL_nor_zerolength(p); 804 787 assert(button1 != NULL); … … 810 793 printf("%s (%s or %s) --> ", p, button1, button2); 811 794 } 812 for ( tmp[0] = '\0';795 for (asprintf(&tmp,""); 813 796 strcmp(tmp, button1) && (strlen(button2) == 0 814 797 || strcmp(tmp, button2));) { 815 798 printf("--> "); 816 (void) fgets(tmp, MAX_NEWT_COMMENT_LEN, stdin); 799 paranoid_free(tmp); 800 (void) getline(&tmp, &n, stdin); 817 801 } 818 802 if (!strcmp(tmp, button1)) { 819 803 paranoid_free(tmp); 820 paranoid_free(prompt);821 804 return (TRUE); 822 805 } else { 823 806 paranoid_free(tmp); 824 paranoid_free(prompt);825 807 return (FALSE); 826 808 } 827 809 } 828 810 829 strcpy(prompt, p);811 asprintf(&prompt, p); 830 812 text = newtTextboxReflowed(1, 1, prompt, 40, 5, 5, 0); 831 813 b_1 = … … 845 827 myForm = newtForm(NULL, NULL, 0); 846 828 newtFormAddComponents(myForm, text, b_1, b_2, NULL); 847 center_string(prompt, 80); 829 /* BERLIOS: center_string is now broken replace it ! */ 830 //center_string(prompt, 80); 848 831 newtPushHelpLine(prompt); 832 paranoid_free(prompt); 849 833 b_res = newtRunForm(myForm); 850 834 newtPopHelpLine(); … … 852 836 newtPopWindow(); 853 837 if (b_res == b_1) { 854 paranoid_free(tmp);855 paranoid_free(prompt);856 838 return (TRUE); 857 839 } else { 858 paranoid_free(tmp);859 paranoid_free(prompt);860 840 return (FALSE); 861 841 } … … 936 916 937 917 /** 938 * Update the evalcall form to show (<tt>num</tt>/<tt>denom</tt>)*100%.918 * Update the evalcall form to show <tt>num</tt> %. 939 919 * @param num The numerator of the ratio. 940 * @param denom The denomenator of the ratio.941 920 */ 942 921 void 943 update_evalcall_form _ratio(int num, int denom) {922 update_evalcall_form(int num) { 944 923 945 924 /*@ long ************************************************************ */ … … 953 932 char *pcline_str; 954 933 char *taskprogress; 934 char *tmp1; 935 char *tmp2; 936 char *p; 955 937 956 938 /*@ int ************************************************************** */ … … 959 941 int j = 0; 960 942 961 malloc_string(timeline_str); 962 malloc_string(pcline_str); 963 malloc_string(taskprogress); 964 timeline_str[0] = '\0'; 965 // log_it("update_eval_call_form called"); 966 if (num * 100 < denom) { 943 //log_it("update_eval_call_form called"); 944 if (num < 1) { 967 945 percentage = 1; 968 946 } else { 969 percentage = ( num * 100 + denom / 2) / denom;947 percentage = (int)trunc(num) ; 970 948 } 971 949 … … 973 951 time_taken = current_time - g_isoform_starttime; 974 952 if (num) { 975 time_total_est = time_taken * denom/ num;953 time_total_est = time_taken * 100 / num; 976 954 time_remaining = time_total_est - time_taken; 977 955 } else { … … 981 959 newtLabelSetText(g_isoform_header, g_isoform_header_str); 982 960 } 961 /* BERLIOS: 27 should be a parameter */ 983 962 g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27; 984 963 if ((percentage < 3 && g_isoform_old_progress < 3) 985 964 || percentage > g_isoform_old_progress) { 986 965 g_isoform_old_progress = percentage; 987 sprintf(timeline_str,966 asprintf(&timeline_str, 988 967 "%2ld:%02ld taken %2ld:%02ld remaining", 989 968 time_taken / 60, time_taken % 60, time_remaining / 60, 990 969 time_remaining % 60); 991 970 if (percentage < 3) { 992 sprintf(pcline_str, " Working");993 for ( j = 0; j < g_mysterious_dot_counter; j++) {994 strcat(pcline_str, ".");971 tmp1 = (char *)malloc(g_mysterious_dot_counter * sizeof(char)); 972 for (i = 0, p = tmp1 ; i < g_mysterious_dot_counter - 1 ; i++, p++) { 973 *p = '.'; 995 974 } 996 for (; j < 27; j++) { 997 strcat(pcline_str, " "); 975 *p = '\0'; 976 977 /* BERLIOS: 27 should be a parameter */ 978 tmp2 = (char *)malloc(27-g_mysterious_dot_counter * sizeof(char)); 979 for (i = 0, p = tmp2 ; i < 27 - g_mysterious_dot_counter - 1 ; i++, p++) { 980 *p = ' '; 998 981 } 999 sprintf(pcline_str + strlen(pcline_str), " %c", 1000 special_dot_char(g_mysterious_dot_counter)); 982 *p = '\0'; 983 984 asprintf(&pcline_str, " Working%s%s %c", tmp1, tmp2, special_dot_char(g_mysterious_dot_counter)); 985 paranoid_free(tmp1); 986 paranoid_free(tmp2); 1001 987 } else { 1002 sprintf(pcline_str, " %3d%% done %3d%% to go",988 asprintf(&pcline_str, " %3d%% done %3d%% to go", 1003 989 percentage, 100 - percentage); 1004 990 } 1005 991 if (g_text_mode) { 1006 sprintf(taskprogress, "TASK: ["); 1007 for (i = 0; i < percentage; i += 5) { 1008 strcat(taskprogress, "*"); 992 j = trunc(percentage/5); 993 tmp1 = (char *)malloc((j + 1) * sizeof(char)); 994 for (i = 0, p = tmp1 ; i < j ; i++, p++) { 995 *p = '*'; 1009 996 } 1010 for (; i < 100; i += 5) { 1011 strcat(taskprogress, "."); 997 *p = '\0'; 998 999 tmp2 = (char *)malloc((20 - j + 1) * sizeof(char)); 1000 for (i = 0, p = tmp2 ; i < 20 - j ; i++, p++) { 1001 *p = '.'; 1012 1002 } 1003 *p = '\0'; 1004 1013 1005 if (percentage >= 3) { 1014 sprintf(taskprogress + strlen(taskprogress), 1015 "] %3d%% done; %2ld:%02ld to go", percentage, 1016 time_remaining / 60, time_remaining % 60); 1006 asprintf(&taskprogress, "TASK: [%s%s] %3d%% done; %2ld:%02ld to go", tmp1, tmp2, percentage, time_remaining / 60, time_remaining % 60); 1017 1007 printf("---evalcall---1--- %s\r\n", 1018 1008 g_isoform_header_str); 1019 1009 printf("---evalcall---2--- %s\r\n", taskprogress); 1020 1010 printf("---evalcall---E---\r\n"); 1011 paranoid_free(taskprogress); 1021 1012 } 1022 1013 } else { … … 1028 1019 } 1029 1020 } 1021 paranoid_free(timeline_str); 1022 paranoid_free(pcline_str); 1030 1023 } 1031 1024 if (!g_text_mode) { … … 1033 1026 newtRefresh(); 1034 1027 } 1035 paranoid_free(timeline_str); 1036 paranoid_free(pcline_str); 1037 paranoid_free(taskprogress); 1038 } 1039 1040 1041 1042 /** 1043 * Update the evalcall form to show @p curr %. 1044 * @param curr The current amount of progress (percentage) in the evalcall form. 1045 */ 1046 void 1047 update_evalcall_form(int curr) { 1048 update_evalcall_form_ratio(curr, 100); 1049 } 1050 1028 } 1051 1029 1052 1030 … … 1063 1041 return; 1064 1042 } 1065 strcpy(g_blurb_str_2, blurb3); 1043 paranoid_free(g_blurb_str_2); 1044 asprintf(&g_blurb_str_2, blurb3); 1066 1045 update_progress_form_full(g_blurb_str_1, g_blurb_str_2, 1067 1046 g_blurb_str_3); … … 1086 1065 int percentage = 0; 1087 1066 int i = 0; 1067 int j = 0; 1088 1068 1089 1069 /*@ buffers *************************************************** */ … … 1092 1072 char *taskprogress; 1093 1073 char *tmp; 1074 char *tmp1; 1075 char *tmp2; 1076 char *p; 1094 1077 1095 1078 // log_msg(1, "'%s' '%s' '%s'", blurb1, blurb2, blurb3); 1096 percentline_str = malloc(MAX_NEWT_COMMENT_LEN);1097 timeline_str = malloc(MAX_NEWT_COMMENT_LEN);1098 taskprogress = malloc(MAX_NEWT_COMMENT_LEN);1099 malloc_string(tmp);1100 1079 if (!g_text_mode) { 1101 1080 assert(blurb1 != NULL); … … 1105 1084 } 1106 1085 1107 percentline_str[0] = '\0';1108 1109 1086 current_time = get_time(); 1110 1087 time_taken = current_time - g_start_time; … … 1113 1090 } else { 1114 1091 if (g_current_progress > g_maximum_progress) { 1115 sprintf(tmp,1092 asprintf(&tmp, 1116 1093 "update_progress_form_full(%s,%s,%s) --- g_current_progress=%ld; g_maximum_progress=%ld", 1117 1094 blurb1, blurb2, blurb3, g_current_progress, 1118 1095 g_maximum_progress); 1119 1096 log_msg(0, tmp); 1097 paranoid_free(tmp); 1120 1098 g_current_progress = g_maximum_progress; 1121 1099 } … … 1137 1115 time_remaining = 0; 1138 1116 } 1139 g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27; 1140 sprintf(timeline_str, 1117 /* BERLIOS/ Is it useful here ? */ 1118 //g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27; 1119 asprintf(&timeline_str, 1141 1120 "%2ld:%02ld taken %2ld:%02ld remaining ", 1142 1121 time_taken / 60, time_taken % 60, time_remaining / 60, 1143 1122 time_remaining % 60); 1144 sprintf(percentline_str, " %3d%% done %3d%% to go",1123 asprintf(&percentline_str, " %3d%% done %3d%% to go", 1145 1124 percentage, 100 - percentage); 1146 1125 … … 1150 1129 printf("---progress-form---3--- %s\r\n", blurb3); 1151 1130 printf("---progress-form---E---\n"); 1152 sprintf(taskprogress, "TASK: ["); 1153 for (i = 0; i < percentage; i += 5) { 1154 strcat(taskprogress, "*"); 1155 } 1156 for (; i < 100; i += 5) { 1157 strcat(taskprogress, "."); 1158 } 1131 1132 j = trunc(percentage/5); 1133 tmp1 = (char *)malloc((j + 1) * sizeof(char)); 1134 for (i = 0, p = tmp1 ; i < j ; i++, p++) { 1135 *p = '*'; 1136 } 1137 *p = '\0'; 1138 1139 tmp2 = (char *)malloc((20 - j + 1) * sizeof(char)); 1140 for (i = 0, p = tmp2 ; i < 20 - j ; i++, p++) { 1141 *p = '.'; 1142 } 1143 *p = '\0'; 1144 1159 1145 if (percentage > 100) { 1160 1146 log_msg(2, "percentage = %d", percentage); 1161 1147 } 1162 sprintf(taskprogress + strlen(taskprogress), 1163 "] %3d%c", percentage, '%'); 1164 sprintf(taskprogress + strlen(taskprogress), 1165 " done; %2ld:%02ld to go", 1166 time_remaining / 60, time_remaining % 60); 1148 asprintf(&taskprogress, "TASK: [%s%s] %3d%% done; %2ld:%02ld to go", tmp1, tmp2, percentage, time_remaining / 60, time_remaining % 60); 1149 1167 1150 printf("---progress-form---4--- %s\r\n", taskprogress); 1168 } else { 1169 center_string(blurb1, 54); 1170 center_string(blurb2, 54); 1171 center_string(blurb3, 54); 1151 paranoid_free(taskprogress); 1152 } else { 1153 /* BERLIOS: center_string is now broken replace it ! */ 1154 //center_string(blurb1, 54); 1155 /* BERLIOS: center_string is now broken replace it ! */ 1156 //center_string(blurb2, 54); 1157 /* BERLIOS: center_string is now broken replace it ! */ 1158 //center_string(blurb3, 54); 1172 1159 newtLabelSetText(g_blurb1, blurb1); 1173 1160 newtLabelSetText(g_blurb2, blurb3); … … 1182 1169 paranoid_free(percentline_str); 1183 1170 paranoid_free(timeline_str); 1184 paranoid_free(taskprogress); 1185 paranoid_free(tmp); 1186 } 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1171 } 1199 1172 1200 1173 … … 1222 1195 "nfs", "iso", NULL 1223 1196 }; 1224 char *outstr ;1197 char *outstr = NULL; 1225 1198 t_bkptype backup_type; 1226 1199 int i; 1200 size_t n = 0; 1227 1201 1228 1202 newtComponent b1; … … 1237 1211 newtComponent myForm; 1238 1212 1239 title_sz = malloc(MAX_NEWT_COMMENT_LEN);1240 minimsg_sz = malloc(MAX_NEWT_COMMENT_LEN);1241 outstr = malloc(MAX_NEWT_COMMENT_LEN);1242 1213 if (g_text_mode) { 1243 1214 for (backup_type = none; backup_type == none;) { … … 1248 1219 } 1249 1220 printf(")\n--> "); 1250 (void) fgets(outstr, MAX_NEWT_COMMENT_LEN, stdin);1221 (void) getline(&outstr, &n, stdin); 1251 1222 strip_spaces(outstr); 1252 1223 for (i = 0; possible_responses[i]; i++) { … … 1256 1227 } 1257 1228 } 1258 paranoid_free(title_sz);1259 paranoid_free(minimsg_sz);1260 1229 paranoid_free(outstr); 1261 1230 return (backup_type); … … 1263 1232 newtDrawRootText(18, 0, WELCOME_STRING); 1264 1233 if (restoring) { 1265 strcpy(title_sz,1234 asprintf(&title_sz, 1266 1235 "Please choose the backup media from which you want to read data."); 1267 strcpy(minimsg_sz, "Read from:");1268 } else { 1269 strcpy(title_sz,1236 asprintf(&minimsg_sz, "Read from:"); 1237 } else { 1238 asprintf(&title_sz, 1270 1239 "Please choose the backup media to which you want to archive data."); 1271 strcpy(minimsg_sz, "Backup to:");1240 asprintf(&minimsg_sz, "Backup to:"); 1272 1241 } 1273 1242 newtPushHelpLine(title_sz); 1243 paranoid_free(title_sz); 1244 1274 1245 // newtOpenWindow (23, 3, 34, 17, minimsg_sz); 1275 1246 newtCenteredWindow(34, 17, minimsg_sz); 1247 paranoid_free(minimsg_sz); 1248 1276 1249 b1 = newtButton(1, 1, "CD-R disks "); 1277 1250 b2 = newtButton(17, 1, "CD-RW disks"); … … 1306 1279 } 1307 1280 newtPopHelpLine(); 1308 paranoid_free(title_sz);1309 paranoid_free(minimsg_sz);1310 paranoid_free(outstr);1311 1281 return (output); 1312 1282 } 1313 1314 1315 1283 1316 1284 … … 1368 1336 1369 1337 1370 1371 1372 1373 1338 /** 1374 1339 * Load @p source_file (a list of files) into @p filelist. There can be no more than … … 1381 1346 int i; 1382 1347 bool done; 1383 char *tmp; 1348 char *reason = NULL; 1349 char *tmp = NULL; 1350 size_t n = 0; 1384 1351 FILE *fin; 1385 1352 struct s_filelist_entry dummy_fle; 1386 1353 1387 malloc_string(tmp);1388 1354 assert(filelist != NULL); 1389 1355 assert_string_is_neither_NULL_nor_zerolength(source_file); … … 1394 1360 log_msg(2, "Can't open %s; therefore, cannot popup list", 1395 1361 source_file); 1396 paranoid_free(tmp);1397 1362 return (1); 1398 1363 } … … 1404 1369 break; 1405 1370 } 1406 (void) fgets(tmp, MAX_NEWT_COMMENT_LEN, fin);1371 (void) getline(&tmp, &n, fin); 1407 1372 i = (int) strlen(tmp); 1408 1373 if (i < 2) { … … 1419 1384 } 1420 1385 filelist->el[filelist->entries].severity = 1421 severity_of_difference(tmp, NULL); 1386 severity_of_difference(tmp, reason); 1387 paranoid_free(reason); 1422 1388 strcpy(filelist->el[filelist->entries].filename, tmp); 1423 1389 if (feof(fin)) { … … 1431 1397 return (1); 1432 1398 } 1399 paranoid_free(tmp); 1400 1433 1401 for (done = FALSE; !done;) { 1434 1402 done = TRUE; … … 1456 1424 } 1457 1425 } 1458 paranoid_free(tmp);1459 1426 iamhere("leaving"); 1460 1427 return (0); … … 1470 1437 */ 1471 1438 char *filelist_entry_to_string(struct s_filelist_entry *flentry) { 1472 static char comment[100]; 1473 char *tmp; 1439 char *comment; 1474 1440 1475 1441 iamhere("entering"); 1476 malloc_string(tmp);1477 1442 assert(flentry != NULL); 1478 1443 if (flentry->severity == 0) { 1479 strcpy(tmp, "0 ");1444 asprintf(&comment, "0 %93s", flentry->filename); 1480 1445 } else if (flentry->severity == 1) { 1481 strcpy(tmp, "low ");1446 asprintf(&comment, "low %93s", flentry->filename); 1482 1447 } else if (flentry->severity == 2) { 1483 strcpy(tmp, "med "); 1484 } else { 1485 strcpy(tmp, "high"); 1486 } 1487 strcat(tmp, " "); 1488 strncat(tmp, flentry->filename, 100); 1489 tmp[98] = '\0'; 1490 strcpy(comment, tmp); 1491 paranoid_free(tmp); 1448 asprintf(&comment, "med %93s", flentry->filename); 1449 } else { 1450 asprintf(&comment, "high %93s", flentry->filename); 1451 } 1492 1452 iamhere("leaving"); 1493 1453 return (comment); … … 1504 1464 */ 1505 1465 void popup_changelist_from_file(char *source_file) { 1506 char *reason ;1466 char *reason = NULL; 1507 1467 newtComponent myForm; 1508 1468 newtComponent bClose; … … 1527 1487 1528 1488 struct s_filelist *filelist; 1529 malloc_string(reason);1530 tmp = malloc(5000);1531 malloc_string(differ_sz);1532 1489 assert_string_is_neither_NULL_nor_zerolength(source_file); 1533 1490 if (g_text_mode) { 1534 1491 log_msg(2, "Text mode. Therefore, no popup list."); 1535 goto free_to_go;1492 return; 1536 1493 } 1537 1494 log_msg(2, "Examining file %s", source_file); … … 1540 1497 if (lng < 1) { 1541 1498 log_msg(2, "No lines in file. Therefore, no popup list."); 1542 paranoid_free(reason); 1543 goto free_to_go; 1499 return; 1544 1500 } else if (lng >= ARBITRARY_MAXIMUM) { 1545 1501 log_msg(2, "Too many files differ for me to list."); 1546 goto free_to_go;1502 return; 1547 1503 } 1548 1504 … … 1555 1511 log_msg(2, "Can't open %s; therefore, cannot popup list", 1556 1512 source_file); 1557 paranoid_free(reason);1558 1513 return; 1559 1514 } … … 1568 1523 keylist[i]); 1569 1524 } 1570 sprintf(differ_sz,1525 asprintf(&differ_sz, 1571 1526 " %d files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.", 1572 1527 i); 1573 1528 newtPushHelpLine(differ_sz); 1529 paranoid_free(differ_sz); 1530 1574 1531 bClose = newtCompactButton(10, 15, " Close "); 1575 1532 bSelect = newtCompactButton(30, 15, " Select "); 1576 sprintf(tmp, "%-10s %-20s", "Priority", "Filename");1533 asprintf(&tmp, "%-10s %-20s", "Priority", "Filename"); 1577 1534 headerMsg = newtLabel(2, 1, tmp); 1535 paranoid_free(tmp); 1536 1578 1537 newtOpenWindow(5, 4, 70, 16, "Non-matching files"); 1579 1538 myForm = newtForm(NULL, NULL, 0); … … 1596 1555 severity_of_difference(filelist->el[currline]. 1597 1556 filename, reason); 1598 sprintf(tmp, "%s --- %s",1557 asprintf(&tmp, "%s --- %s", 1599 1558 filelist->el[currline].filename, reason); 1600 1559 popup_and_OK(tmp); 1560 paranoid_free(tmp); 1561 paranoid_free(reason); 1601 1562 } 1602 1563 } … … 1606 1567 newtPopWindow(); 1607 1568 newtPopHelpLine(); 1608 free_to_go:1609 paranoid_free(reason);1610 paranoid_free(tmp);1611 paranoid_free(differ_sz);1612 return;1613 1569 } 1614 1570 -
trunk/mondo/mondo/mondoarchive/main.c
r59 r87 319 319 welcome_to_mondoarchive(); 320 320 distro_specific_kludges_at_start_of_mondoarchive(); 321 sprintf(g_erase_tmpdir_and_scratchdir, "rm -Rf %s %s", bkpinfo->tmpdir,322 321 // BERLIOS : too early, bkpinfo is not initialized ?? 322 //sprintf(g_erase_tmpdir_and_scratchdir, "rm -Rf %s %s", bkpinfo->tmpdir, bkpinfo->scratchdir); 323 323 g_kernel_version = get_kernel_version(); 324 324 -
trunk/mondo/mondo/mondoarchive/mondo-cli.c
r59 r87 161 161 /** @def BOOT_LOADER_CHARS The characters allowed for boot loader on this platform. */ 162 162 163 #include <pthread.h>164 163 #include "../common/my-stuff.h" 165 164 #include "../common/mondostructures.h" 166 165 #include "mondo-cli-EXT.h" 167 166 #include "../common/libmondo.h" 168 169 167 #include <pthread.h> 170 168 171 169 #ifndef VERSION 172 170 #define VERSION AUX_VER 173 171 #endif 174 175 172 176 173 … … 263 260 retrieve_switches_from_command_line(argc, argv, flag_val, 264 261 flag_set); 262 log_it("value: %s", flag_val['s']); 265 263 retval += res; 266 264 if (!retval) { -
trunk/mondo/mondo/mondorestore/mondo-restore.c
r59 r87 381 381 * #include statements * 382 382 **************************************************************************/ 383 #include <pthread.h>384 383 #include "../common/my-stuff.h" 385 384 #include "../common/mondostructures.h" … … 389 388 #include "mondo-rstr-compare-EXT.h" 390 389 #include "mondo-rstr-tools-EXT.h" 390 #include <pthread.h> 391 391 392 392 extern void success_message(void); -
trunk/mondo/mondo/mondorestore/mondo-rstr-compare.c
r59 r87 55 55 56 56 57 #include <pthread.h>58 57 #include "../common/my-stuff.h" 59 58 #include "../common/mondostructures.h" … … 64 63 #include "mondo-restore-EXT.h" 65 64 #include "mondo-rstr-tools-EXT.h" 65 #include <pthread.h> 66 66 67 67 //static char cvsid[] = "$Id$"; -
trunk/mondo/mondo/mondorestore/mondo-rstr-tools.c
r59 r87 124 124 125 125 126 #include <pthread.h>127 126 #include "../common/my-stuff.h" 128 127 #include "../common/mondostructures.h" … … 132 131 //#include "mondo-rstr-compare-EXT.h" 133 132 #include "mondo-rstr-tools.h" 133 #include <pthread.h> 134 134 135 135 extern bool g_sigpipe_caught;
Note:
See TracChangeset
for help on using the changeset viewer.