mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* configure.in (RUBY_CHECK_IO_NEED): added more tests.
* io.c (rb_io_check_readable): seek after synchronized write. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5fd433efbb
commit
4e6dbec8c8
3 changed files with 28 additions and 17 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Sat Jan 11 01:44:16 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||||
|
|
||||||
|
* configure.in (RUBY_CHECK_IO_NEED): added more tests.
|
||||||
|
|
||||||
|
* io.c (rb_io_check_readable): seek after synchronized write.
|
||||||
|
|
||||||
Fri Jan 10 01:23:45 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
Fri Jan 10 01:23:45 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||||
|
|
||||||
* misc/ruby-mode.el (ruby-font-lock-syntactic-keywords): syntax
|
* misc/ruby-mode.el (ruby-font-lock-syntactic-keywords): syntax
|
||||||
|
|
33
configure.in
33
configure.in
|
@ -265,15 +265,11 @@ darwin*) LIBS="-lobjc $LIBS";;
|
||||||
human*) ac_cv_func_getpgrp_void=yes;;
|
human*) ac_cv_func_getpgrp_void=yes;;
|
||||||
beos*) ;;
|
beos*) ;;
|
||||||
cygwin*) rb_cv_have_daylight=no
|
cygwin*) rb_cv_have_daylight=no
|
||||||
rb_cv_need_io_seek_between_rw=no
|
|
||||||
rb_cv_need_io_flush_before_seek=no
|
|
||||||
ac_cv_var_tzname=no
|
ac_cv_var_tzname=no
|
||||||
ac_cv_func__setjmp=no
|
ac_cv_func__setjmp=no
|
||||||
ac_cv_func_setitimer=no
|
ac_cv_func_setitimer=no
|
||||||
;;
|
;;
|
||||||
mingw*) LIBS="-lwsock32 $LIBS"
|
mingw*) LIBS="-lwsock32 $LIBS"
|
||||||
rb_cv_need_io_seek_between_rw=yes
|
|
||||||
rb_cv_need_io_flush_before_seek=no
|
|
||||||
ac_cv_header_a_out_h=no
|
ac_cv_header_a_out_h=no
|
||||||
ac_cv_header_pwd_h=no
|
ac_cv_header_pwd_h=no
|
||||||
ac_cv_header_utime_h=no
|
ac_cv_header_utime_h=no
|
||||||
|
@ -576,6 +572,7 @@ AC_DEFUN(RUBY_CHECK_IO_NEED,
|
||||||
char *fn = "conftest.dat";
|
char *fn = "conftest.dat";
|
||||||
char *wombat = "wombat\n";
|
char *wombat = "wombat\n";
|
||||||
char *koara = "koara\n";
|
char *koara = "koara\n";
|
||||||
|
char *kangaroo = "kangaroo\n";
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
@ -589,32 +586,36 @@ int main()
|
||||||
if (!fgets(buf, BUFSIZ, f) || strcmp(buf, wombat)) goto fail;
|
if (!fgets(buf, BUFSIZ, f) || strcmp(buf, wombat)) goto fail;
|
||||||
reset_rw(f);
|
reset_rw(f);
|
||||||
fputs(koara, f);
|
fputs(koara, f);
|
||||||
|
fputs(kangaroo, f);
|
||||||
do_seek(f, SEEK_SET);
|
do_seek(f, SEEK_SET);
|
||||||
if (!fgets(buf, BUFSIZ, f) || strcmp(buf, wombat)) goto fail;
|
if (!fgets(buf, BUFSIZ, f) || strcmp(buf, wombat)) goto fail;
|
||||||
if (!fgets(buf, BUFSIZ, f) || strcmp(buf, koara)) goto fail;
|
if (!fgets(buf, BUFSIZ, f) || strcmp(buf, koara)) goto fail;
|
||||||
|
if (!fgets(buf, BUFSIZ, f) || strcmp(buf, kangaroo)) goto fail;
|
||||||
|
do_seek(f, SEEK_SET);
|
||||||
|
if (!fgets(buf, BUFSIZ, f) || strcmp(buf, wombat)) goto fail;
|
||||||
|
reset_rw(f);
|
||||||
|
fputc('X', f);
|
||||||
|
reset_rw(f);
|
||||||
|
if (!fgets(buf, BUFSIZ, f) || strcmp(buf, koara+1)) goto fail;
|
||||||
|
if (!fgets(buf, BUFSIZ, f) || strcmp(buf, kangaroo)) goto fail;
|
||||||
|
do_seek(f, SEEK_SET);
|
||||||
|
if (!fgets(buf, BUFSIZ, f) || strcmp(buf, wombat)) goto fail;
|
||||||
|
if (!fgets(buf, BUFSIZ, f) || buf[0] != 'X' || strcmp(buf+1, koara+1)) goto fail;
|
||||||
|
if (!fgets(buf, BUFSIZ, f) || strcmp(buf, kangaroo)) goto fail;
|
||||||
r = 0;
|
r = 0;
|
||||||
fail:
|
fail:
|
||||||
fclose(f);
|
fclose(f);
|
||||||
unlink(fn);
|
unlink(fn);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
], [$2]=no, [$2]=yes, [$2]=yes)])])
|
], [$2]=no, [$2]=yes, [$2]=[$3])])])
|
||||||
RUBY_CHECK_IO_NEED(seek between R/W, rb_cv_need_io_seek_between_rw)
|
RUBY_CHECK_IO_NEED(seek between R/W, rb_cv_need_io_seek_between_rw, yes)
|
||||||
RUBY_CHECK_IO_NEED(flush before seek, rb_cv_need_io_flush_before_seek)
|
|
||||||
check_to_do_something_else=no
|
|
||||||
if test "$rb_cv_need_io_seek_between_rw" = yes; then
|
if test "$rb_cv_need_io_seek_between_rw" = yes; then
|
||||||
AC_DEFINE(NEED_IO_SEEK_BETWEEN_RW, 1)
|
AC_DEFINE(NEED_IO_SEEK_BETWEEN_RW, 1)
|
||||||
check_to_do_something_else=yes
|
|
||||||
fi
|
fi
|
||||||
|
RUBY_CHECK_IO_NEED(flush before seek, rb_cv_need_io_flush_before_seek, no)
|
||||||
if test "$rb_cv_need_io_flush_before_seek" = yes; then
|
if test "$rb_cv_need_io_flush_before_seek" = yes; then
|
||||||
AC_DEFINE(NEED_IO_FLUSH_BEFORE_SEEK, 1)
|
AC_DEFINE(NEED_IO_FLUSH_BEFORE_SEEK, 1)
|
||||||
check_to_do_something_else=yes
|
|
||||||
fi
|
|
||||||
if test "$cross_compiling" = no -a "$check_to_do_something_else" = yes; then
|
|
||||||
RUBY_CHECK_IO_NEED(do something else, unexpected_stdio_behavior)
|
|
||||||
if test "$unexpected_stdio_behavior" = yes; then
|
|
||||||
AC_MSG_ERROR([unexpected stdio behavior])
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl default value for $KANJI
|
dnl default value for $KANJI
|
||||||
|
|
6
io.c
6
io.c
|
@ -213,6 +213,8 @@ flush_before_seek(fptr)
|
||||||
# define SEEK_END 2
|
# define SEEK_END 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define FMODE_SYNCWRITE (FMODE_SYNC|FMODE_WRITABLE)
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_io_check_readable(fptr)
|
rb_io_check_readable(fptr)
|
||||||
OpenFile *fptr;
|
OpenFile *fptr;
|
||||||
|
@ -221,7 +223,9 @@ rb_io_check_readable(fptr)
|
||||||
rb_raise(rb_eIOError, "not opened for reading");
|
rb_raise(rb_eIOError, "not opened for reading");
|
||||||
}
|
}
|
||||||
#if NEED_IO_SEEK_BETWEEN_RW
|
#if NEED_IO_SEEK_BETWEEN_RW
|
||||||
if ((fptr->mode & FMODE_WBUF) && !fptr->f2) {
|
if (((fptr->mode & FMODE_WBUF) ||
|
||||||
|
(fptr->mode & (FMODE_SYNCWRITE|FMODE_RBUF)) == FMODE_SYNCWRITE) &&
|
||||||
|
!fptr->f2) {
|
||||||
io_seek(fptr, 0, SEEK_CUR);
|
io_seek(fptr, 0, SEEK_CUR);
|
||||||
}
|
}
|
||||||
fptr->mode |= FMODE_RBUF;
|
fptr->mode |= FMODE_RBUF;
|
||||||
|
|
Loading…
Reference in a new issue