Changeset 171 in MondoRescue for trunk/mondo/mondo/common/libmondo-string.c
- Timestamp:
- Dec 8, 2005, 5:20:29 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/mondo/common/libmondo-string.c
r122 r171 106 106 } 107 107 108 /* sout is allocated here and must be freed by the caller */ 108 109 109 110 inline void turn_wildcard_chars_into_literal_chars(char *sout, char *sin) 110 111 { 111 char *p, *q; 112 113 for (p = sin, q = sout; *p != '\0'; *(q++) = *(p++)) { 112 char *p; 113 char *q = NULL; 114 char *sav; 115 char r; 116 bool end = FALSE; 117 118 asprintf(&sav, sin); 119 p = sav; 120 while ((*p != '\0') && (! end)) { 114 121 if (strchr("[]*?", *p)) { 115 *(q++) = '\\'; 122 r = *p; // keep the wildcard char 123 *p = '\0'; // trunc the final string 124 p++; // continue on sav 125 // build the new string by recursion 126 turn_wildcard_chars_into_literal_chars(q,p); 127 asprintf(&sout, "%s\\%c%s", sav, r, q); 128 paranoid_free(q); 129 paranoid_free(sav); 130 end = TRUE; 116 131 } 117 } 118 *q = *p; // for the final '\0' 132 p++; 133 } 134 if (!end) { 135 sout = sav; 136 } 119 137 } 120 138 … … 345 363 break; 346 364 default: 347 asprintf(&outstr, "%s ", "BLK_UNKNOWN (%d)", marker);365 asprintf(&outstr, "%s (%d)", "BLK_UNKNOWN", marker); 348 366 break; 349 367 } … … 530 548 asprintf(&suffix, ".%s", s); 531 549 } else { 532 asprintf(&suffix, "%s", " ");550 asprintf(&suffix, "%s", " "); 533 551 } 534 552 asprintf(&output, "%s/slice-%07ld.%05ld.dat%s", path, bigfileno,
Note:
See TracChangeset
for help on using the changeset viewer.