#include "ruby.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include <ctype.h>
#include "util.h"
Go to the source code of this file.
Data Structures | |
| struct | chdir_data |
| struct | dir_data |
| struct | glob_args |
Defines | |
| #define | NAMLEN(dirent) strlen((dirent)->d_name) |
| #define | FNM_NOESCAPE 0x01 |
| #define | FNM_PATHNAME 0x02 |
| #define | FNM_DOTMATCH 0x04 |
| #define | FNM_CASEFOLD 0x08 |
| #define | FNM_NOMATCH 1 |
| #define | FNM_ERROR 2 |
| #define | downcase(c) (nocase && ISUPPER(c) ? tolower(c) : (c)) |
| #define | CharNext(p) ((p) + 1) |
| #define | isdirsep(c) ((c) == '/') |
| #define | ISDIRSEP(c) (pathname && isdirsep(c)) |
| #define | PERIOD(s) |
| #define | GetDIR(obj, dirp) |
| #define | GLOB_VERBOSE (1 << (sizeof(int) * CHAR_BIT - 1)) |
| #define | sys_warning(val) ((flags & GLOB_VERBOSE) && rb_protect((VALUE (*)(VALUE))rb_sys_warning, (VALUE)(val), 0)) |
| #define | S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) |
| #define | glob_call_func(func, path, arg) (*func)(path, arg) |
| #define | BASE (*base && !(isdirsep(*base) && !base[1])) |
| #define | isdelim(c) ((c)=='\0') |
Functions | |
| char * | range (char *pat, int test, int flags) const |
| int | fnmatch (char *pat, const char *string, int flags) const |
| void | free_dir (struct dir_data *dir) |
| VALUE | dir_close (VALUE) |
| VALUE | dir_s_alloc (VALUE) |
| VALUE | dir_initialize (VALUE dir, VALUE dirname) |
| VALUE | dir_s_open (VALUE klass, VALUE dirname) |
| void | dir_closed () |
| VALUE | dir_path (VALUE dir) |
| VALUE | dir_read (VALUE dir) |
| VALUE | dir_each (VALUE dir) |
| VALUE | dir_tell (VALUE dir) |
| VALUE | dir_seek (VALUE dir, VALUE pos) |
| VALUE | dir_set_pos (VALUE dir, VALUE pos) |
| VALUE | dir_rewind (VALUE dir) |
| void | dir_chdir (VALUE path) |
| VALUE | chdir_yield (struct chdir_data *args) |
| VALUE | chdir_restore (struct chdir_data *args) |
| VALUE | dir_s_chdir (int argc, VALUE *argv, VALUE obj) |
| VALUE | dir_s_getwd (VALUE dir) |
| void | check_dirname (volatile VALUE *) |
| void | check_dirname (VALUE *dir) volatile |
| VALUE | dir_s_chroot (VALUE dir, VALUE path) |
| VALUE | dir_s_mkdir (int argc, VALUE *argv, VALUE obj) |
| VALUE | dir_s_rmdir (VALUE obj, VALUE dir) |
| int | has_magic (char *s, char *send, int flags) const |
| char * | extract_path (char *p, char *pend) const |
| char * | extract_elem (char *path) const |
| void | remove_backslashes (char *p) |
| VALUE | glob_func_caller (VALUE) |
| int | glob_helper (const char *path, const char *sub, int flags, int(*func(const char *, VALUE), VALUE arg)) |
| int | glob_helper (char *path, const char *sub, int flags, func, VALUE arg) const |
| int | ruby_glob (char *path, int flags, func, VALUE arg) const |
| int | ruby_globi (char *path, int flags, func, VALUE arg) const |
| int | rb_glob_caller (const char *, VALUE) |
| int | rb_glob_caller (char *path, VALUE a) const |
| int | rb_glob2 (char *path, int flags, func, VALUE arg) const |
| void | rb_glob (char *path, func, VALUE arg) const |
| void | rb_globi (char *path, func, VALUE arg) const |
| void | push_pattern (char *path, VALUE ary) const |
| int | push_globs (VALUE ary, const char *s, int flags) |
| int | push_braces (VALUE ary, const char *str, int flags) |
| VALUE | rb_push_glob (VALUE str, int flags) |
| VALUE | dir_s_aref (VALUE obj, VALUE str) |
| VALUE | dir_s_glob (int argc, VALUE *argv, VALUE obj) |
| VALUE | dir_open_dir (VALUE path) |
| VALUE | dir_foreach (VALUE io, VALUE dirname) |
| VALUE | dir_entries (VALUE io, VALUE dirname) |
| VALUE | file_s_fnmatch (int argc, VALUE *argv, VALUE obj) |
| void | Init_Dir () |
Variables | |
| VALUE | rb_cDir |
| int | chdir_blocking = 0 |
| VALUE | chdir_thread = Qnil |
|
|
Referenced by glob_helper(). |
|
|
Definition at line 84 of file dir.c. Referenced by file_expand_path(), rb_path_end(), rb_path_last_separator(), and rb_path_next(). |
|
|
|
|
|
Definition at line 73 of file dir.c. Referenced by fnmatch(), Init_Dir(), and range(). |
|
|
Definition at line 72 of file dir.c. Referenced by fnmatch(), and Init_Dir(). |
|
|
|
|
|
Definition at line 70 of file dir.c. Referenced by fnmatch(), glob_helper(), has_magic(), Init_Dir(), and range(). |
|
|
Definition at line 75 of file dir.c. Referenced by fnmatch(). |
|
|
Definition at line 71 of file dir.c. Referenced by fnmatch(), and Init_Dir(). |
|
|
Value: do {\ Data_Get_Struct(obj, struct dir_data, dirp);\ if (dirp->dir == NULL) dir_closed();\ } while (0) Definition at line 328 of file dir.c. Referenced by dir_close(), dir_each(), dir_path(), dir_read(), dir_rewind(), dir_seek(), and dir_tell(). |
|
|
Definition at line 902 of file dir.c. Referenced by glob_helper(). |
|
|
|
|
|
|
|
|
Definition at line 131 of file dir.c. Referenced by fnmatch(). |
|
|
Definition at line 91 of file dir.c. Referenced by file_expand_path(), fnmatch(), is_absolute_path(), rb_file_join(), rb_file_s_basename(), rb_file_s_dirname(), rb_path_end(), rb_path_last_separator(), rb_path_next(), rb_path_skip_prefix(), and skiproot(). |
|
|
Definition at line 26 of file dir.c. Referenced by dir_each(), dir_read(), and glob_helper(). |
|
|
Value: (period && *(s) == '.' && \ ((s) == string || ISDIRSEP((s)[-1]))) Definition at line 132 of file dir.c. Referenced by fnmatch(). |
|
|
Definition at line 881 of file dir.c. Referenced by dln_find_1(), glob_helper(), path_check_0(), rb_file_ftype(), rb_stat_d(), and test_d(). |
|
|
Definition at line 790 of file dir.c. Referenced by glob_helper(). |
|
|
Definition at line 575 of file dir.c. References args, chdir_blocking, chdir_thread, dir_chdir(), and Qnil. Referenced by dir_s_chdir(). |
|
|
Definition at line 563 of file dir.c. References args, chdir_blocking, chdir_thread, dir_chdir(), Qnil, Qtrue, rb_thread_current(), and rb_yield(). Referenced by dir_s_chdir(). |
|
|
Definition at line 694 of file dir.c. References rb_path_end(), rb_path_skip_prefix(), rb_secure(), rb_str_new(), RSTRING, SafeStringValue, and VALUE. Referenced by dir_s_chroot(), dir_s_mkdir(), and dir_s_rmdir(). |
|
|
|
|
|
Definition at line 547 of file dir.c. References rb_sys_fail(), RSTRING, and VALUE. Referenced by chdir_restore(), chdir_yield(), and dir_s_chdir(). |
|
|
Definition at line 534 of file dir.c. References GetDIR, NULL, Qnil, and VALUE. Referenced by dir_s_open(). |
|
|
Definition at line 323 of file dir.c. References rb_eIOError, and rb_raise(). Referenced by dir_each(). |
|
|
Definition at line 405 of file dir.c. References dir_closed(), GetDIR, NAMLEN, NULL, rb_tainted_str_new(), rb_yield(), and VALUE. |
|
||||||||||||
|
|
|
||||||||||||
|
Definition at line 1403 of file dir.c. References main(). |
|
||||||||||||
|
Definition at line 269 of file dir.c. References Data_Get_Struct, free, NULL, rb_gc(), rb_sys_fail(), RSTRING, SafeStringValue, strdup, and VALUE. Referenced by dir_s_open(). |
|
|
|
|
|
Definition at line 343 of file dir.c. References GetDIR, Qnil, rb_str_new2(), and VALUE. |
|
|
Definition at line 366 of file dir.c. References GetDIR, NAMLEN, Qnil, rb_sys_fail(), rb_tainted_str_new(), and VALUE. |
|
|
|
|
|
Definition at line 250 of file dir.c. References Data_Make_Struct, free_dir(), NULL, and VALUE. |
|
||||||||||||
|
Definition at line 1289 of file dir.c. References main(). |
|
||||||||||||||||
|
Definition at line 627 of file dir.c. References args, chdir_blocking, chdir_restore(), chdir_thread, chdir_yield(), dir_chdir(), free, getenv(), INT2FIX, my_getcwd, Qfalse, Qnil, rb_block_given_p(), rb_eArgError, rb_ensure(), rb_raise(), rb_scan_args(), rb_secure(), rb_str_new2(), rb_tainted_str_new2(), rb_thread_current(), rb_warn(), SafeStringValue, and VALUE. |
|
||||||||||||
|
Definition at line 717 of file dir.c. References check_dirname(), INT2FIX, Qnil, rb_notimplement(), rb_sys_fail(), RSTRING, and VALUE. |
|
|
Definition at line 678 of file dir.c. References free, my_getcwd, rb_secure(), rb_tainted_str_new2(), and VALUE. |
|
||||||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 747 of file dir.c. References check_dirname(), INT2FIX, NUM2INT, rb_scan_args(), rb_sys_fail(), RSTRING, and VALUE. |
|
||||||||||||
|
Definition at line 308 of file dir.c. References Data_Make_Struct, dir_close(), dir_initialize(), free_dir(), rb_block_given_p(), rb_ensure(), rb_yield(), and VALUE. |
|
||||||||||||
|
Definition at line 779 of file dir.c. References check_dirname(), INT2FIX, rb_sys_fail(), RSTRING, and VALUE. |
|
||||||||||||
|
Definition at line 464 of file dir.c. References GetDIR, NUM2OFFT, rb_notimplement(), and VALUE. Referenced by dir_set_pos(). |
|
||||||||||||
|
Definition at line 494 of file dir.c. References dir_seek(), and VALUE. |
|
|
Definition at line 434 of file dir.c. References GetDIR, rb_int2inum(), rb_notimplement(), and VALUE. |
|
|
Definition at line 853 of file dir.c. References extract_path(), and strchr(). Referenced by glob_helper(). |
|
||||||||||||
|
Definition at line 829 of file dir.c. References alloc, and ALLOC_N. Referenced by extract_elem(), and glob_helper(). |
|
||||||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 135 of file dir.c. References downcase, FNM_CASEFOLD, FNM_DOTMATCH, FNM_NOESCAPE, FNM_NOMATCH, FNM_PATHNAME, isdirsep, ISDIRSEP, NULL, PERIOD, range(), rb_path_next(), and strchr(). Referenced by glob_helper(), and Init_Dir(). |
|
|
Definition at line 236 of file dir.c. References free. Referenced by dir_s_alloc(), and dir_s_open(). |
|
|
|
|
||||||||||||||||||||||||
|
Definition at line 907 of file dir.c. References BASE, extract_elem(), extract_path(), FNM_NOESCAPE, fnmatch(), free, glob_call_func, has_magic(), NAMLEN, NULL, REALLOC_N, remove_backslashes(), S_ISDIR, strchr(), strdup, sys_warning, TRUE, VALUE, and xfree. |
|
||||||||||||||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 795 of file dir.c. References FNM_NOESCAPE, Qfalse, and Qtrue. Referenced by glob_helper(). |
|
|
Definition at line 1528 of file dir.c. References FNM_CASEFOLD, FNM_DOTMATCH, FNM_NOESCAPE, FNM_PATHNAME, and fnmatch(). Referenced by rb_call_inits(). |
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 95 of file dir.c. References downcase, FNM_CASEFOLD, FNM_NOESCAPE, and NULL. Referenced by fnmatch(). |
|
||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||
|
|
|
|
Definition at line 865 of file dir.c. Referenced by glob_helper(). |
|
||||||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
|
Definition at line 554 of file dir.c. Referenced by chdir_restore(), chdir_yield(), and dir_s_chdir(). |
|
|
Definition at line 555 of file dir.c. Referenced by chdir_restore(), chdir_yield(), and dir_s_chdir(). |
|
|
|
1.3.5