Lines Matching refs:string
43 #include <string.h>
113 * Return the pathname to a zero-length string.
134 * Append a string to a pathname, increasing the size of the pathname
139 * string const char * The string to be appended to the pathname.
141 * this should be a '\0' terminated string.
143 * from string[], or -1 to append the whole
144 * string.
148 * return char * The pathname string path->name[], which may
152 char *_pn_append_to_path(PathName *path, const char *string, int slen,
160 if(!path || !string) {
171 if(slen < 0 || slen > strlen(string))
172 slen = strlen(string);
179 * Append the string to the output pathname, removing any escape
185 is_escape = !is_escape && string[i] == '\\';
187 path->name[pathlen++] = string[i];
190 * Terminate the string.
195 * Append the string directly to the pathname.
197 memcpy(path->name + pathlen, string, slen);
204 * Prepend a string to a pathname, increasing the size of the pathname
209 * string const char * The string to be prepended to the pathname.
211 * this should be a '\0' terminated string.
213 * from string[], or -1 to append the whole
214 * string.
218 * return char * The pathname string path->name[], which may
222 char *_pn_prepend_to_path(PathName *path, const char *string, int slen,
231 if(!path || !string) {
242 if(slen < 0 || slen > strlen(string))
243 slen = strlen(string);
245 * Work out how far we need to shift the original path string to make
253 is_escape = !is_escape && string[i] == '\\';
266 * Make room for the prefix at the beginning of the string.
276 is_escape = !is_escape && string[i] == '\\';
278 path->name[j++] = string[i];
281 memcpy(path->name, string, slen);
287 * If needed reallocate a given pathname buffer to allow a string of
308 * If the pathname buffer isn't large enough to accomodate a string
435 * looks backwards from the specified index in a given string,
439 * string const char * The string to search backwards in.
440 * back_from int The index of the first character in string[]
446 char *_pu_start_of_path(const char *string, int back_from)
452 if(!string || back_from < 0) {
460 int c = string[i];
473 for(j=i-1; j>=0 && string[j]=='\\'; j--)
483 return (char *)string + i + 1;
488 * point. This looks forwards from the specified index in a given string,
492 * string const char * The string to search backwards in.
494 * in string[].
499 char *_pu_end_of_path(const char *string, int start_from)
507 if(!string || start_from < 0) {
514 for(i=start_from; (c=string[i]) != '\0'; i++) {
523 return (char *)string + i;