summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorYukihiro Matsumoto <matz@ruby-lang.org>1994-11-22 01:22:30 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-08-17 22:09:30 +0900
commit4dfd93c72a9a221c5575c5888483f2fb55c82117 (patch)
treed31f646aef5fdfda2869a40f7758a12158976602 /file.c
parentc31025779da3020b9d1e9ad4c920e76b6b97d5fd (diff)
version 0.56v0_56
https://cache.ruby-lang.org/pub/ruby/1.0/ruby-0.55-0.56.diff.gz
Diffstat (limited to 'file.c')
-rw-r--r--file.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/file.c b/file.c
index 8d4a1e1..4639655 100644
--- a/file.c
+++ b/file.c
@@ -4,7 +4,7 @@
file.c -
$Author: matz $
- $Date: 1994/11/01 08:27:57 $
+ $Date: 1994/11/22 01:22:34 $
created at: Mon Nov 15 12:24:34 JST 1993
Copyright (C) 1994 Yukihiro Matsumoto
@@ -69,19 +69,29 @@ apply2files0(func, args, arg, gl)
path = args->ptr[i];
if (TYPE(path) == T_STRING) {
if (gl) {
- char *p;
+ char buf[MAXPATHLEN];
+ char *p, *s;
+
+ s = buf;
p = RSTRING(path)->ptr;
while (*p) {
- switch (*p++) {
+ switch (*s = *p++) {
case '*': case '?':
- case '[': case ']':
- case '{': case '}':
+ case '[': case '{':
path = glob_new(path);
goto glob;
+ case '\\':
+ if (*p == '\0') break;
+ *s = *p++;
}
+ s++;
}
+ *s = '\0';
+ (*func)(buf, arg);
+ }
+ else {
+ (*func)(RSTRING(path)->ptr, arg);
}
- (*func)(path, arg);
n++;
}
else {
@@ -819,11 +829,11 @@ Ffile_ctime2(obj)
static void
chmod_internal(path, mode)
- struct RString *path;
+ char *path;
int mode;
{
- if (chmod(path->ptr, mode) == -1)
- rb_sys_fail(RSTRING(path)->ptr);
+ if (chmod(path, mode) == -1)
+ rb_sys_fail(path);
}
static VALUE
@@ -864,11 +874,11 @@ struct chown_args {
static void
chown_internal(path, args)
- struct RString *path;
+ char *path;
struct chown_args *args;
{
- if (chown(path->ptr, args->owner, args->group) < 0)
- rb_sys_fail(path->ptr);
+ if (chown(path, args->owner, args->group) < 0)
+ rb_sys_fail(path);
}
static VALUE
@@ -914,11 +924,11 @@ struct timeval *time_timeval();
static void
utime_internal(path, tvp)
- struct RString *path;
+ char *path;
struct timeval tvp[];
{
- if (utimes(path->ptr, tvp) < 0)
- rb_sys_fail(path->ptr);
+ if (utimes(path, tvp) < 0)
+ rb_sys_fail(path);
}
static VALUE
@@ -981,10 +991,10 @@ Ffile_readlink(obj, path)
static void
unlink_internal(path)
- struct RString *path;
+ char *path;
{
- if (unlink(path->ptr) < 0)
- rb_sys_fail(path->ptr);
+ if (unlink(path) < 0)
+ rb_sys_fail(path);
}
static VALUE