diff --git a/file.c b/file.c index 29d401016b..c89cd855bb 100644 --- a/file.c +++ b/file.c @@ -153,13 +153,13 @@ apply2files(void (*func)(const char *, void *), VALUE vargs, void *arg) /* * call-seq: * file.path -> filename - * + * * Returns the pathname used to create file as a string. Does * not normalize the name. - * + * * File.new("testfile").path #=> "testfile" * File.new("/tmp/../tmp/xxx", "w").path #=> "/tmp/../tmp/xxx" - * + * */ static VALUE @@ -205,10 +205,10 @@ static struct timespec stat_mtimespec(struct stat *st); /* * call-seq: * stat <=> other_stat => -1, 0, 1 - * + * * Compares File::Stat objects by comparing their * respective modification times. - * + * * f1 = File.new("f1", "w") * sleep 1 * f2 = File.new("f2", "w") @@ -237,10 +237,10 @@ rb_stat_cmp(VALUE self, VALUE other) /* * call-seq: * stat.dev => fixnum - * + * * Returns an integer representing the device on which stat * resides. - * + * * File.stat("testfile").dev #=> 774 */ @@ -253,10 +253,10 @@ rb_stat_dev(VALUE self) /* * call-seq: * stat.dev_major => fixnum - * + * * Returns the major part of File_Stat#dev or * nil. - * + * * File.stat("/dev/fd1").dev_major #=> 2 * File.stat("/dev/tty").dev_major #=> 5 */ @@ -275,10 +275,10 @@ rb_stat_dev_major(VALUE self) /* * call-seq: * stat.dev_minor => fixnum - * + * * Returns the minor part of File_Stat#dev or * nil. - * + * * File.stat("/dev/fd1").dev_minor #=> 1 * File.stat("/dev/tty").dev_minor #=> 0 */ @@ -298,11 +298,11 @@ rb_stat_dev_minor(VALUE self) /* * call-seq: * stat.ino => fixnum - * + * * Returns the inode number for stat. - * + * * File.stat("testfile").ino #=> 1083669 - * + * */ static VALUE @@ -318,11 +318,11 @@ rb_stat_ino(VALUE self) /* * call-seq: * stat.mode => fixnum - * + * * Returns an integer representing the permission bits of * stat. The meaning of the bits is platform dependent; on * Unix systems, see stat(2). - * + * * File.chmod(0644, "testfile") #=> 1 * s = File.stat("testfile") * sprintf("%o", s.mode) #=> "100644" @@ -337,13 +337,13 @@ rb_stat_mode(VALUE self) /* * call-seq: * stat.nlink => fixnum - * + * * Returns the number of hard links to stat. - * + * * File.stat("testfile").nlink #=> 1 * File.link("testfile", "testfile.bak") #=> 0 * File.stat("testfile").nlink #=> 2 - * + * */ static VALUE @@ -356,11 +356,11 @@ rb_stat_nlink(VALUE self) /* * call-seq: * stat.uid => fixnum - * + * * Returns the numeric user id of the owner of stat. - * + * * File.stat("testfile").uid #=> 501 - * + * */ static VALUE @@ -372,11 +372,11 @@ rb_stat_uid(VALUE self) /* * call-seq: * stat.gid => fixnum - * + * * Returns the numeric group id of the owner of stat. - * + * * File.stat("testfile").gid #=> 500 - * + * */ static VALUE @@ -389,11 +389,11 @@ rb_stat_gid(VALUE self) /* * call-seq: * stat.rdev => fixnum or nil - * + * * Returns an integer representing the device type on which * stat resides. Returns nil if the operating * system doesn't support this feature. - * + * * File.stat("/dev/fd1").rdev #=> 513 * File.stat("/dev/tty").rdev #=> 1280 */ @@ -411,10 +411,10 @@ rb_stat_rdev(VALUE self) /* * call-seq: * stat.rdev_major => fixnum - * + * * Returns the major part of File_Stat#rdev or * nil. - * + * * File.stat("/dev/fd1").rdev_major #=> 2 * File.stat("/dev/tty").rdev_major #=> 5 */ @@ -433,10 +433,10 @@ rb_stat_rdev_major(VALUE self) /* * call-seq: * stat.rdev_minor => fixnum - * + * * Returns the minor part of File_Stat#rdev or * nil. - * + * * File.stat("/dev/fd1").rdev_minor #=> 1 * File.stat("/dev/tty").rdev_minor #=> 0 */ @@ -455,9 +455,9 @@ rb_stat_rdev_minor(VALUE self) /* * call-seq: * stat.size => fixnum - * + * * Returns the size of stat in bytes. - * + * * File.stat("testfile").size #=> 66 */ @@ -470,12 +470,12 @@ rb_stat_size(VALUE self) /* * call-seq: * stat.blksize => integer or nil - * + * * Returns the native file system's block size. Will return nil * on platforms that don't support this information. - * + * * File.stat("testfile").blksize #=> 4096 - * + * */ static VALUE @@ -491,11 +491,11 @@ rb_stat_blksize(VALUE self) /* * call-seq: * stat.blocks => integer or nil - * + * * Returns the number of native file system blocks allocated for this - * file, or nil if the operating system doesn't + * file, or nil if the operating system doesn't * support this feature. - * + * * File.stat("testfile").blocks #=> 2 */ @@ -584,12 +584,12 @@ stat_ctime(struct stat *st) /* * call-seq: * stat.atime => time - * + * * Returns the last access time for this file as an object of class * Time. - * + * * File.stat("testfile").atime #=> Wed Dec 31 18:00:00 CST 1969 - * + * */ static VALUE @@ -601,11 +601,11 @@ rb_stat_atime(VALUE self) /* * call-seq: * stat.mtime -> aTime - * + * * Returns the modification time of stat. - * + * * File.stat("testfile").mtime #=> Wed Apr 09 08:53:14 CDT 2003 - * + * */ static VALUE @@ -617,13 +617,13 @@ rb_stat_mtime(VALUE self) /* * call-seq: * stat.ctime -> aTime - * + * * Returns the change time for stat (that is, the time * directory information about the file was changed, not the file * itself). - * + * * File.stat("testfile").ctime #=> Wed Apr 09 08:53:14 CDT 2003 - * + * */ static VALUE @@ -639,10 +639,10 @@ rb_stat_ctime(VALUE self) * Produce a nicely formatted description of stat. * * File.stat("/etc/passwd").inspect - * #=> "# "#" */ @@ -757,12 +757,12 @@ w32_io_info(VALUE *file, BY_HANDLE_FILE_INFORMATION *st) /* * call-seq: * File.stat(file_name) => stat - * + * * Returns a File::Stat object for the named file (see * File::Stat). - * + * * File.stat("testfile").mtime #=> Tue Apr 08 12:58:04 CDT 2003 - * + * */ static VALUE @@ -782,16 +782,16 @@ rb_file_s_stat(VALUE klass, VALUE fname) /* * call-seq: * ios.stat => stat - * + * * Returns status information for ios as an object of type * File::Stat. - * + * * f = File.new("testfile") * s = f.stat * "%o" % s.mode #=> "100644" * s.blksize #=> 4096 * s.atime #=> Wed Apr 09 08:53:54 CDT 2003 - * + * */ static VALUE @@ -811,15 +811,15 @@ rb_io_stat(VALUE obj) /* * call-seq: * File.lstat(file_name) => stat - * + * * Same as File::stat, but does not follow the last symbolic * link. Instead, reports on the link itself. - * + * * File.symlink("testfile", "link2test") #=> 0 * File.stat("testfile").size #=> 66 * File.lstat("link2test").size #=> 8 * File.stat("link2test").size #=> 66 - * + * */ static VALUE @@ -843,10 +843,10 @@ rb_file_s_lstat(VALUE klass, VALUE fname) /* * call-seq: * file.lstat => stat - * + * * Same as IO#stat, but does not follow the last symbolic * link. Instead, reports on the link itself. - * + * * File.symlink("testfile", "link2test") #=> 0 * File.stat("testfile").size #=> 66 * f = File.new("link2test") @@ -962,7 +962,7 @@ eaccess(const char *path, int mode) * those used in File::Stat. It exists as a standalone * module, and its methods are also insinuated into the File * class. (Note that this is not done by inclusion: the interpreter cheats). - * + * */ @@ -1226,7 +1226,7 @@ rb_file_readable_real_p(VALUE obj, VALUE fname) * representing the file permission bits of file_name. Returns * nil otherwise. The meaning of the bits is platform * dependent; on Unix systems, see stat(2). - * + * * File.world_readable?("/etc/passwd") # => 420 * m = File.world_readable?("/etc/passwd") * sprintf("%o", m) # => "644" @@ -1288,7 +1288,7 @@ rb_file_writable_real_p(VALUE obj, VALUE fname) * representing the file permission bits of file_name. Returns * nil otherwise. The meaning of the bits is platform * dependent; on Unix systems, see stat(2). - * + * * File.world_writable?("/tmp") #=> 511 * m = File.world_writable?("/tmp") * sprintf("%o", m) #=> "777" @@ -1642,13 +1642,13 @@ rb_file_ftype(const struct stat *st) /* * call-seq: * File.ftype(file_name) => string - * + * * Identifies the type of the named file; the return string is one of * ``file'', ``directory'', * ``characterSpecial'', ``blockSpecial'', * ``fifo'', ``link'', * ``socket'', or ``unknown''. - * + * * File.ftype("testfile") #=> "file" * File.ftype("/dev/tty") #=> "characterSpecial" * File.ftype("/tmp/.X11-unix/X0") #=> "socket" @@ -1671,11 +1671,11 @@ rb_file_s_ftype(VALUE klass, VALUE fname) /* * call-seq: * File.atime(file_name) => time - * + * * Returns the last access time for the named file as a Time object). - * + * * File.atime("testfile") #=> Wed Apr 09 08:51:48 CDT 2003 - * + * */ static VALUE @@ -1693,12 +1693,12 @@ rb_file_s_atime(VALUE klass, VALUE fname) /* * call-seq: * file.atime => time - * + * * Returns the last access time (a Time object) * for file, or epoch if file has not been accessed. - * + * * File.new("testfile").atime #=> Wed Dec 31 18:00:00 CST 1969 - * + * */ static VALUE @@ -1717,11 +1717,11 @@ rb_file_atime(VALUE obj) /* * call-seq: * File.mtime(file_name) => time - * + * * Returns the modification time for the named file as a Time object. - * + * * File.mtime("testfile") #=> Tue Apr 08 12:58:04 CDT 2003 - * + * */ static VALUE @@ -1739,11 +1739,11 @@ rb_file_s_mtime(VALUE klass, VALUE fname) /* * call-seq: * file.mtime -> time - * + * * Returns the modification time for file. - * + * * File.new("testfile").mtime #=> Wed Apr 09 08:53:14 CDT 2003 - * + * */ static VALUE @@ -1762,13 +1762,13 @@ rb_file_mtime(VALUE obj) /* * call-seq: * File.ctime(file_name) => time - * + * * Returns the change time for the named file (the time at which * directory information about the file was changed, not the file * itself). - * + * * File.ctime("testfile") #=> Wed Apr 09 08:53:13 CDT 2003 - * + * */ static VALUE @@ -1786,12 +1786,12 @@ rb_file_s_ctime(VALUE klass, VALUE fname) /* * call-seq: * file.ctime -> time - * + * * Returns the change time for file (that is, the time directory * information about the file was changed, not the file itself). - * + * * File.new("testfile").ctime #=> Wed Apr 09 08:53:14 CDT 2003 - * + * */ static VALUE @@ -1817,13 +1817,13 @@ chmod_internal(const char *path, void *mode) /* * call-seq: * File.chmod(mode_int, file_name, ... ) -> integer - * + * * Changes permission bits on the named file(s) to the bit pattern * represented by mode_int. Actual effects are operating system * dependent (see the beginning of this section). On Unix systems, see * chmod(2) for details. Returns the number of files * processed. - * + * * File.chmod(0644, "testfile", "out") #=> 2 */ @@ -1846,12 +1846,12 @@ rb_file_s_chmod(int argc, VALUE *argv) /* * call-seq: * file.chmod(mode_int) => 0 - * + * * Changes permission bits on file to the bit pattern * represented by mode_int. Actual effects are platform * dependent; on Unix systems, see chmod(2) for details. * Follows symbolic links. Also see File#lchmod. - * + * * f = File.new("out", "w"); * f.chmod(0644) #=> 0 */ @@ -1889,11 +1889,11 @@ lchmod_internal(const char *path, void *mode) /* * call-seq: * File.lchmod(mode_int, file_name, ...) => integer - * + * * Equivalent to File::chmod, but does not follow symbolic * links (so it will change the permissions associated with the link, * not the file referenced by the link). Often not available. - * + * */ static VALUE @@ -1935,16 +1935,16 @@ chown_internal(const char *path, void *arg) /* * call-seq: * File.chown(owner_int, group_int, file_name,... ) -> integer - * + * * Changes the owner and group of the named file(s) to the given * numeric owner and group id's. Only a process with superuser * privileges may change the owner of a file. The current owner of a * file may change the file's group to any group to which the owner * belongs. A nil or -1 owner or group id is ignored. * Returns the number of files processed. - * + * * File.chown(nil, 100, "testfile") - * + * */ static VALUE @@ -1976,16 +1976,16 @@ rb_file_s_chown(int argc, VALUE *argv) /* * call-seq: * file.chown(owner_int, group_int ) => 0 - * + * * Changes the owner and group of file to the given numeric * owner and group id's. Only a process with superuser privileges may * change the owner of a file. The current owner of a file may change * the file's group to any group to which the owner belongs. A * nil or -1 owner or group id is ignored. Follows * symbolic links. See also File#lchown. - * + * * File.new("testfile").chown(502, 1000) - * + * */ static VALUE @@ -2023,12 +2023,12 @@ lchown_internal(const char *path, void *arg) /* * call-seq: * file.lchown(owner_int, group_int, file_name,..) => integer - * + * * Equivalent to File::chown, but does not follow symbolic * links (so it will change the owner associated with the link, not the * file referenced by the link). Often not available. Returns number * of files in the argument list. - * + * */ static VALUE @@ -2193,11 +2193,11 @@ sys_fail2(VALUE s1, VALUE s2) /* * call-seq: * File.link(old_name, new_name) => 0 - * + * * Creates a new name for an existing file using a hard link. Will not * overwrite new_name if it already exists (raising a subclass * of SystemCallError). Not available on all platforms. - * + * * File.link("testfile", ".testfile") #=> 0 * IO.readlines(".testfile")[0] #=> "This is line one\n" */ @@ -2223,13 +2223,13 @@ rb_file_s_link(VALUE klass, VALUE from, VALUE to) /* * call-seq: * File.symlink(old_name, new_name) => 0 - * + * * Creates a symbolic link called new_name for the existing file * old_name. Raises a NotImplemented exception on * platforms that do not support symbolic links. - * + * * File.symlink("testfile", "link2test") #=> 0 - * + * */ static VALUE @@ -2253,10 +2253,10 @@ rb_file_s_symlink(VALUE klass, VALUE from, VALUE to) /* * call-seq: * File.readlink(link_name) -> file_name - * + * * Returns the name of the file referenced by the given link. * Not available on all platforms. - * + * * File.symlink("testfile", "link2test") #=> 0 * File.readlink("link2test") #=> "testfile" */ @@ -2306,7 +2306,7 @@ unlink_internal(const char *path, void *arg) * call-seq: * File.delete(file_name, ...) => integer * File.unlink(file_name, ...) => integer - * + * * Deletes the named files, returning the number of names * passed as arguments. Raises an exception on any error. * See also Dir::rmdir. @@ -2325,10 +2325,10 @@ rb_file_s_unlink(VALUE klass, VALUE args) /* * call-seq: * File.rename(old_name, new_name) => 0 - * + * * Renames the given file to the new name. Raises a * SystemCallError if the file cannot be renamed. - * + * * File.rename("afile", "afile.bak") #=> 0 */ @@ -2368,13 +2368,13 @@ rb_file_s_rename(VALUE klass, VALUE from, VALUE to) * call-seq: * File.umask() => integer * File.umask(integer) => integer - * + * * Returns the current umask value for this process. If the optional * argument is given, set the umask to that value and return the * previous value. Umask values are subtracted from the * default permissions, so a umask of 0222 would make a * file read-only for everyone. - * + * * File.umask(0006) #=> 18 * File.umask #=> 6 */ @@ -2409,11 +2409,13 @@ rb_file_s_umask(int argc, VALUE *argv) #define isdirsep(x) ((x) == '/') #endif +#ifndef USE_NTFS #if defined _WIN32 || defined __CYGWIN__ #define USE_NTFS 1 #else #define USE_NTFS 0 #endif +#endif #if USE_NTFS #define istrailinggabage(x) ((x) == '.' || (x) == ' ') @@ -2485,7 +2487,7 @@ rb_path_next(const char *s) return (char *)s; } -#if defined(DOSISH_UNC) || defined(DOSISH_DRIVE_LETTER) +#if defined(DOSISH_UNC) || defined(DOSISH_DRIVE_LETTER) #define skipprefix rb_path_skip_prefix #else #define skipprefix(path) (path) @@ -2493,7 +2495,7 @@ rb_path_next(const char *s) char * rb_path_skip_prefix(const char *path) { -#if defined(DOSISH_UNC) || defined(DOSISH_DRIVE_LETTER) +#if defined(DOSISH_UNC) || defined(DOSISH_DRIVE_LETTER) #ifdef DOSISH_UNC if (isdirsep(path[0]) && isdirsep(path[1])) { path += 2; @@ -2851,7 +2853,7 @@ file_expand_path(VALUE fname, VALUE dname, int abs_mode, VALUE result) } if (p == skiproot(buf) - 1) p++; -#if USE_NTFS +#if USE_NTFS && defined __WIN32__ *p = '\0'; if ((s = strrdirsep(b = buf)) != 0 && !strpbrk(s, "*?")) { size_t len; @@ -2919,7 +2921,7 @@ rb_file_expand_path(VALUE fname, VALUE dname) /* * call-seq: * File.expand_path(file_name [, dir_string] ) -> abs_file_name - * + * * Converts a pathname to an absolute pathname. Relative paths are * referenced from the current working directory of the process unless * dir_string is given, in which case it will be used as the @@ -2928,7 +2930,7 @@ rb_file_expand_path(VALUE fname, VALUE dname) * directory (the environment variable HOME must be set * correctly). ``~user'' expands to the named * user's home directory. - * + * * File.expand_path("~oracle/bin") #=> "/home/oracle/bin" * File.expand_path("../../bin", "/tmp/x") #=> "/bin" */ @@ -2955,13 +2957,13 @@ rb_file_absolute_path(VALUE fname, VALUE dname) /* * call-seq: * File.absolute_path(file_name [, dir_string] ) -> abs_file_name - * + * * Converts a pathname to an absolute pathname. Relative paths are * referenced from the current working directory of the process unless * dir_string is given, in which case it will be used as the * starting point. If the given pathname starts with a ``~'' * it is NOT expanded, it is treated as a normal directory name. - * + * * File.absolute_path("~oracle/bin") #=> "/~oracle/bin" */ @@ -3013,13 +3015,13 @@ rmext(const char *p, int l1, const char *e) /* * call-seq: * File.basename(file_name [, suffix] ) -> base_name - * + * * Returns the last component of the filename given in file_name, * which must be formed using forward slashes (``/'') * regardless of the separator used on the local file system. If * suffix is given and present at the end of file_name, * it is removed. - * + * * File.basename("/home/gumby/work/ruby.rb") #=> "ruby.rb" * File.basename("/home/gumby/work/ruby.rb", ".rb") #=> "ruby" */ @@ -3092,12 +3094,12 @@ rb_file_s_basename(int argc, VALUE *argv) /* * call-seq: * File.dirname(file_name ) -> dir_name - * + * * Returns all components of the filename given in file_name * except the last one. The filename must be formed using forward * slashes (``/'') regardless of the separator used on the * local file system. - * + * * File.dirname("/home/gumby/work/ruby.rb") #=> "/home/gumby/work" */ @@ -3144,15 +3146,15 @@ rb_file_s_dirname(VALUE klass, VALUE fname) /* * call-seq: * File.extname(path) -> string - * + * * Returns the extension (the portion of file name in path * after the period). - * + * * File.extname("test.rb") #=> ".rb" * File.extname("a/b/d/test.rb") #=> ".rb" * File.extname("test") #=> "" * File.extname(".profile") #=> "" - * + * */ static VALUE @@ -3209,12 +3211,12 @@ rb_file_s_extname(VALUE klass, VALUE fname) /* * call-seq: * File.path(path) -> string - * + * * Returns the string representation of the path - * + * * File.path("/dev/null") #=> "/dev/null" * File.path(Pathname.new("/tmp")) #=> "/tmp" - * + * */ static VALUE @@ -3226,11 +3228,11 @@ rb_file_s_path(VALUE klass, VALUE fname) /* * call-seq: * File.split(file_name) => array - * + * * Splits the given string into a directory and a file component and * returns them in a two-element array. See also * File::dirname and File::basename. - * + * * File.split("/home/gumby/.profile") #=> ["/home/gumby", ".profile"] */ @@ -3313,12 +3315,12 @@ rb_file_join(VALUE ary, VALUE sep) /* * call-seq: * File.join(string, ...) -> path - * + * * Returns a new string formed by joining the strings using * File::SEPARATOR. - * + * * File.join("usr", "mail", "gumby") #=> "usr/mail/gumby" - * + * */ static VALUE @@ -3330,16 +3332,16 @@ rb_file_s_join(VALUE klass, VALUE args) /* * call-seq: * File.truncate(file_name, integer) => 0 - * + * * Truncates the file file_name to be at most integer * bytes long. Not available on all platforms. - * + * * f = File.new("out", "w") * f.write("1234567890") #=> 10 * f.close #=> nil * File.truncate("out", 5) #=> 0 * File.size("out") #=> 5 - * + * */ static VALUE @@ -3383,10 +3385,10 @@ rb_file_s_truncate(VALUE klass, VALUE path, VALUE len) /* * call-seq: * file.truncate(integer) => 0 - * + * * Truncates file to at most integer bytes. The file * must be opened for writing. Not available on all platforms. - * + * * f = File.new("out", "w") * f.syswrite("1234567890") #=> 10 * f.truncate(5) #=> 0 @@ -3459,13 +3461,13 @@ rb_thread_flock(void *data) /* * call-seq: * file.flock (locking_constant ) => 0 or false - * + * * Locks or unlocks a file according to locking_constant (a * logical or of the values in the table below). * Returns false if File::LOCK_NB is * specified and the operation would otherwise have blocked. Not * available on all platforms. - * + * * Locking constants (in class File): * * LOCK_EX | Exclusive lock. Only one process may hold an @@ -3482,7 +3484,7 @@ rb_thread_flock(void *data) * Example: * * File.new("testfile").flock(File::LOCK_UN) #=> 0 - * + * */ static VALUE @@ -3552,11 +3554,11 @@ test_check(int n, int argc, VALUE *argv) /* * call-seq: * test(int_cmd, file1 [, file2] ) => obj - * + * * Uses the integer aCmd to perform various tests on * file1 (first table below) or on file1 and * file2 (second table). - * + * * File tests on a single file: * * Test Returns Meaning @@ -3574,7 +3576,7 @@ test_check(int n, int argc, VALUE *argv) * ?k | boolean | True if file1 exists and has the sticky bit set * ?l | boolean | True if file1 exists and is a symbolic link * ?M | Time | Last modification time for file1 - * ?o | boolean | True if file1 exists and is owned by + * ?o | boolean | True if file1 exists and is owned by * | | the caller's effective uid * ?O | boolean | True if file1 exists and is owned by * | | the caller's real uid @@ -3825,15 +3827,15 @@ rb_stat_init_copy(VALUE copy, VALUE orig) /* * call-seq: * stat.ftype => string - * + * * Identifies the type of stat. The return string is one of: * ``file'', ``directory'', * ``characterSpecial'', ``blockSpecial'', * ``fifo'', ``link'', * ``socket'', or ``unknown''. - * + * * File.stat("/dev/tty").ftype #=> "characterSpecial" - * + * */ static VALUE @@ -3845,10 +3847,10 @@ rb_stat_ftype(VALUE obj) /* * call-seq: * stat.directory? => true or false - * + * * Returns true if stat is a directory, * false otherwise. - * + * * File.stat("testfile").directory? #=> false * File.stat(".").directory? #=> true */ @@ -3863,7 +3865,7 @@ rb_stat_d(VALUE obj) /* * call-seq: * stat.pipe? => true or false - * + * * Returns true if the operating system supports pipes and * stat is a pipe; false otherwise. */ @@ -3881,18 +3883,18 @@ rb_stat_p(VALUE obj) /* * call-seq: * stat.symlink? => true or false - * + * * Returns true if stat is a symbolic link, * false if it isn't or if the operating system doesn't * support this feature. As File::stat automatically * follows symbolic links, symlink? will always be * false for an object returned by * File::stat. - * + * * File.symlink("testfile", "alink") #=> 0 * File.stat("alink").symlink? #=> false * File.lstat("alink").symlink? #=> true - * + * */ static VALUE @@ -3907,13 +3909,13 @@ rb_stat_l(VALUE obj) /* * call-seq: * stat.socket? => true or false - * + * * Returns true if stat is a socket, * false if it isn't or if the operating system doesn't * support this feature. - * + * * File.stat("testfile").socket? #=> false - * + * */ static VALUE @@ -3929,14 +3931,14 @@ rb_stat_S(VALUE obj) /* * call-seq: * stat.blockdev? => true or false - * + * * Returns true if the file is a block device, * false if it isn't or if the operating system doesn't * support this feature. - * + * * File.stat("testfile").blockdev? #=> false * File.stat("/dev/hda1").blockdev? #=> true - * + * */ static VALUE @@ -3952,13 +3954,13 @@ rb_stat_b(VALUE obj) /* * call-seq: * stat.chardev? => true or false - * + * * Returns true if the file is a character device, * false if it isn't or if the operating system doesn't * support this feature. - * + * * File.stat("/dev/tty").chardev? #=> true - * + * */ static VALUE @@ -3972,13 +3974,13 @@ rb_stat_c(VALUE obj) /* * call-seq: * stat.owned? => true or false - * + * * Returns true if the effective user id of the process is * the same as the owner of stat. - * + * * File.stat("testfile").owned? #=> true * File.stat("/etc/passwd").owned? #=> false - * + * */ static VALUE @@ -3998,13 +4000,13 @@ rb_stat_rowned(VALUE obj) /* * call-seq: * stat.grpowned? => true or false - * + * * Returns true if the effective group id of the process is the same as * the group id of stat. On Windows NT, returns false. - * + * * File.stat("testfile").grpowned? #=> true * File.stat("/etc/passwd").grpowned? #=> false - * + * */ static VALUE @@ -4019,12 +4021,12 @@ rb_stat_grpowned(VALUE obj) /* * call-seq: * stat.readable? => true or false - * + * * Returns true if stat is readable by the * effective user id of this process. - * + * * File.stat("testfile").readable? #=> true - * + * */ static VALUE @@ -4054,12 +4056,12 @@ rb_stat_r(VALUE obj) /* * call-seq: * stat.readable_real? -> true or false - * + * * Returns true if stat is readable by the real * user id of this process. - * + * * File.stat("testfile").readable_real? #=> true - * + * */ static VALUE @@ -4092,7 +4094,7 @@ rb_stat_R(VALUE obj) * representing the file permission bits of stat. Returns * nil otherwise. The meaning of the bits is platform * dependent; on Unix systems, see stat(2). - * + * * m = File.stat("/etc/passwd").world_readable? # => 420 * sprintf("%o", m) # => "644" */ @@ -4113,12 +4115,12 @@ rb_stat_wr(VALUE obj) /* * call-seq: * stat.writable? -> true or false - * + * * Returns true if stat is writable by the * effective user id of this process. - * + * * File.stat("testfile").writable? #=> true - * + * */ static VALUE @@ -4146,12 +4148,12 @@ rb_stat_w(VALUE obj) /* * call-seq: * stat.writable_real? -> true or false - * + * * Returns true if stat is writable by the real * user id of this process. - * + * * File.stat("testfile").writable_real? #=> true - * + * */ static VALUE @@ -4184,7 +4186,7 @@ rb_stat_W(VALUE obj) * representing the file permission bits of stat. Returns * nil otherwise. The meaning of the bits is platform * dependent; on Unix systems, see stat(2). - * + * * m = File.stat("/tmp").world_writable? # => 511 * sprintf("%o", m) # => "777" */ @@ -4205,14 +4207,14 @@ rb_stat_ww(VALUE obj) /* * call-seq: * stat.executable? => true or false - * + * * Returns true if stat is executable or if the * operating system doesn't distinguish executable files from * nonexecutable files. The tests are made using the effective owner of * the process. - * + * * File.stat("testfile").executable? #=> false - * + * */ static VALUE @@ -4242,7 +4244,7 @@ rb_stat_x(VALUE obj) /* * call-seq: * stat.executable_real? => true or false - * + * * Same as executable?, but tests using the real owner of * the process. */ @@ -4275,12 +4277,12 @@ rb_stat_X(VALUE obj) /* * call-seq: * stat.file? => true or false - * + * * Returns true if stat is a regular file (not * a device file, pipe, socket, etc.). - * + * * File.stat("testfile").file? #=> true - * + * */ static VALUE @@ -4293,12 +4295,12 @@ rb_stat_f(VALUE obj) /* * call-seq: * stat.zero? => true or false - * + * * Returns true if stat is a zero-length file; * false otherwise. - * + * * File.stat("testfile").zero? #=> false - * + * */ static VALUE @@ -4312,11 +4314,11 @@ rb_stat_z(VALUE obj) /* * call-seq: * state.size => integer - * + * * Returns the size of stat in bytes. - * + * * File.stat("testfile").size #=> 66 - * + * */ static VALUE @@ -4331,11 +4333,11 @@ rb_stat_s(VALUE obj) /* * call-seq: * stat.setuid? => true or false - * + * * Returns true if stat has the set-user-id * permission bit set, false if it doesn't or if the * operating system doesn't support this feature. - * + * * File.stat("/bin/su").setuid? #=> true */ @@ -4351,13 +4353,13 @@ rb_stat_suid(VALUE obj) /* * call-seq: * stat.setgid? => true or false - * + * * Returns true if stat has the set-group-id * permission bit set, false if it doesn't or if the * operating system doesn't support this feature. - * + * * File.stat("/usr/sbin/lpc").setgid? #=> true - * + * */ static VALUE @@ -4372,13 +4374,13 @@ rb_stat_sgid(VALUE obj) /* * call-seq: * stat.sticky? => true or false - * + * * Returns true if stat has its sticky bit set, * false if it doesn't or if the operating system doesn't * support this feature. - * + * * File.stat("testfile").sticky? #=> false - * + * */ static VALUE @@ -4652,7 +4654,7 @@ define_filetest_function(const char *name, VALUE (*func)(ANYARGS), int argc) * File includes the methods of module * FileTest as class methods, allowing you to write (for * example) File.exist?("foo"). - * + * * In the description of File methods, * permission bits are a platform-specific * set of bits that indicate permissions of a file. On Unix-based @@ -4660,7 +4662,7 @@ define_filetest_function(const char *name, VALUE (*func)(ANYARGS), int argc) * owner, the group, and the rest of the world. For each of these * entities, permissions may be set to read, write, or execute the * file: - * + * * The permission bits 0644 (in octal) would thus be * interpreted as read/write for owner, and read-only for group and * other. Higher-order bits may also be used to indicate the type of @@ -4668,7 +4670,7 @@ define_filetest_function(const char *name, VALUE (*func)(ANYARGS), int argc) * special features. If the permissions are for a directory, the * meaning of the execute bit changes; when set the directory can be * searched. - * + * * On non-Posix operating systems, there may be only the ability to * make a file read-only or read-write. In this case, the remaining * permission bits will be synthesized to resemble typical values. For