diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-05-18 05:57:46 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-05-18 05:57:46 +0000 |
commit | c0e5ea941820076461beabe6c8342b8a47484319 (patch) | |
tree | beeb3efa69c6cfebc596ea43875222f25483b726 | |
parent | 32dc42cf1a248821df7594047bd3fd7822622b32 (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-- | ChangeLog | 13 | ||||
-rw-r--r-- | error.c | 2 | ||||
-rw-r--r-- | eval.c | 14 | ||||
-rw-r--r-- | file.c | 21 | ||||
-rw-r--r-- | intern.h | 2 | ||||
-rw-r--r-- | util.h | 4 | ||||
-rw-r--r-- | version.h | 4 |
7 files changed, 41 insertions, 19 deletions
@@ -1,3 +1,16 @@ +Mon May 18 14:52:21 1998 Yukihiro Matsumoto <[email protected]> + + * experimental release 1.1b9_21. + +Mon May 18 03:27:57 1998 MAEDA shugo <[email protected]> + + * file.c (file_s_expand_path): optional second argument + `default_directory' added. + +Sat May 16 22:06:52 1998 WATANABE Hirofumi <[email protected]> + + * error.c (RAISE_ERROR): wrong error message + Fri May 15 14:43:25 1998 Yukihiro Matsumoto <[email protected]> * experimental release 1.1b9_20. @@ -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));\ } @@ -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); @@ -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); @@ -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*)); @@ -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 */ @@ -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" |