#include <sys/types.h>
#include <dirent.h>
#include <isc/lang.h>
#include <isc/result.h>
Go to the source code of this file.
Data Structures | |
struct | isc_direntry |
Directory Entry. More... | |
struct | isc_dir |
Directory. More... | |
Defines | |
#define | ISC_DIR_H 1 |
#define | ISC_DIR_NAMEMAX 256 |
#define | ISC_DIR_PATHMAX 1024 |
Typedefs | |
typedef struct isc_direntry | isc_direntry_t |
typedef struct isc_dir | isc_dir_t |
Functions | |
ISC_LANG_BEGINDECLS void | isc_dir_init (isc_dir_t *dir) |
isc_result_t | isc_dir_open (isc_dir_t *dir, const char *dirname) |
Allocate workspace and open directory stream. If either one fails, NULL will be returned. | |
isc_result_t | isc_dir_read (isc_dir_t *dir) |
Return previously retrieved file or get next one. | |
isc_result_t | isc_dir_reset (isc_dir_t *dir) |
Reposition directory stream at start. | |
void | isc_dir_close (isc_dir_t *dir) |
Close directory stream. | |
isc_result_t | isc_dir_chdir (const char *dirname) |
isc_result_t | isc_dir_chroot (const char *dirname) |
isc_result_t | isc_dir_createunique (char *templet) |
Definition in file dir.h.
#define ISC_DIR_NAMEMAX 256 |
Definition at line 33 of file dir.h.
Referenced by dns_dnssec_findzonekeys2(), dns_dnssec_keylistfromrdataset(), dst__privstruct_writefile(), dst_key_fromfile(), and write_public_key().
#define ISC_DIR_PATHMAX 1024 |
typedef struct isc_direntry isc_direntry_t |
ISC_LANG_BEGINDECLS void isc_dir_init | ( | isc_dir_t * | dir | ) |
Definition at line 43 of file dir.c.
References isc_dir::entry, isc_dir::handle, ISC_DIR_MAGIC, isc_direntry::length, isc_dir::magic, isc_direntry::name, and REQUIRE.
Referenced by dns_dnssec_findmatchingkeys(), greatest_version(), and try_dir().
isc_result_t isc_dir_open | ( | isc_dir_t * | dir, | |
const char * | dirname | |||
) |
Allocate workspace and open directory stream. If either one fails, NULL will be returned.
Definition at line 59 of file dir.c.
References isc_dir::dirname, isc_dir::handle, isc__errno2result, ISC_R_NOSPACE, ISC_R_SUCCESS, REQUIRE, and VALID_DIR.
Referenced by dns_dnssec_findmatchingkeys(), greatest_version(), and try_dir().
isc_result_t isc_dir_read | ( | isc_dir_t * | dir | ) |
Return previously retrieved file or get next one.
Unix's dirent has separate open and read functions, but the Win32 and DOS interfaces open the dir stream and reads the first file in one operation.
Definition at line 103 of file dir.c.
References isc_dir::entry, isc_dir::handle, ISC_R_NOMORE, ISC_R_SUCCESS, ISC_R_UNEXPECTED, isc_direntry::length, isc_direntry::name, REQUIRE, and VALID_DIR.
Referenced by dns_dnssec_findmatchingkeys(), and greatest_version().
isc_result_t isc_dir_reset | ( | isc_dir_t * | dir | ) |
Reposition directory stream at start.
Definition at line 147 of file dir.c.
References isc_dir::handle, ISC_R_SUCCESS, REQUIRE, and VALID_DIR.
void isc_dir_close | ( | isc_dir_t * | dir | ) |
Close directory stream.
Definition at line 136 of file dir.c.
References isc_dir::handle, REQUIRE, and VALID_DIR.
Referenced by dns_dnssec_findmatchingkeys(), greatest_version(), and try_dir().
isc_result_t isc_dir_chdir | ( | const char * | dirname | ) |
Change the current directory to 'dirname'.
Definition at line 156 of file dir.c.
References isc__errno2result, ISC_R_SUCCESS, and REQUIRE.
Referenced by directory_callback(), and main().
isc_result_t isc_dir_chroot | ( | const char * | dirname | ) |
Definition at line 170 of file dir.c.
References isc__errno2result, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, and REQUIRE.
Referenced by main().
isc_result_t isc_dir_createunique | ( | char * | templet | ) |
Use a templet (such as from isc_file_mktemplate()) to create a uniquely named, empty directory. The templet string is modified in place. If result == ISC_R_SUCCESS, it is the name of the directory that was created.
mkdtemp is not portable, so this emulates it.
Definition at line 185 of file dir.c.
References isc__errno2result, ISC_R_SUCCESS, and REQUIRE.