Changeset 831 in MondoRescue for branches/stable/mondo/mondo
- Timestamp:
- Sep 25, 2006, 1:07:16 PM (18 years ago)
- Location:
- branches/stable/mondo/mondo/common
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/mondo/common/Makefile.am
r541 r831 24 24 libmondo-string-EXT.h libmondo-tools-EXT.h \ 25 25 libmondo-verify-EXT.h libmondo-stream-EXT.h \ 26 newt-specific.h 26 newt-specific.h \ 27 mr_string.c mr_string.h -
branches/stable/mondo/mondo/common/libmondo-filelist.c
r820 r831 117 117 #include "libmondo-gui-EXT.h" 118 118 #include "libmondo-tools-EXT.h" 119 119 #include "mr_string.h" 120 120 121 121 #include <time.h> -
branches/stable/mondo/mondo/common/libmondo-raid.c
r671 r831 48 48 #include "lib-common-externs.h" 49 49 #include "libmondo-raid.h" 50 #include "mr_string.h" 50 51 51 52 #ifdef __FreeBSD__ -
branches/stable/mondo/mondo/common/libmondo-string-EXT.h
r565 r831 44 44 extern inline void turn_wildcard_chars_into_literal_chars(char *out, 45 45 char *in); 46 /* Valid external functions */47 extern char *mr_strtok(char *instr, const char *delims, int *lastpos); -
branches/stable/mondo/mondo/common/libmondo-string.c
r668 r831 1156 1156 return (type_of_backup); 1157 1157 } 1158 1159 1160 /* New functions safe from a memory manageemnt point of view */1161 /* Developped by Andree Leidenfrost */1162 1163 char *mr_strtok(char *instr, const char *delims, int *lastpos) {1164 1165 char *token = NULL;1166 char *strptr = NULL;1167 size_t pos1 = 0;1168 size_t pos2 = 0;1169 1170 if (strlen(instr) <= *lastpos) {1171 *lastpos = 0;1172 return token;1173 }1174 1175 strptr = instr + *lastpos;1176 pos2 = strspn(strptr, delims);1177 strptr += pos2;1178 pos1 = strcspn(strptr, delims);1179 token = malloc(sizeof(*token)*(pos1+1));1180 strncpy(token, strptr, pos1);1181 token[pos1] = '\0';1182 *lastpos = *lastpos + pos1 + pos2 + 1;1183 1184 return token;1185 }1186 /* @} - end of stringGroup */ -
branches/stable/mondo/mondo/common/libmondo-string.h
r565 r831 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); -
branches/stable/mondo/mondo/common/mr_string.c
r828 r831 1 // New generation of string handling functions 1 /* 2 * mr_string.c - New generation of string handling functions 3 */ 2 4 3 4 // Safe alternative to standard function strok() 5 #include <stdio.h> 6 #include <string.h> 7 8 /** 9 * Safe alternative to standard function strok() 10 * @param instr 11 * @param delims 12 * @param lastpos 13 * @return @p 14 * @note this function allocates memory that needs to be freed by caller 15 **/ 5 16 char *mr_strtok(char *instr, const char *delims, int *lastpos) 6 17 { … … 29 40 30 41 31 // Returns the string fed to it 'inptr' with all characters to escape given 32 // in 'toesc' prepended by escaping character 'escchr'. 33 // (Prepare strings for use in system() or popen() with this function.) 42 /** 43 * Returns the string fed to it 'inptr' with all characters to escape given 44 * in 'toesc' prepended by escaping character 'escchr'. 45 * (Prepare strings for use in system() or popen() with this function.) 46 * @param instr 47 * @param toesc 48 * @param escchr 49 * @note this function allocates memory that needs to be freed by caller 50 **/ 34 51 char *mr_stresc(char *instr, char *toesc, const char escchr) 35 52 {
Note:
See TracChangeset
for help on using the changeset viewer.