version 1.76, 2006/03/16 04:04:57 |
version 1.77, 2006/03/18 03:41:54 |
|
|
* This ensures that there is at least one suffix for strsep(). |
* This ensures that there is at least one suffix for strsep(). |
*/ |
*/ |
if (strcmp(rcs_suffixes, "") == 0) { |
if (strcmp(rcs_suffixes, "") == 0) { |
if ((ret = strdup(rcspath)) == NULL); |
ret = xstrdup(rcspath); |
fatal("out of memory"); |
|
return (ret); |
return (ret); |
} |
} |
|
|
|
|
* does, return that string. Otherwise return path with first |
* does, return that string. Otherwise return path with first |
* extension. |
* extension. |
*/ |
*/ |
if ((suffixes = strdup(rcs_suffixes)) == NULL) |
suffixes = xstrdup(rcs_suffixes); |
fatal("out of memory"); |
|
for (ret = NULL, next = suffixes; (ext = strsep(&next, "/")) != NULL;) { |
for (ret = NULL, next = suffixes; (ext = strsep(&next, "/")) != NULL;) { |
char fpath[MAXPATHLEN]; |
char fpath[MAXPATHLEN]; |
|
|
|
|
continue; |
continue; |
|
|
if (stat(fpath, &sb) == 0) { |
if (stat(fpath, &sb) == 0) { |
if ((ret = strdup(fpath)) == NULL) |
ret = xstrdup(fpath); |
fatal("out of memory"); |
|
break; |
break; |
} |
} |
} |
} |
|
|
* XXX - We shouldn't need to do strsep again, |
* XXX - We shouldn't need to do strsep again, |
* suffixes should now be NUL separated. |
* suffixes should now be NUL separated. |
*/ |
*/ |
if ((suffixes = strdup(rcs_suffixes)) == NULL) |
next = suffixes = xstrdup(rcs_suffixes); |
fatal("out of memory"); |
|
next = suffixes; |
|
/* Get first extension again. */ |
/* Get first extension again. */ |
if ((ext = strsep(&next, "/")) == NULL) { |
if ((ext = strsep(&next, "/")) == NULL) { |
xfree(suffixes); |
xfree(suffixes); |
|
|
xfree(suffixes); |
xfree(suffixes); |
return (NULL); |
return (NULL); |
} |
} |
if ((ret = strdup(rcspath)) == NULL) |
ret = xstrdup(rcspath); |
fatal("out of memory"); |
|
xfree(suffixes); |
xfree(suffixes); |
} |
} |
|
|