Data Structures | Defines | Enumerations | Functions | Variables

dir.c File Reference

#include "ruby/ruby.h"
#include "ruby/encoding.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <ctype.h>
#include "ruby/util.h"
Include dependency graph for dir.c:

Go to the source code of this file.

Data Structures

struct  dir_data
struct  chdir_data
struct  glob_pattern
struct  glob_args
struct  brace_args

Defines

#define dirent   direct
#define NAMLEN(dirent)   (dirent)->d_namlen
#define lstat   stat
#define FNM_NOESCAPE   0x01
#define FNM_PATHNAME   0x02
#define FNM_DOTMATCH   0x04
#define FNM_CASEFOLD   0x08
#define FNM_SYSCASE   0
#define FNM_NOMATCH   1
#define FNM_ERROR   2
#define Next(p, e, enc)   (p + rb_enc_mbclen(p, e, enc))
#define Inc(p, e, enc)   ((p) = Next(p, e, enc))
#define UNESCAPE(p)   (escape && *(p) == '\\' ? (p) + 1 : (p))
#define ISEND(p)   (!*(p) || (pathname && *(p) == '/'))
#define RETURN(val)   return *pcur = p, *scur = s, (val);
#define GlobPathValue(str, safe)
#define check_safe_glob(str, safe)   ((safe) ? rb_check_safe_obj(str) : (void)0)
#define check_glob_encoding(str)   rb_enc_check((str), rb_enc_from_encoding(rb_usascii_encoding()))
#define GetDIR(obj, dirp)   (dirp = dir_check(obj))
#define READDIR(dir, enc, entry, dp)   ((dp = readdir(dir)) != 0)
#define IF_HAVE_READDIR_R(something)
#define DEFINE_STRUCT_DIRENT   struct dirent
#define STRUCT_DIRENT(entry)   (entry)
#define dir_tell   rb_f_notimplement
#define dir_seek   rb_f_notimplement
#define dir_s_chroot   rb_f_notimplement
#define GLOB_VERBOSE   (1U << (sizeof(int) * CHAR_BIT - 1))
#define sys_warning(val)   (void)((flags & GLOB_VERBOSE) && rb_protect(sys_warning_1, (VALUE)(val), 0))
#define GLOB_ALLOC(type)   (type *)malloc(sizeof(type))
#define GLOB_ALLOC_N(type, n)   (type *)malloc(sizeof(type) * (n))
#define GLOB_FREE(ptr)   free(ptr)
#define GLOB_JUMP_TAG(status)   ((status == -1) ? rb_memerror() : rb_jump_tag(status))
#define to_be_ignored(e)   ((e) == ENOENT || (e) == ENOTDIR)
#define S_ISDIR(m)   ((m & S_IFMT) == S_IFDIR)
#define S_ISLNK(m)   (0)
#define glob_call_func(func, path, arg, enc)   (*func)(path, arg, enc)

Enumerations

enum  glob_pattern_type {
  PLAIN, MAGICAL, RECURSIVE, MATCH_ALL,
  MATCH_DIR
}
enum  answer { YES, NO, UNKNOWN }

Functions

char * getenv ()
char * strchr (char *, char)
static char * bracket (const char *p, const char *pend, const char *s, const char *send, int flags, rb_encoding *enc)
static int fnmatch_helper (const char **pcur, const char **scur, int flags, rb_encoding *enc)
static int fnmatch (const char *pattern, rb_encoding *enc, const char *string, int flags)
static void dir_mark (void *ptr)
static void dir_free (void *ptr)
static size_t dir_memsize (const void *ptr)
static VALUE dir_close (VALUE)
static VALUE dir_s_alloc (VALUE klass)
static VALUE dir_initialize (int argc, VALUE *argv, VALUE dir)
static VALUE dir_s_open (int argc, VALUE *argv, VALUE klass)
static void dir_closed (void)
static struct dir_datadir_check (VALUE dir)
static VALUE dir_inspect (VALUE dir)
static VALUE dir_path (VALUE dir)
static VALUE dir_read (VALUE dir)
static VALUE dir_each (VALUE dir)
static VALUE dir_set_pos (VALUE dir, VALUE pos)
static VALUE dir_rewind (VALUE dir)
static void dir_chdir (VALUE path)
static VALUE chdir_yield (struct chdir_data *args)
static VALUE chdir_restore (struct chdir_data *args)
static VALUE dir_s_chdir (int argc, VALUE *argv, VALUE obj)
VALUE rb_dir_getwd (void)
static VALUE dir_s_getwd (VALUE dir)
static void check_dirname (volatile VALUE *dir)
static VALUE dir_s_mkdir (int argc, VALUE *argv, VALUE obj)
static VALUE dir_s_rmdir (VALUE obj, VALUE dir)
static VALUE sys_warning_1 (VALUE mesg)
static int do_stat (const char *path, struct stat *pst, int flags)
static int do_lstat (const char *path, struct stat *pst, int flags)
static DIRdo_opendir (const char *path, int flags)
static int has_magic (const char *p, const char *pend, int flags, rb_encoding *enc)
static char * find_dirsep (const char *p, const char *pend, int flags, rb_encoding *enc)
static void remove_backslashes (char *p, rb_encoding *enc)
static void glob_free_pattern (struct glob_pattern *list)
static struct glob_patternglob_make_pattern (const char *p, const char *e, int flags, rb_encoding *enc)
static char * join_path (const char *path, int dirsep, const char *name)
static VALUE glob_func_caller (VALUE val)
static int glob_helper (const char *path, int dirsep, enum answer exist, enum answer isdir, struct glob_pattern **beg, struct glob_pattern **end, int flags, ruby_glob_func *func, VALUE arg, rb_encoding *enc)
static int ruby_glob0 (const char *path, int flags, ruby_glob_func *func, VALUE arg, rb_encoding *enc)
int ruby_glob (const char *path, int flags, ruby_glob_func *func, VALUE arg)
static int rb_glob_caller (const char *path, VALUE a, void *enc)
static int rb_glob2 (const char *path, int flags, void(*func)(const char *, VALUE, void *), VALUE arg, rb_encoding *enc)
void rb_glob (const char *path, void(*func)(const char *, VALUE, void *), VALUE arg)
static void push_pattern (const char *path, VALUE ary, void *enc)
static int ruby_brace_expand (const char *str, int flags, ruby_glob_func *func, VALUE arg, rb_encoding *enc)
static int glob_brace (const char *path, VALUE val, void *enc)
static int ruby_brace_glob0 (const char *str, int flags, ruby_glob_func *func, VALUE arg, rb_encoding *enc)
int ruby_brace_glob (const char *str, int flags, ruby_glob_func *func, VALUE arg)
int ruby_brace_glob_with_enc (const char *str, int flags, ruby_glob_func *func, VALUE arg, rb_encoding *enc)
static int push_glob (VALUE ary, VALUE str, int flags)
static VALUE rb_push_glob (VALUE str, int flags)
static VALUE dir_globs (long argc, VALUE *argv, int flags)
static VALUE dir_s_aref (int argc, VALUE *argv, VALUE obj)
static VALUE dir_s_glob (int argc, VALUE *argv, VALUE obj)
static VALUE dir_open_dir (int argc, VALUE *argv)
static VALUE dir_foreach (int argc, VALUE *argv, VALUE io)
static VALUE dir_entries (int argc, VALUE *argv, VALUE io)
static VALUE file_s_fnmatch (int argc, VALUE *argv, VALUE obj)
VALUE rb_home_dir (const char *user, VALUE result)
static VALUE dir_s_home (int argc, VALUE *argv, VALUE obj)
void Init_Dir (void)

Variables

VALUE rb_cDir
static const rb_data_type_t dir_data_type
static int chdir_blocking = 0
static VALUE chdir_thread = Qnil

Define Documentation

#define check_glob_encoding (   str  )     rb_enc_check((str), rb_enc_from_encoding(rb_usascii_encoding()))

Definition at line 359 of file dir.c.

#define check_safe_glob (   str,
  safe 
)    ((safe) ? rb_check_safe_obj(str) : (void)0)

Definition at line 358 of file dir.c.

#define DEFINE_STRUCT_DIRENT   struct dirent

Definition at line 555 of file dir.c.

Referenced by dir_each(), dir_read(), and glob_helper().

#define dir_s_chroot   rb_f_notimplement

Definition at line 935 of file dir.c.

Referenced by Init_Dir().

#define dir_seek   rb_f_notimplement

Definition at line 683 of file dir.c.

Referenced by dir_set_pos(), and Init_Dir().

#define dir_tell   rb_f_notimplement

Definition at line 654 of file dir.c.

Referenced by Init_Dir().

#define dirent   direct

Definition at line 31 of file dir.c.

Referenced by dir_each(), dir_read(), and glob_helper().

#define FNM_CASEFOLD   0x08

Definition at line 83 of file dir.c.

Referenced by Init_Dir().

#define FNM_DOTMATCH   0x04

Definition at line 82 of file dir.c.

Referenced by Init_Dir().

#define FNM_ERROR   2

Definition at line 91 of file dir.c.

#define FNM_NOESCAPE   0x01

Definition at line 80 of file dir.c.

Referenced by Init_Dir().

#define FNM_NOMATCH   1

Definition at line 90 of file dir.c.

Referenced by fnmatch_helper().

#define FNM_PATHNAME   0x02

Definition at line 81 of file dir.c.

Referenced by Init_Dir().

#define FNM_SYSCASE   0

Definition at line 87 of file dir.c.

Referenced by has_magic(), Init_Dir(), and rb_glob2().

#define GetDIR (   obj,
  dirp 
)    (dirp = dir_check(obj))

Definition at line 472 of file dir.c.

Referenced by dir_close(), dir_each(), dir_read(), and dir_rewind().

#define GLOB_ALLOC (   type  )     (type *)malloc(sizeof(type))

Definition at line 1003 of file dir.c.

Referenced by glob_make_pattern().

#define GLOB_ALLOC_N (   type,
  n 
)    (type *)malloc(sizeof(type) * (n))

Definition at line 1004 of file dir.c.

Referenced by glob_helper(), glob_make_pattern(), join_path(), ruby_brace_expand(), and ruby_glob0().

#define glob_call_func (   func,
  path,
  arg,
  enc 
)    (*func)(path, arg, enc)

Definition at line 1273 of file dir.c.

Referenced by glob_helper().

#define GLOB_FREE (   ptr  )     free(ptr)
#define GLOB_JUMP_TAG (   status  )     ((status == -1) ? rb_memerror() : rb_jump_tag(status))

Definition at line 1006 of file dir.c.

Referenced by dir_globs(), rb_glob(), and rb_push_glob().

#define GLOB_VERBOSE   (1U << (sizeof(int) * CHAR_BIT - 1))

Definition at line 999 of file dir.c.

Referenced by push_glob(), rb_glob2(), ruby_brace_glob(), ruby_brace_glob_with_enc(), and ruby_glob().

#define GlobPathValue (   str,
  safe 
)
Value:
/* can contain null bytes as separators */      \
    (!RB_TYPE_P(str, T_STRING) ?                \
     FilePathValue(str) :                       \
     (check_safe_glob(str, safe),               \
      check_glob_encoding(str), (str)))

Definition at line 352 of file dir.c.

Referenced by dir_globs(), dir_initialize(), and rb_push_glob().

#define IF_HAVE_READDIR_R (   something  ) 

Definition at line 523 of file dir.c.

Referenced by dir_each(), dir_read(), and glob_helper().

#define Inc (   p,
  e,
  enc 
)    ((p) = Next(p, e, enc))

Definition at line 94 of file dir.c.

Referenced by fnmatch(), fnmatch_helper(), remove_backslashes(), and ruby_brace_expand().

#define ISEND (   p  )     (!*(p) || (pathname && *(p) == '/'))

Definition at line 169 of file dir.c.

Referenced by fnmatch_helper().

#define lstat   stat

Definition at line 67 of file dir.c.

Referenced by do_lstat().

#define NAMLEN (   dirent  )     (dirent)->d_namlen

Definition at line 33 of file dir.c.

Referenced by dir_each(), and dir_read().

#define Next (   p,
  e,
  enc 
)    (p + rb_enc_mbclen(p, e, enc))

Definition at line 93 of file dir.c.

Referenced by find_dirsep(), and has_magic().

#define READDIR (   dir,
  enc,
  entry,
  dp 
)    ((dp = readdir(dir)) != 0)

Definition at line 518 of file dir.c.

Referenced by dir_each(), dir_read(), and glob_helper().

#define RETURN (   val  )     return *pcur = p, *scur = s, (val);
#define S_ISDIR (   m  )     ((m & S_IFMT) == S_IFDIR)

Definition at line 1246 of file dir.c.

Referenced by glob_helper(), path_check_0(), rb_file_directory_p(), rb_file_ftype(), and rb_stat_d().

#define S_ISLNK (   m  )     (0)
#define STRUCT_DIRENT (   entry  )     (entry)

Definition at line 556 of file dir.c.

Referenced by dir_each(), dir_read(), and glob_helper().

#define sys_warning (   val  )     (void)((flags & GLOB_VERBOSE) && rb_protect(sys_warning_1, (VALUE)(val), 0))

Definition at line 1000 of file dir.c.

Referenced by do_lstat(), do_opendir(), and do_stat().

#define to_be_ignored (   e  )     ((e) == ENOENT || (e) == ENOTDIR)

Definition at line 1012 of file dir.c.

Referenced by do_lstat(), do_opendir(), and do_stat().

#define UNESCAPE (   p  )     (escape && *(p) == '\\' ? (p) + 1 : (p))

Definition at line 168 of file dir.c.

Referenced by fnmatch_helper().


Enumeration Type Documentation

enum answer
Enumerator:
YES 
NO 
UNKNOWN 

Definition at line 1243 of file dir.c.

Enumerator:
PLAIN 
MAGICAL 
RECURSIVE 
MATCH_ALL 
MATCH_DIR 

Definition at line 1139 of file dir.c.


Function Documentation

static char* bracket ( const char *  p,
const char *  pend,
const char *  s,
const char *  send,
int  flags,
rb_encoding enc 
) [static]

Definition at line 97 of file dir.c.

References memcmp(), NULL, rb_enc_codepoint, rb_enc_mbclen(), and rb_enc_toupper().

Referenced by fnmatch_helper().

static VALUE chdir_restore ( struct chdir_data args  )  [static]

Definition at line 781 of file dir.c.

References dir_chdir(), chdir_data::done, and chdir_data::old_path.

Referenced by dir_s_chdir().

static VALUE chdir_yield ( struct chdir_data args  )  [static]

Definition at line 770 of file dir.c.

References dir_chdir(), chdir_data::done, chdir_data::new_path, Qnil, rb_thread_current(), and rb_yield().

Referenced by dir_s_chdir().

static void check_dirname ( volatile VALUE dir  )  [static]

Definition at line 901 of file dir.c.

References FilePathValue, rb_path_end(), rb_path_skip_prefix(), rb_secure(), rb_str_new(), and RSTRING_PTR.

Referenced by dir_s_mkdir(), and dir_s_rmdir().

static void dir_chdir ( VALUE  path  )  [static]

Definition at line 754 of file dir.c.

References rb_str_encode_ospath(), rb_sys_fail(), and RSTRING_PTR.

Referenced by chdir_restore(), chdir_yield(), and dir_s_chdir().

static struct dir_data* dir_check ( VALUE  dir  )  [static, read]
static VALUE dir_close ( VALUE  dir  )  [static]

Definition at line 742 of file dir.c.

References closedir, dir_data::dir, and GetDIR.

Referenced by dir_entries(), dir_foreach(), dir_s_open(), and Init_Dir().

static void dir_closed ( void   )  [static]

Definition at line 455 of file dir.c.

References rb_eIOError, and rb_raise().

Referenced by dir_check(), and dir_each().

static VALUE dir_each ( VALUE  dir  )  [static]
static VALUE dir_entries ( int  argc,
VALUE argv,
VALUE  io 
) [static]

Definition at line 1875 of file dir.c.

References dir_close(), dir_open_dir(), rb_Array(), and rb_ensure().

Referenced by Init_Dir().

static VALUE dir_foreach ( int  argc,
VALUE argv,
VALUE  io 
) [static]

Definition at line 1853 of file dir.c.

References dir_close(), dir_each(), dir_open_dir(), rb_ensure(), and RETURN_ENUMERATOR.

Referenced by Init_Dir().

static void dir_free ( void *  ptr  )  [static]

Definition at line 330 of file dir.c.

References closedir, dir_data::dir, and xfree().

static VALUE dir_globs ( long  argc,
VALUE argv,
int  flags 
) [static]

Definition at line 1693 of file dir.c.

References GLOB_JUMP_TAG, GlobPathValue, push_glob(), rb_ary_new(), and TRUE.

Referenced by dir_s_aref(), and dir_s_glob().

static VALUE dir_initialize ( int  argc,
VALUE argv,
VALUE  dir 
) [static]
static VALUE dir_inspect ( VALUE  dir  )  [static]
static void dir_mark ( void *  ptr  )  [static]

Definition at line 323 of file dir.c.

References dir_data::dir, dir_data::path, and rb_gc_mark().

static size_t dir_memsize ( const void *  ptr  )  [static]

Definition at line 340 of file dir.c.

static VALUE dir_open_dir ( int  argc,
VALUE argv 
) [static]

Definition at line 1822 of file dir.c.

References dir_data_type, rb_cDir, rb_funcall2(), rb_intern, and TypedData_Get_Struct.

Referenced by dir_entries(), and dir_foreach().

static VALUE dir_path ( VALUE  dir  )  [static]

Definition at line 504 of file dir.c.

References dir_data_type, NIL_P, dir_data::path, rb_str_dup(), and TypedData_Get_Struct.

Referenced by Init_Dir().

static VALUE dir_read ( VALUE  dir  )  [static]
static VALUE dir_rewind ( VALUE  dir  )  [static]

Definition at line 719 of file dir.c.

References dir_data::dir, GetDIR, OBJ_UNTRUSTED, rb_eSecurityError, rb_raise(), rb_safe_level, and rewinddir.

Referenced by Init_Dir().

static VALUE dir_s_alloc ( VALUE  klass  )  [static]

Definition at line 362 of file dir.c.

References dir_data::dir, dir_data_type, dir_data::enc, dir_data::path, and TypedData_Make_Struct.

Referenced by Init_Dir().

static VALUE dir_s_aref ( int  argc,
VALUE argv,
VALUE  obj 
) [static]

Definition at line 1720 of file dir.c.

References dir_globs(), and rb_push_glob().

Referenced by Init_Dir().

static VALUE dir_s_chdir ( int  argc,
VALUE argv,
VALUE  obj 
) [static]
static VALUE dir_s_getwd ( VALUE  dir  )  [static]

Definition at line 895 of file dir.c.

References rb_dir_getwd().

Referenced by Init_Dir().

static VALUE dir_s_glob ( int  argc,
VALUE argv,
VALUE  obj 
) [static]
static VALUE dir_s_home ( int  argc,
VALUE argv,
VALUE  obj 
) [static]

Definition at line 1997 of file dir.c.

References NIL_P, rb_home_dir(), rb_scan_args(), rb_str_new(), SafeStringValue, and StringValueCStr.

Referenced by Init_Dir().

static VALUE dir_s_mkdir ( int  argc,
VALUE argv,
VALUE  obj 
) [static]

Definition at line 952 of file dir.c.

References check_dirname(), INT2FIX, NUM2INT, rb_scan_args(), rb_str_encode_ospath(), rb_sys_fail(), and RSTRING_PTR.

Referenced by Init_Dir().

static VALUE dir_s_open ( int  argc,
VALUE argv,
VALUE  klass 
) [static]
static VALUE dir_s_rmdir ( VALUE  obj,
VALUE  dir 
) [static]

Definition at line 982 of file dir.c.

References check_dirname(), INT2FIX, rb_str_encode_ospath(), rb_sys_fail(), and RSTRING_PTR.

Referenced by Init_Dir().

static VALUE dir_set_pos ( VALUE  dir,
VALUE  pos 
) [static]

Definition at line 701 of file dir.c.

References dir_seek.

Referenced by Init_Dir().

static int do_lstat ( const char *  path,
struct stat *  pst,
int  flags 
) [static]

Definition at line 1027 of file dir.c.

References errno, lstat, sys_warning, and to_be_ignored.

Referenced by glob_helper().

static DIR* do_opendir ( const char *  path,
int  flags 
) [static]

Definition at line 1037 of file dir.c.

References errno, NULL, opendir, sys_warning, and to_be_ignored.

Referenced by glob_helper().

static int do_stat ( const char *  path,
struct stat *  pst,
int  flags 
) [static]

Definition at line 1016 of file dir.c.

References errno, stat, sys_warning, and to_be_ignored.

Referenced by glob_helper().

static VALUE file_s_fnmatch ( int  argc,
VALUE argv,
VALUE  obj 
) [static]

Definition at line 1965 of file dir.c.

References FilePathStringValue, fnmatch(), NUM2INT, rb_enc_get(), rb_scan_args(), RSTRING_PTR, and StringValue.

Referenced by Init_Dir().

static char* find_dirsep ( const char *  p,
const char *  pend,
int  flags,
rb_encoding enc 
) [static]

Definition at line 1080 of file dir.c.

References Next.

Referenced by glob_make_pattern().

static int fnmatch ( const char *  pattern,
rb_encoding enc,
const char *  string,
int  flags 
) [static]

Definition at line 265 of file dir.c.

References fnmatch_helper(), and Inc.

Referenced by file_s_fnmatch(), and glob_helper().

static int fnmatch_helper ( const char **  pcur,
const char **  scur,
int  flags,
rb_encoding enc 
) [static]
char* getenv (  ) 
static int glob_brace ( const char *  path,
VALUE  val,
void *  enc 
) [static]

Definition at line 1617 of file dir.c.

References brace_args::flags, brace_args::func, ruby_glob0(), and brace_args::value.

Referenced by ruby_brace_glob0().

static void glob_free_pattern ( struct glob_pattern list  )  [static]

Definition at line 1215 of file dir.c.

References GLOB_FREE, glob_pattern::next, and glob_pattern::str.

Referenced by glob_make_pattern(), and ruby_glob0().

static VALUE glob_func_caller ( VALUE  val  )  [static]

Definition at line 1265 of file dir.c.

References glob_args::enc, glob_args::func, glob_args::path, and glob_args::value.

Referenced by rb_glob_caller().

static int glob_helper ( const char *  path,
int  dirsep,
enum answer  exist,
enum answer  isdir,
struct glob_pattern **  beg,
struct glob_pattern **  end,
int  flags,
ruby_glob_func func,
VALUE  arg,
rb_encoding enc 
) [static]
static struct glob_pattern* glob_make_pattern ( const char *  p,
const char *  e,
int  flags,
rb_encoding enc 
) [static, read]
static int has_magic ( const char *  p,
const char *  pend,
int  flags,
rb_encoding enc 
) [static]

Definition at line 1048 of file dir.c.

References FNM_SYSCASE, ISALPHA, and Next.

Referenced by glob_make_pattern().

void Init_Dir ( void   ) 
static char* join_path ( const char *  path,
int  dirsep,
const char *  name 
) [static]

Definition at line 1227 of file dir.c.

References buf, GLOB_ALLOC_N, len, and strlcat().

Referenced by glob_helper().

static int push_glob ( VALUE  ary,
VALUE  str,
int  flags 
) [static]
static void push_pattern ( const char *  path,
VALUE  ary,
void *  enc 
) [static]

Definition at line 1546 of file dir.c.

References rb_ary_push(), and rb_external_str_new_with_enc().

VALUE rb_dir_getwd ( void   ) 
void rb_glob ( const char *  path,
void(*)(const char *, VALUE, void *)  func,
VALUE  arg 
)

Definition at line 1539 of file dir.c.

References func, GLOB_JUMP_TAG, rb_ascii8bit_encoding(), and rb_glob2().

static int rb_glob2 ( const char *  path,
int  flags,
void(*)(const char *, VALUE, void *)  func,
VALUE  arg,
rb_encoding enc 
) [static]
static int rb_glob_caller ( const char *  path,
VALUE  a,
void *  enc 
) [static]

Definition at line 1509 of file dir.c.

References glob_func_caller(), glob_args::path, and rb_protect().

Referenced by push_glob(), and rb_glob2().

VALUE rb_home_dir ( const char *  user,
VALUE  result 
)
static VALUE rb_push_glob ( VALUE  str,
int  flags 
) [static]
static void remove_backslashes ( char *  p,
rb_encoding enc 
) [static]

Definition at line 1115 of file dir.c.

References Inc, and memmove().

Referenced by glob_helper().

static int ruby_brace_expand ( const char *  str,
int  flags,
ruby_glob_func func,
VALUE  arg,
rb_encoding enc 
) [static]

Definition at line 1552 of file dir.c.

References buf, GLOB_ALLOC_N, GLOB_FREE, Inc, len, and strlcpy().

Referenced by ruby_brace_glob0().

int ruby_brace_glob ( const char *  str,
int  flags,
ruby_glob_func func,
VALUE  arg 
)

Definition at line 1637 of file dir.c.

References GLOB_VERBOSE, rb_ascii8bit_encoding(), and ruby_brace_glob0().

Referenced by cmdglob().

static int ruby_brace_glob0 ( const char *  str,
int  flags,
ruby_glob_func func,
VALUE  arg,
rb_encoding enc 
) [static]
int ruby_brace_glob_with_enc ( const char *  str,
int  flags,
ruby_glob_func func,
VALUE  arg,
rb_encoding enc 
)

Definition at line 1644 of file dir.c.

References GLOB_VERBOSE, and ruby_brace_glob0().

int ruby_glob ( const char *  path,
int  flags,
ruby_glob_func func,
VALUE  arg 
)

Definition at line 1502 of file dir.c.

References GLOB_VERBOSE, rb_ascii8bit_encoding(), and ruby_glob0().

static int ruby_glob0 ( const char *  path,
int  flags,
ruby_glob_func func,
VALUE  arg,
rb_encoding enc 
) [static]
char* strchr ( char *  ,
char   
)
static VALUE sys_warning_1 ( VALUE  mesg  )  [static]

Definition at line 993 of file dir.c.

References rb_sys_warning().


Variable Documentation

int chdir_blocking = 0 [static]

Definition at line 761 of file dir.c.

VALUE chdir_thread = Qnil [static]

Definition at line 762 of file dir.c.

const rb_data_type_t dir_data_type [static]
Initial value:
 {
    "dir",
    dir_mark, dir_free, dir_memsize
}

Definition at line 345 of file dir.c.

Referenced by dir_check(), dir_initialize(), dir_inspect(), dir_open_dir(), dir_path(), dir_s_alloc(), and dir_s_open().

Definition at line 314 of file dir.c.

Referenced by dir_open_dir(), and Init_Dir().