From b35df6aae27214f831931c0174afb497218cf74e Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 21 Sep 2000 09:31:00 +0000 Subject: matz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- file.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index 00f4f2c15b..adf1ec51ab 100644 --- a/file.c +++ b/file.c @@ -66,7 +66,7 @@ char *strrchr _((const char*,const char)); #include #include -#ifdef __EMX__ +#ifndef HAVE_LSTAT #define lstat stat #endif @@ -348,7 +348,7 @@ static VALUE rb_file_s_lstat(obj, fname) VALUE obj, fname; { -#if !defined(MSDOS) && !defined(NT) && !defined(__EMX__) +#ifdef HAVE_LSTAT struct stat st; Check_SafeStr(fname); @@ -357,8 +357,7 @@ rb_file_s_lstat(obj, fname) } return stat_new(&st); #else - rb_notimplement(); - return Qnil; /* not reached */ + return rb_file_s_stat(obj, fname); #endif } @@ -366,7 +365,7 @@ static VALUE rb_file_lstat(obj) VALUE obj; { -#if !defined(MSDOS) && !defined(NT) +#ifdef HAVE_LSTAT OpenFile *fptr; struct stat st; @@ -378,8 +377,7 @@ rb_file_lstat(obj) } return stat_new(&st); #else - rb_notimplement(); - return Qnil; /* not reached */ + return rb_io_stat(obj); #endif } @@ -822,15 +820,10 @@ rb_file_s_ftype(obj, fname) { struct stat st; -#if defined(MSDOS) || defined(NT) - if (rb_stat(fname, &st) < 0) - rb_sys_fail(RSTRING(fname)->ptr); -#else Check_SafeStr(fname); if (lstat(RSTRING(fname)->ptr, &st) == -1) { rb_sys_fail(RSTRING(fname)->ptr); } -#endif return rb_file_ftype(&st); } @@ -1119,7 +1112,7 @@ static VALUE rb_file_s_symlink(obj, from, to) VALUE obj, from, to; { -#if !defined(MSDOS) && !defined(NT) && !defined(__EMX__) && !defined(riscos) +#ifdef HAVE_SYMLINK Check_SafeStr(from); Check_SafeStr(to); @@ -1136,7 +1129,7 @@ static VALUE rb_file_s_readlink(obj, path) VALUE obj, path; { -#if !defined(MSDOS) && !defined(NT) && !defined(__EMX__) && !defined(riscos) +#ifdef READLINK char buf[MAXPATHLEN]; int cc; -- cgit v1.2.3