implement isc_file_basename()
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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 <config.h>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user