- Timestamp:
- May 20, 2006, 4:39:01 PM (19 years ago)
- Location:
- branches/stable/mondo/mondo/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/mondo/common/libmondo-string.c
r541 r557 1 /* libmondo-string.c 2 $Id$ 3 4 - string manipulation 5 6 7 08/02 8 - added function turn_wildcard_chars_into_literal_chars() 9 10 03/10/2004? 11 - make percent_media_full_comment() use media_descriptor_string(): 12 "DVD %d" or "ISO %d" (if that's what it is) rather than "CD %d" 13 - fix build_partition_name() to use 'adXsY' rather than 'adXpY' on FreeBSD 14 15 10/08/2003 16 - changed 'CD %d' to '<media> %d' (msg) 17 18 10/01 19 - fixing strip_spaces() to handle /r properly 20 21 09/26 22 - added char *media_descriptor_string(t_bkptype); 23 24 05/06 25 - cleaned up severity_of_difference() a bit 26 27 05/05 28 - added Joshua Oreman's FreeBSD patches 29 30 04/24 31 - added lots of assert()'s and log_OS_error()'s 32 - severity_of_difference() skips "/mnt/RESTORING" at start 33 of filename if it's there 34 35 04/04/2003 36 - misc clean-up (Tom Mortell) 37 38 11/17/2002 39 - strip_spaces() now accommodates _smaller_ strings auto'y 40 41 11/08 42 - if decimal point in string sent to friendly_sizestr_to_sizelong() 43 then fatal error: we expect integers only 44 45 10/01 - 10/31 46 - commented subroutines 47 - strip_spaces() allows up to MAX_STR_LEN-len input string 48 49 08/01 - 08/31 50 - fixed bug in friendly_sizestr_to_sizelong() which stopped 51 it from working with capital G's and K's 52 - fixed bug in build_partition_name() 53 54 07/24 55 - created 56 */ 1 /* $Id$ */ 57 2 58 3 … … 1212 1157 } 1213 1158 1159 1160 /* New functions safe from a memory manageemnt point of view */ 1161 1162 char *mr_strtok(char *instr, const char *delims, int *lastpos) { 1163 1164 char *token = NULL; 1165 char *strptr = NULL; 1166 size_t pos1 = 0; 1167 size_t pos2 = 0; 1168 1169 if (strlen(instr) <= *lastpos) { 1170 *lastpos = 0; 1171 return token; 1172 } 1173 1174 strptr = instr + *lastpos; 1175 pos2 = strspn(strptr, delims); 1176 strptr += pos2; 1177 pos1 = strcspn(strptr, delims); 1178 token = malloc(sizeof(*token)*(pos1+1)); 1179 strncpy(token, strptr, pos1); 1180 *lastpos = *lastpos + pos1 + pos2 + 1; 1181 1182 return token; 1183 } 1214 1184 /* @} - end of stringGroup */ -
branches/stable/mondo/mondo/common/libmondo-string.h
r128 r557 34 34 char *media_descriptor_string(t_bkptype); 35 35 inline void turn_wildcard_chars_into_literal_chars(char *out, char *in); 36 37 /* Valid external functions */ 38 char *mr_strtok(char *instr, const char *delims, int *lastpos)
Note:
See TracChangeset
for help on using the changeset viewer.