diff --git a/lib/isc/include/isc/file.h b/lib/isc/include/isc/file.h index 526a0bedcc..ab092ff125 100644 --- a/lib/isc/include/isc/file.h +++ b/lib/isc/include/isc/file.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: file.h,v 1.15 2001/03/29 02:33:47 bwelling Exp $ */ +/* $Id: file.h,v 1.16 2001/05/03 18:59:28 bwelling Exp $ */ #ifndef ISC_FILE_H #define ISC_FILE_H 1 @@ -177,6 +177,12 @@ isc_file_iscurrentdir(const char *filename); * Return ISC_TRUE iff the given file name is the current directory ("."). */ +char * +isc_file_basename(const char *filename); +/* + * Return the final component of the path in the file name. + */ + isc_result_t isc_file_template(const char *path, const char *templet, char *buf, size_t buflen); diff --git a/lib/isc/unix/file.c b/lib/isc/unix/file.c index 5d7a1442ce..ab0249d9c1 100644 --- a/lib/isc/unix/file.c +++ b/lib/isc/unix/file.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: file.c,v 1.30 2001/04/12 19:46:39 tale Exp $ */ +/* $Id: file.c,v 1.31 2001/05/03 18:59:30 bwelling Exp $ */ #include @@ -234,3 +234,13 @@ isc_boolean_t isc_file_iscurrentdir(const char *filename) { return (ISC_TF(filename[0] == '.' && filename[1] == '\0')); } + +char * +isc_file_basename(const char *filename) { + char *s; + + s = strrchr(filename, '/'); + if (s == NULL) + return (filename); + return (s + 1); +}