Changeset 3289 in MondoRescue for branches/3.2/mondo/src/common/libmondo-string.c
- Timestamp:
- May 6, 2014, 10:24:14 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mondo/src/common/libmondo-string.c
r3288 r3289 381 381 * there will be a weird double space in the middle, so pass *something*. 382 382 * @return The string containing "X blah blah disk(s)". 383 * @note The returned string points to static storage and will be overwritten with each call.383 * @note The returned string is dynamically allocated and should be freed by caller 384 384 */ 385 385 char *number_of_disks_as_string(int noof_disks, char *label) 386 386 { 387 387 388 /*@ buffers ********************************************************* */ 389 static char output[MAX_STR_LEN]; 390 391 /*@ char ******************************************************** */ 392 char p; 393 394 assert(label != NULL); 395 396 if (noof_disks > 1) { 397 p = 's'; 398 } else { 399 p = ' '; 400 } 401 sprintf(output, "%d %s disk%c", noof_disks, label, p); 402 while (strlen(output) < 14) { 403 strcat(output, " "); 404 } 405 return (output); 388 /*@ buffers ********************************************************* */ 389 char *output = NULL; 390 391 /*@ char ******************************************************** */ 392 char p; 393 394 assert(label != NULL); 395 396 if (noof_disks > 1) { 397 p = 's'; 398 } else { 399 p = ' '; 400 } 401 mr_asprintf(output, "%d %s disk%c", noof_disks, label, p); 402 /* Useful ?? 403 while (strlen(output) < 14) { 404 strcat(output, " "); 405 } 406 */ 407 return (output); 406 408 } 407 409
Note:
See TracChangeset
for help on using the changeset viewer.