Changeset 3288 in MondoRescue for branches/3.2/mondo/src/common/libmondo-string.c
- Timestamp:
- May 6, 2014, 10:24:12 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mondo/src/common/libmondo-string.c
r3205 r3288 472 472 * @param value The value to replace @p token. 473 473 */ 474 475 /* TODO: consider mr_strtok */ 474 476 void resolve_naff_tokens(char *output, char *ip, char *value, char *token) 475 477 { … … 1020 1022 /*@ int *********************************************** */ 1021 1023 int percentage; 1022 int j;1023 1024 1024 1025 /*@ buffers ******************************************* */ 1025 static char outstr[MAX_STR_LEN];1026 char * outstr = NULL; 1026 1027 char *pos_w_commas = NULL; 1027 1028 char *mds = NULL; … … 1034 1035 mr_asprintf(pos_w_commas, "%s", commarize(tmp)); 1035 1036 mr_free(tmp); 1036 sprintf(outstr, "Volume %d: %s kilobytes archived so far", g_current_media_number, pos_w_commas);1037 mr_asprintf(outstr, "Volume %d: %s kilobytes archived so far", g_current_media_number, pos_w_commas); 1037 1038 mr_free(pos_w_commas); 1038 1039 return (outstr); … … 1045 1046 percentage = 100; 1046 1047 } 1047 sprintf(outstr, "Volume %d: [", g_current_media_number);1048 mr_asprintf(outstr, "Volume %d: [", g_current_media_number); 1048 1049 } else { 1049 1050 percentage = (int) (space_occupied_by_cd(bkpinfo->scratchdir) * 100 / 1024 / bkpinfo->media_size); 1050 1051 mds = media_descriptor_string(bkpinfo->backup_media_type); 1051 sprintf(outstr, "%s %d: [", mds, g_current_media_number);1052 mr_asprintf(outstr, "%s %d: [", mds, g_current_media_number); 1052 1053 mr_free(mds); 1053 1054 } 1054 1055 for (j = 0; j < percentage; j += 5) { 1055 strcat(outstr, "*");1056 mr_strcat(outstr, "*"); 1056 1057 } 1057 1058 for (; j < 100; j += 5) { 1058 strcat(outstr, "."); 1059 } 1060 j = (int) strlen(outstr); 1061 sprintf(outstr + j, "] %d%% used", percentage); 1059 mr_strcat(outstr, "."); 1060 } 1061 mr_strcat(outstr, "] %d%% used", percentage); 1062 1062 return (outstr); 1063 1063 } 1064 1064 1065 1065 1066 /**
Note:
See TracChangeset
for help on using the changeset viewer.