summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-05-18 05:57:46 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-05-18 05:57:46 +0000
commitc0e5ea941820076461beabe6c8342b8a47484319 (patch)
treebeeb3efa69c6cfebc596ea43875222f25483b726
parent32dc42cf1a248821df7594047bd3fd7822622b32 (diff)
1.1b9_21
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog13
-rw-r--r--error.c2
-rw-r--r--eval.c14
-rw-r--r--file.c21
-rw-r--r--intern.h2
-rw-r--r--util.h4
-rw-r--r--version.h4
7 files changed, 41 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index d93298d..be64239 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Mon May 18 14:52:21 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_21.
+
+Mon May 18 03:27:57 1998 MAEDA shugo <shugo@aianet.ne.jp>
+
+ * file.c (file_s_expand_path): optional second argument
+ `default_directory' added.
+
+Sat May 16 22:06:52 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * error.c (RAISE_ERROR): wrong error message
+
Fri May 15 14:43:25 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* experimental release 1.1b9_20.
diff --git a/error.c b/error.c
index ad93675..9c024dd 100644
--- a/error.c
+++ b/error.c
@@ -547,6 +547,8 @@ Init_Exception()
va_list args;\
char buf[BUFSIZ];\
va_init_list(args,fmt);\
+ vsprintf(buf, fmt, args);\
+ va_end(args);\
rb_raise(exc_new2(klass, buf));\
}
diff --git a/eval.c b/eval.c
index 84176dd..a0a1ba5 100644
--- a/eval.c
+++ b/eval.c
@@ -508,14 +508,12 @@ dyna_var_asgn(id, value)
{
struct RVarmap *vars = the_dyna_vars;
- if (id) {
- while (vars) {
- if (vars->id == id) {
- vars->val = value;
- return value;
- }
- vars = vars->next;
+ while (vars) {
+ if (vars->id == id) {
+ vars->val = value;
+ return value;
}
+ vars = vars->next;
}
new_dvar(id, value);
return value;
@@ -4073,7 +4071,7 @@ f_load(obj, fname)
Check_SafeStr(fname);
#ifndef __MACOS__
if (RSTRING(fname)->ptr[0] == '~') {
- fname = file_s_expand_path(0, fname);
+ fname = file_s_expand_path(1, &fname);
}
#endif
file = find_file(RSTRING(fname)->ptr);
diff --git a/file.c b/file.c
index 4ea5871..9382d89 100644
--- a/file.c
+++ b/file.c
@@ -1108,12 +1108,16 @@ file_s_umask(argc, argv)
}
VALUE
-file_s_expand_path(obj, fname)
- VALUE obj, fname;
+file_s_expand_path(argc, argv)
+ int argc;
+ VALUE *argv;
{
+ VALUE fname, dname;
char *s, *p;
char buf[MAXPATHLEN+2];
+ rb_scan_args(argc, argv, "11", &fname, &dname);
+
s = STR2CSTR(fname);
p = buf;
if (s[0] == '~') {
@@ -1136,7 +1140,6 @@ file_s_expand_path(obj, fname)
struct passwd *pwPtr;
s++;
#endif
-
while (*s && *s != '/') {
*p++ = *s++;
}
@@ -1154,12 +1157,18 @@ file_s_expand_path(obj, fname)
}
}
else if (s[0] != '/') {
+ if (argc == 2) {
+ strcpy(buf, STR2CSTR(dname));
+ }
+ else {
#ifdef HAVE_GETCWD
- getcwd(buf, MAXPATHLEN);
+ getcwd(buf, MAXPATHLEN);
#else
- getwd(buf);
+ getwd(buf);
#endif
+ }
p = &buf[strlen(buf)];
+ while (p > buf && *(p - 1) == '/') p--;
}
*p = '/';
@@ -1628,7 +1637,7 @@ Init_File()
rb_define_singleton_method(cFile, "rename", file_s_rename, 2);
rb_define_singleton_method(cFile, "umask", file_s_umask, -1);
rb_define_singleton_method(cFile, "truncate", file_s_truncate, 2);
- rb_define_singleton_method(cFile, "expand_path", file_s_expand_path, 1);
+ rb_define_singleton_method(cFile, "expand_path", file_s_expand_path, -1);
rb_define_singleton_method(cFile, "basename", file_s_basename, -1);
rb_define_singleton_method(cFile, "dirname", file_s_dirname, 1);
diff --git a/intern.h b/intern.h
index 8a31d95..ad28255 100644
--- a/intern.h
+++ b/intern.h
@@ -135,7 +135,7 @@ void thread_trap_eval _((VALUE, int));
/* file.c */
VALUE file_open _((char*, char*));
int eaccess _((char*, int));
-VALUE file_s_expand_path _((VALUE, VALUE));
+VALUE file_s_expand_path _((int, VALUE *));
/* gc.c */
void rb_global_variable _((VALUE*));
void gc_mark_locations _((VALUE*, VALUE*));
diff --git a/util.h b/util.h
index 2aa9f96..64a78c1 100644
--- a/util.h
+++ b/util.h
@@ -12,7 +12,7 @@
#ifndef UTIL_H
#define UTIL_H
-unsigned long scan_oct _((char*,int,int*));
-unsigned long scan_hex _((char*,int,int*));
+unsigned long scan_oct();
+unsigned long scan_hex();
#endif /* UTIL_H */
diff --git a/version.h b/version.h
index bdc3d70..ec57adc 100644
--- a/version.h
+++ b/version.h
@@ -1,2 +1,2 @@
-#define RUBY_VERSION "1.1b9_20"
-#define VERSION_DATE "98/05/15"
+#define RUBY_VERSION "1.1b9_21"
+#define VERSION_DATE "98/05/18"