1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 1998-05-18 05:57:46 +00:00
parent 32dc42cf1a
commit c0e5ea9418
7 changed files with 41 additions and 19 deletions

View file

@ -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.

View file

@ -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));\
}

14
eval.c
View file

@ -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);

21
file.c
View file

@ -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);

View file

@ -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*));

4
util.h
View file

@ -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 */

View file

@ -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"