From dc73df1834c98dc13ba9c22bc3d009f604c07af7 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 8 Jul 2020 08:32:30 -0700 Subject: Expose low-level opendir/readdir dir traversal. * stream.c (UTF_DECL_OPENDIR): Macro defined, to enable w_opendir declaration in utf8.h. (w_opendir): Static function removed. * sysif.c (UTF_DECL_OPENDIR): Macro defined. (dir_s): Symbol defined unconditionally now, regardless of HAVE_PWUID. (dirent_s): New symbol. (dirent_st): New static variable. (struct dir): New struct type. (opendir_free, opendir_mark opendir_wrap, readdir_wrap): New static functions. (opendir_ops): New static structure. (sysif_init): Intern dirent symbol. Create dirent structure type. Register opendir and readdir intrinsic functions. Register variables dt-blk, dt-chr, dt-dir, dt-fifo, dt-lnk, dt-reg, dt-sock and dt-unknown. * utf8.c (UTF8_DECL_OPENDIR): Macro defined. (w_opendir): Function moved here from stream.c, and turned external. * utf8.h (w_opendir): Declared, conditionally on UTF8_DECL_OPENDIR being defined, so that most modules that include utf8.h don't have to include . * txr.1: Documented. diff --git a/sysif.c b/sysif.c --- utf8.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'utf8.h') diff --git a/utf8.h b/utf8.h index a8c48757..6d775451 100644 --- a/utf8.h +++ b/utf8.h @@ -56,3 +56,6 @@ FILE *w_freopen(const wchar_t *, const wchar_t *, FILE *); FILE *w_fdopen(int, const wchar_t *); int w_remove(const wchar_t *); int w_rename(const wchar_t *, const wchar_t *); +#ifdef UTF8_DECL_OPENDIR +DIR *w_opendir(const wchar_t *wname); +#endif -- cgit v1.2.3