summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-18 03:04:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-18 03:04:49 +0000
commit656e005ac0ceef8f2e174ea96cb244ef692944d4 (patch)
tree673bdd8789f442d796ffd0c771999805ff4bdf65 /file.c
parent17aa3d898da249ddd1478b21de6187bfdd873497 (diff)
* file.c: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c416
1 files changed, 209 insertions, 207 deletions
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 <i>file</i> 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 <code>File::Stat</code> 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 <i>stat</i>
* 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 <code>File_Stat#dev</code> or
* <code>nil</code>.
- *
+ *
* 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 <code>File_Stat#dev</code> or
* <code>nil</code>.
- *
+ *
* 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 <i>stat</i>.
- *
+ *
* 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
* <i>stat</i>. The meaning of the bits is platform dependent; on
* Unix systems, see <code>stat(2)</code>.
- *
+ *
* 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 <i>stat</i>.
- *
+ *
* 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 <i>stat</i>.
- *
+ *
* 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 <i>stat</i>.
- *
+ *
* 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
* <i>stat</i> resides. Returns <code>nil</code> 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 <code>File_Stat#rdev</code> or
* <code>nil</code>.
- *
+ *
* 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 <code>File_Stat#rdev</code> or
* <code>nil</code>.
- *
+ *
* 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 <i>stat</i> 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 <code>nil</code>
* 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 <code>nil</code> if the operating system doesn't
+ * file, or <code>nil</code> 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
* <code>Time</code>.
- *
+ *
* 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 <i>stat</i>.
- *
+ *
* 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 <i>stat</i> (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 <i>stat</i>.
*
* File.stat("/etc/passwd").inspect
- * #=> "#<File::Stat dev=0xe000005, ino=1078078, mode=0100644,
- * # nlink=1, uid=0, gid=0, rdev=0x0, size=1374, blksize=4096,
- * # blocks=8, atime=Wed Dec 10 10:16:12 CST 2003,
- * # mtime=Fri Sep 12 15:41:41 CDT 2003,
+ * #=> "#<File::Stat dev=0xe000005, ino=1078078, mode=0100644,
+ * # nlink=1, uid=0, gid=0, rdev=0x0, size=1374, blksize=4096,
+ * # blocks=8, atime=Wed Dec 10 10:16:12 CST 2003,
+ * # mtime=Fri Sep 12 15:41:41 CDT 2003,
* # ctime=Mon Oct 27 11:20:27 CST 2003>"
*/
@@ -757,12 +757,12 @@ w32_io_info(VALUE *file, BY_HANDLE_FILE_INFORMATION *st)
/*
* call-seq:
* File.stat(file_name) => stat
- *
+ *
* Returns a <code>File::Stat</code> object for the named file (see
* <code>File::Stat</code>).
- *
+ *
* 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 <em>ios</em> as an object of type
* <code>File::Stat</code>.
- *
+ *
* 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 <code>File::stat</code>, 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 <code>IO#stat</code>, 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 <code>File::Stat</code>. It exists as a standalone
* module, and its methods are also insinuated into the <code>File</code>
* 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 <i>file_name</i>. Returns
* <code>nil</code> otherwise. The meaning of the bits is platform
* dependent; on Unix systems, see <code>stat(2)</code>.
- *
+ *
* 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 <i>file_name</i>. Returns
* <code>nil</code> otherwise. The meaning of the bits is platform
* dependent; on Unix systems, see <code>stat(2)</code>.
- *
+ *
* 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
* ``<code>file</code>'', ``<code>directory</code>'',
* ``<code>characterSpecial</code>'', ``<code>blockSpecial</code>'',
* ``<code>fifo</code>'', ``<code>link</code>'',
* ``<code>socket</code>'', or ``<code>unknown</code>''.
- *
+ *
* 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 <code>Time</code> object)
* for <i>file</i>, or epoch if <i>file</i> 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 <i>file</i>.
- *
+ *
* 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 <i>file</i> (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 <i>mode_int</i>. Actual effects are operating system
* dependent (see the beginning of this section). On Unix systems, see
* <code>chmod(2)</code> 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 <i>file</i> to the bit pattern
* represented by <i>mode_int</i>. Actual effects are platform
* dependent; on Unix systems, see <code>chmod(2)</code> for details.
* Follows symbolic links. Also see <code>File#lchmod</code>.
- *
+ *
* 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 <code>File::chmod</code>, 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 <code>nil</code> 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 <i>file</i> 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
* <code>nil</code> or -1 owner or group id is ignored. Follows
* symbolic links. See also <code>File#lchown</code>.
- *
+ *
* 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 <code>File::chown</code>, 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 <i>new_name</i> if it already exists (raising a subclass
* of <code>SystemCallError</code>). 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 <i>new_name</i> for the existing file
* <i>old_name</i>. Raises a <code>NotImplemented</code> 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 <code>Dir::rmdir</code>.
@@ -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
* <code>SystemCallError</code> 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 <em>subtracted</em> from the
* default permissions, so a umask of <code>0222</code> 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
* <i>dir_string</i> 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 <code>HOME</code> must be set
* correctly). ``<code>~</code><i>user</i>'' 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
* <i>dir_string</i> is given, in which case it will be used as the
* starting point. If the given pathname starts with a ``<code>~</code>''
* it is NOT expanded, it is treated as a normal directory name.
- *
+ *
* File.absolute_path("~oracle/bin") #=> "<relative_path>/~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 <i>file_name</i>,
* which must be formed using forward slashes (``<code>/</code>'')
* regardless of the separator used on the local file system. If
* <i>suffix</i> is given and present at the end of <i>file_name</i>,
* 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 <i>file_name</i>
* except the last one. The filename must be formed using forward
* slashes (``<code>/</code>'') 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 <i>path</i>
* 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
* <code>File::dirname</code> and <code>File::basename</code>.
- *
+ *
* 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
* <code>File::SEPARATOR</code>.
- *
+ *
* 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 <i>file_name</i> to be at most <i>integer</i>
* 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 <i>file</i> to at most <i>integer</i> 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 <i>locking_constant</i> (a
* logical <em>or</em> of the values in the table below).
* Returns <code>false</code> if <code>File::LOCK_NB</code> 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 <i>aCmd</i> to perform various tests on
* <i>file1</i> (first table below) or on <i>file1</i> and
* <i>file2</i> (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 <i>stat</i>. The return string is one of:
* ``<code>file</code>'', ``<code>directory</code>'',
* ``<code>characterSpecial</code>'', ``<code>blockSpecial</code>'',
* ``<code>fifo</code>'', ``<code>link</code>'',
* ``<code>socket</code>'', or ``<code>unknown</code>''.
- *
+ *
* 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 <code>true</code> if <i>stat</i> is a directory,
* <code>false</code> 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 <code>true</code> if the operating system supports pipes and
* <i>stat</i> is a pipe; <code>false</code> otherwise.
*/
@@ -3881,18 +3883,18 @@ rb_stat_p(VALUE obj)
/*
* call-seq:
* stat.symlink? => true or false
- *
+ *
* Returns <code>true</code> if <i>stat</i> is a symbolic link,
* <code>false</code> if it isn't or if the operating system doesn't
* support this feature. As <code>File::stat</code> automatically
* follows symbolic links, <code>symlink?</code> will always be
* <code>false</code> for an object returned by
* <code>File::stat</code>.
- *
+ *
* 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 <code>true</code> if <i>stat</i> is a socket,
* <code>false</code> 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 <code>true</code> if the file is a block device,
* <code>false</code> 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 <code>true</code> if the file is a character device,
* <code>false</code> 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 <code>true</code> if the effective user id of the process is
* the same as the owner of <i>stat</i>.
- *
+ *
* 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 <i>stat</i>. On Windows NT, returns <code>false</code>.
- *
+ *
* 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 <code>true</code> if <i>stat</i> 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 <code>true</code> if <i>stat</i> 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 <i>stat</i>. Returns
* <code>nil</code> otherwise. The meaning of the bits is platform
* dependent; on Unix systems, see <code>stat(2)</code>.
- *
+ *
* 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 <code>true</code> if <i>stat</i> 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 <code>true</code> if <i>stat</i> 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 <i>stat</i>. Returns
* <code>nil</code> otherwise. The meaning of the bits is platform
* dependent; on Unix systems, see <code>stat(2)</code>.
- *
+ *
* 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 <code>true</code> if <i>stat</i> 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 <code>executable?</code>, 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 <code>true</code> if <i>stat</i> 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 <code>true</code> if <i>stat</i> is a zero-length file;
* <code>false</code> 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 <i>stat</i> 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 <code>true</code> if <i>stat</i> has the set-user-id
* permission bit set, <code>false</code> 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 <code>true</code> if <i>stat</i> has the set-group-id
* permission bit set, <code>false</code> 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 <code>true</code> if <i>stat</i> has its sticky bit set,
* <code>false</code> 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)
* <code>File</code> includes the methods of module
* <code>FileTest</code> as class methods, allowing you to write (for
* example) <code>File.exist?("foo")</code>.
- *
+ *
* In the description of File methods,
* <em>permission bits</em> 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 <code>0644</code> (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