Changeset 768 in MondoRescue for trunk/mondo/mondo/common
- Timestamp:
- Aug 8, 2006, 3:51:12 PM (18 years ago)
- Location:
- trunk/mondo/mondo/common
- Files:
-
- 2 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/mondo/common/libmondo-string.c
r688 r768 1138 1138 return (type_of_backup); 1139 1139 } 1140 1141 1142 /* New functions safe from a memory manageemnt point of view */1143 /* Developped by Andree Leidenfrost */1144 1145 char *mr_strtok(char *instr, const char *delims, int *lastpos) {1146 1147 char *token = NULL;1148 char *strptr = NULL;1149 size_t pos1 = 0;1150 size_t pos2 = 0;1151 1152 if (strlen(instr) <= *lastpos) {1153 *lastpos = 0;1154 return token;1155 }1156 1157 strptr = instr + *lastpos;1158 pos2 = strspn(strptr, delims);1159 strptr += pos2;1160 pos1 = strcspn(strptr, delims);1161 token = malloc(sizeof(*token)*(pos1+1));1162 strncpy(token, strptr, pos1);1163 token[pos1] = '\0';1164 *lastpos = *lastpos + pos1 + pos2 + 1;1165 1166 return token;1167 }1168 /* @} - end of stringGroup */
Note:
See TracChangeset
for help on using the changeset viewer.