mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 08:05:21 +00:00
added isc_file_ischdiridempotent()
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: file.h,v 1.23 2001/07/16 17:22:16 gson Exp $ */
|
/* $Id: file.h,v 1.24 2001/07/16 18:33:00 gson Exp $ */
|
||||||
|
|
||||||
#ifndef ISC_FILE_H
|
#ifndef ISC_FILE_H
|
||||||
#define ISC_FILE_H 1
|
#define ISC_FILE_H 1
|
||||||
@@ -185,6 +185,13 @@ isc_file_iscurrentdir(const char *filename);
|
|||||||
* Return ISC_TRUE iff the given file name is the current directory (".").
|
* Return ISC_TRUE iff the given file name is the current directory (".").
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
isc_boolean_t
|
||||||
|
isc_file_ischdiridempotent(const char *filename);
|
||||||
|
/*
|
||||||
|
* Return ISC_TRUE if calling chdir(filename) multiple times will give
|
||||||
|
* the same result as calling it once.
|
||||||
|
*/
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
isc_file_basename(const char *filename);
|
isc_file_basename(const char *filename);
|
||||||
/*
|
/*
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: file.c,v 1.37 2001/07/16 17:26:44 gson Exp $ */
|
/* $Id: file.c,v 1.38 2001/07/16 18:33:01 gson Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -261,6 +261,16 @@ isc_file_iscurrentdir(const char *filename) {
|
|||||||
return (ISC_TF(filename[0] == '.' && filename[1] == '\0'));
|
return (ISC_TF(filename[0] == '.' && filename[1] == '\0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isc_boolean_t
|
||||||
|
isc_file_ischdiridempotent(const char *filename) {
|
||||||
|
REQUIRE(filename != NULL);
|
||||||
|
if (isc_file_isabsolute(filename))
|
||||||
|
return (ISC_TRUE);
|
||||||
|
if (isc_file_iscurrentdir(filename))
|
||||||
|
return (ISC_TRUE);
|
||||||
|
return (ISC_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
isc_file_basename(const char *filename) {
|
isc_file_basename(const char *filename) {
|
||||||
char *s;
|
char *s;
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: file.c,v 1.18 2001/07/16 17:22:17 gson Exp $ */
|
/* $Id: file.c,v 1.19 2001/07/16 18:33:02 gson Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -402,6 +402,21 @@ isc_file_iscurrentdir(const char *filename) {
|
|||||||
return (ISC_TF(filename[0] == '.' && filename[1] == '\0'));
|
return (ISC_TF(filename[0] == '.' && filename[1] == '\0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isc_boolean_t
|
||||||
|
isc_file_ischdiridempotent(const char *filename) {
|
||||||
|
REQUIRE(filename != NULL);
|
||||||
|
|
||||||
|
if (isc_file_isabsolute(filename))
|
||||||
|
return (ISC_TRUE);
|
||||||
|
if (filename[0] == '\\')
|
||||||
|
return (ISC_TRUE);
|
||||||
|
if (filename[0] == '/')
|
||||||
|
return (ISC_TRUE);
|
||||||
|
if (isc_file_iscurrentdir(filename))
|
||||||
|
return (ISC_TRUE);
|
||||||
|
return (ISC_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
isc_file_basename(const char *filename) {
|
isc_file_basename(const char *filename) {
|
||||||
char *s;
|
char *s;
|
||||||
|
Reference in New Issue
Block a user