1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ruby.h: rb_sys_stat -> stat

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2001-03-21 03:51:23 +00:00
parent 9910feef4f
commit 9ea56f8efe
3 changed files with 11 additions and 15 deletions

8
dir.c
View file

@ -62,7 +62,7 @@ char *strchr _((char*,char));
#include <ctype.h>
#ifndef HAVE_LSTAT
#define lstat rb_sys_stat
#define lstat(path,st) stat(path,st)
#endif
#define FNM_NOESCAPE 0x01
@ -622,7 +622,7 @@ glob_helper(path, flag, func, arg)
if (!has_magic(path, 0)) {
remove_backslashes(path);
if (rb_sys_stat(path, &st) == 0) {
if (stat(path, &st) == 0) {
(*func)(path, arg);
}
else if (errno != ENOENT) {
@ -653,7 +653,7 @@ glob_helper(path, flag, func, arg)
else dir = base;
magic = extract_elem(p);
if (rb_sys_stat(dir, &st) < 0) {
if (stat(dir, &st) < 0) {
if (errno != ENOENT) rb_sys_warning(dir);
free(base);
break;
@ -721,7 +721,7 @@ glob_helper(path, flag, func, arg)
free(magic);
if (link) {
while (link) {
if (rb_sys_stat(link->path, &st) == 0) {
if (stat(link->path, &st) == 0) {
if (S_ISDIR(st.st_mode)) {
int len = strlen(link->path);
int mlen = strlen(m);

14
file.c
View file

@ -67,7 +67,7 @@ char *strrchr _((const char*,const char));
#include <sys/stat.h>
#ifndef HAVE_LSTAT
#define lstat stat
#define lstat(path,st) stat(path,st)
#endif
VALUE rb_cFile;
@ -313,7 +313,7 @@ rb_stat(file, st)
#if defined DJGPP
if (RSTRING(file)->len == 0) return -1;
#endif
return rb_sys_stat(RSTRING(file)->ptr, st);
return stat(RSTRING(file)->ptr, st);
}
static VALUE
@ -323,7 +323,7 @@ rb_file_s_stat(obj, fname)
struct stat st;
Check_SafeStr(fname);
if (rb_sys_stat(RSTRING(fname)->ptr, &st) == -1) {
if (stat(RSTRING(fname)->ptr, &st) == -1) {
rb_sys_fail(RSTRING(fname)->ptr);
}
return stat_new(&st);
@ -419,7 +419,7 @@ eaccess(path, mode)
struct stat st;
static int euid = -1;
if (rb_sys_stat(path, &st) < 0) return (-1);
if (stat(path, &st) < 0) return (-1);
if (euid == -1)
euid = geteuid ();
@ -721,7 +721,7 @@ check3rdbyte(file, mode)
{
struct stat st;
if (rb_sys_stat(file, &st) < 0) return Qfalse;
if (stat(file, &st) < 0) return Qfalse;
if (st.st_mode & mode) return Qtrue;
return Qfalse;
}
@ -2115,7 +2115,7 @@ path_check_1(path)
return path_check_1(buf);
}
for (;;) {
if (rb_sys_stat(path, &st) == 0 && (st.st_mode & 002)) {
if (stat(path, &st) == 0 && (st.st_mode & 002)) {
if (p) *p = '/';
return 0;
}
@ -2234,7 +2234,7 @@ rb_find_file(file)
}
path = dln_find_file(file, path);
if (path && rb_sys_stat(path, &st) == 0) {
if (path && stat(path, &st) == 0) {
return path;
}
return 0;

4
ruby.h
View file

@ -592,10 +592,6 @@ rb_special_const_p(VALUE obj)
static char *dln_libs_to_be_linked[] = { EXTLIB, 0 };
#endif
#ifndef rb_sys_stat
#define rb_sys_stat stat
#endif
#if defined(__cplusplus)
} /* extern "C" { */
#endif