Changeset 2323 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-string.c
- Timestamp:
- Aug 18, 2009, 3:05:43 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-string.c
r2322 r2323 45 45 assert(partno >= 0); 46 46 47 mr_asprintf( &partition, drive);47 mr_asprintf(partition, drive); 48 48 /* is this a devfs device path? */ 49 49 c = strrchr(partition, '/'); … … 241 241 fatal_error("Integer overflow."); 242 242 } else if (ch != 'm' && ch != 'M') { 243 mr_asprintf( &tmp1, "Re: parameter '%s' - bad multiplier ('%c')", incoming, ch);243 mr_asprintf(tmp1, "Re: parameter '%s' - bad multiplier ('%c')", incoming, ch); 244 244 fatal_error(tmp1); 245 245 } … … 420 420 p = ' '; 421 421 } 422 mr_asprintf( &output, "%d %s disk%c", noof_disks, label, p);422 mr_asprintf(output, "%d %s disk%c", noof_disks, label, p); 423 423 while (strlen(output) < 14) { 424 424 mr_strcat(output, " "); … … 511 511 mr_strcat(output, "%s%s", q, value); 512 512 } else { 513 mr_asprintf( &output, "%s%s", q, value);513 mr_asprintf(output, "%s%s", q, value); 514 514 } 515 515 p+= strlen(token); … … 520 520 } else { 521 521 /* just in case the token doesn't appear in string at all */ 522 mr_asprintf( &output, "%s", q);522 mr_asprintf(output, "%s", q); 523 523 } 524 524 return(output); … … 555 555 assert_string_is_neither_NULL_nor_zerolength(path); 556 556 if (s[0] != '\0') { 557 mr_asprintf( &suffix, ".%s", s);557 mr_asprintf(suffix, ".%s", s); 558 558 } else { 559 mr_asprintf( &suffix, "");559 mr_asprintf(suffix, ""); 560 560 } 561 561 sprintf(output, "%s/slice-%07ld.%05ld.dat%s", path, bigfileno, sliceno, suffix); … … 622 622 if (strlen(flaws_str) > 0) { 623 623 paranoid_free(flaws_str_A); 624 mr_asprintf( &flaws_str_A, "%s", flaws_str + 1);624 mr_asprintf(flaws_str_A, "%s", flaws_str + 1); 625 625 } 626 626 if (strlen(flaws_str_A) >= 74) { 627 627 for (i = 74; flaws_str_A[i] != ' '; i--); 628 628 paranoid_free(flaws_str_B); 629 mr_asprintf( &flaws_str_B, "%s", flaws_str_A + i + 1);629 mr_asprintf(flaws_str_B, "%s", flaws_str_A + i + 1); 630 630 flaws_str_A[i] = '\0'; 631 631 } … … 633 633 for (i = 74; flaws_str_B[i] != ' '; i--); 634 634 paranoid_free(flaws_str_C); 635 mr_asprintf( &flaws_str_C, "%s", flaws_str_B + i + 1);635 mr_asprintf(flaws_str_C, "%s", flaws_str_B + i + 1); 636 636 flaws_str_B[i] = '\0'; 637 637 } … … 830 830 831 831 assert_string_is_neither_NULL_nor_zerolength(partition); 832 mr_asprintf( &trunc, "%s", partition);832 mr_asprintf(trunc, "%s", partition); 833 833 834 834 #ifdef __FreeBSD__ … … 931 931 assert_string_is_neither_NULL_nor_zerolength(fn); 932 932 if (!strncmp(fn, MNT_RESTORING, strlen(MNT_RESTORING))) { 933 mr_asprintf( &filename, "%s", fn + strlen(MNT_RESTORING));933 mr_asprintf(filename, "%s", fn + strlen(MNT_RESTORING)); 934 934 } else if (fn[0] != '/') { 935 mr_asprintf( &filename, "/%s", fn);935 mr_asprintf(filename, "/%s", fn); 936 936 } else { 937 mr_asprintf( &filename, "%s", fn);937 mr_asprintf(filename, "%s", fn); 938 938 } 939 939 940 940 sev = 3; 941 mr_asprintf( &reason, "Changed since backup. Consider running a differential backup in a day or two.");941 mr_asprintf(reason, "Changed since backup. Consider running a differential backup in a day or two."); 942 942 943 943 if (!strncmp(filename, "/var/", 5)) { 944 944 sev = 2; 945 945 mr_free(reason); 946 mr_asprintf( &reason, "/var's contents will change regularly, inevitably.");946 mr_asprintf(reason, "/var's contents will change regularly, inevitably."); 947 947 } 948 948 if (!strncmp(filename, "/home", 5)) { 949 949 sev = 2; 950 950 mr_free(reason); 951 mr_asprintf( &reason, "It's in your /home directory. Therefore, it is important.");951 mr_asprintf(reason, "It's in your /home directory. Therefore, it is important."); 952 952 } 953 953 if (!strncmp(filename, "/usr/", 5)) { 954 954 sev = 3; 955 955 mr_free(reason); 956 mr_asprintf( &reason, "You may have installed/removed software during the backup.");956 mr_asprintf(reason, "You may have installed/removed software during the backup."); 957 957 } 958 958 if (!strncmp(filename, "/etc/", 5)) { 959 959 sev = 3; 960 960 mr_free(reason); 961 mr_asprintf( &reason, "Do not edit config files while backing up your PC.");961 mr_asprintf(reason, "Do not edit config files while backing up your PC."); 962 962 } 963 963 if (!strcmp(filename, "/etc/adjtime") … … 965 965 sev = 1; 966 966 mr_free(reason); 967 mr_asprintf( &reason, "This file changes all the time. It's OK.");967 mr_asprintf(reason, "This file changes all the time. It's OK."); 968 968 } 969 969 if (!strncmp(filename, "/root/", 6)) { 970 970 sev = 3; 971 971 mr_free(reason); 972 mr_asprintf( &reason, "Were you compiling/editing something in /root?");972 mr_asprintf(reason, "Were you compiling/editing something in /root?"); 973 973 } 974 974 if (!strncmp(filename, "/root/.", 7)) { 975 975 sev = 2; 976 976 mr_free(reason); 977 mr_asprintf( &reason, "Temp or 'dot' files changed in /root.");977 mr_asprintf(reason, "Temp or 'dot' files changed in /root."); 978 978 } 979 979 if (!strncmp(filename, "/var/lib/", 9)) { 980 980 sev = 2; 981 981 mr_free(reason); 982 mr_asprintf( &reason, "Did you add/remove software during backing?");982 mr_asprintf(reason, "Did you add/remove software during backing?"); 983 983 } 984 984 if (!strncmp(filename, "/var/lib/rpm", 12)) { 985 985 sev = 3; 986 986 mr_free(reason); 987 mr_asprintf( &reason, "Did you add/remove software during backing?");987 mr_asprintf(reason, "Did you add/remove software during backing?"); 988 988 } 989 989 if (!strncmp(filename, "/var/lib/slocate", 16)) { 990 990 sev = 1; 991 991 mr_free(reason); 992 mr_asprintf( &reason, "The 'update' daemon ran during backup. This does not affect the integrity of your backup.");992 mr_asprintf(reason, "The 'update' daemon ran during backup. This does not affect the integrity of your backup."); 993 993 } 994 994 if (!strncmp(filename, "/var/log/", 9) … … 997 997 sev = 1; 998 998 mr_free(reason); 999 mr_asprintf( &reason, "Log files change frequently as the computer runs. Fret not.");999 mr_asprintf(reason, "Log files change frequently as the computer runs. Fret not."); 1000 1000 } 1001 1001 if (!strncmp(filename, "/var/spool", 10)) { 1002 1002 sev = 1; 1003 1003 mr_free(reason); 1004 mr_asprintf( &reason, "Background processes or printers were active. This does not affect the integrity of your backup.");1004 mr_asprintf(reason, "Background processes or printers were active. This does not affect the integrity of your backup."); 1005 1005 } 1006 1006 if (!strncmp(filename, "/var/spool/mail", 10)) { 1007 1007 sev = 2; 1008 1008 mr_free(reason); 1009 mr_asprintf( &reason, "Mail was sent/received during backup.");1009 mr_asprintf(reason, "Mail was sent/received during backup."); 1010 1010 } 1011 1011 if (filename[strlen(filename) - 1] == '~') { 1012 1012 sev = 1; 1013 1013 mr_free(reason); 1014 mr_asprintf( &reason, "Backup copy of another file which was modified recently.");1014 mr_asprintf(reason, "Backup copy of another file which was modified recently."); 1015 1015 } 1016 1016 if (strstr(filename, "cache")) { 1017 1017 sev = 1; 1018 1018 mr_free(reason); 1019 mr_asprintf( &reason, "Part of a cache of data. Caches change from time to time. Don't worry.");1019 mr_asprintf(reason, "Part of a cache of data. Caches change from time to time. Don't worry."); 1020 1020 } 1021 1021 if (!strncmp(filename, "/var/run/", 9) … … 1025 1025 sev = 1; 1026 1026 mr_free(reason); 1027 mr_asprintf( &reason, "Temporary file (a lockfile, perhaps) used by software such as X or KDE to register its presence.");1027 mr_asprintf(reason, "Temporary file (a lockfile, perhaps) used by software such as X or KDE to register its presence."); 1028 1028 } 1029 1029 if (out_reason) { … … 1088 1088 1089 1089 if (bkpinfo->media_size[g_current_media_number] <= 0) { 1090 mr_asprintf( &tmp, "%lld", g_tape_posK);1091 mr_asprintf( &pos_w_commas, "%s", commarize(tmp));1090 mr_asprintf(tmp, "%lld", g_tape_posK); 1091 mr_asprintf(pos_w_commas, "%s", commarize(tmp)); 1092 1092 mr_free(tmp); 1093 mr_asprintf( &outstr, "Volume %d: %s kilobytes archived so far", g_current_media_number, pos_w_commas);1093 mr_asprintf(outstr, "Volume %d: %s kilobytes archived so far", g_current_media_number, pos_w_commas); 1094 1094 mr_free(pos_w_commas); 1095 1095 return (outstr); … … 1104 1104 percentage = 100; 1105 1105 } 1106 mr_asprintf( &outstr, "Volume %d: [", g_current_media_number);1106 mr_asprintf(outstr, "Volume %d: [", g_current_media_number); 1107 1107 } else { 1108 1108 percentage = … … 1110 1110 bkpinfo->media_size[g_current_media_number]); 1111 1111 mds = media_descriptor_string(bkpinfo->backup_media_type); 1112 mr_asprintf( &outstr, "%s %d: [", mds, g_current_media_number);1112 mr_asprintf(outstr, "%s %d: [", mds, g_current_media_number); 1113 1113 mr_free(mds); 1114 1114 } … … 1136 1136 switch (type_of_bkp) { 1137 1137 case dvd: 1138 mr_asprintf( &type_of_backup, "DVD");1138 mr_asprintf(type_of_backup, "DVD"); 1139 1139 break; 1140 1140 case cdr: 1141 mr_asprintf( &type_of_backup, "CDR");1141 mr_asprintf(type_of_backup, "CDR"); 1142 1142 break; 1143 1143 case cdrw: 1144 mr_asprintf( &type_of_backup, "CDRW");1144 mr_asprintf(type_of_backup, "CDRW"); 1145 1145 break; 1146 1146 case tape: 1147 mr_asprintf( &type_of_backup, "tape");1147 mr_asprintf(type_of_backup, "tape"); 1148 1148 break; 1149 1149 case cdstream: 1150 mr_asprintf( &type_of_backup, "CDR");1150 mr_asprintf(type_of_backup, "CDR"); 1151 1151 break; 1152 1152 case udev: 1153 mr_asprintf( &type_of_backup, "udev");1153 mr_asprintf(type_of_backup, "udev"); 1154 1154 break; 1155 1155 case iso: 1156 mr_asprintf( &type_of_backup, "ISO");1156 mr_asprintf(type_of_backup, "ISO"); 1157 1157 break; 1158 1158 case nfs: 1159 mr_asprintf( &type_of_backup, "nfs");1159 mr_asprintf(type_of_backup, "nfs"); 1160 1160 break; 1161 1161 case usb: 1162 mr_asprintf( &type_of_backup, "USB");1162 mr_asprintf(type_of_backup, "USB"); 1163 1163 break; 1164 1164 default: 1165 mr_asprintf( &type_of_backup, "ISO");1165 mr_asprintf(type_of_backup, "ISO"); 1166 1166 } 1167 1167 return (type_of_backup);
Note:
See TracChangeset
for help on using the changeset viewer.