summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-28 17:20:24 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-28 17:20:24 +0000
commit1af76993ed4e359895112e10d0b0b99b1b0e6ef9 (patch)
tree8de47768f6f3a41a8ca804569ef417a5255e8047
parent546c05733ab5eb4cc2fa9cb9bb3501afb4f9254a (diff)
downloadruby-1af76993ed4e359895112e10d0b0b99b1b0e6ef9.tar.gz
ruby-1af76993ed4e359895112e10d0b0b99b1b0e6ef9.tar.xz
ruby-1af76993ed4e359895112e10d0b0b99b1b0e6ef9.zip
* io.c (io_unread): adhoc workaround for non-binary mode of some DOSish
platforms. this is not perfect and safety, but works with most cases. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--io.c12
-rw-r--r--version.h6
3 files changed, 20 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d648fc3a..0917e017f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Dec 29 02:18:45 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (io_unread): adhoc workaround for non-binary mode of some DOSish
+ platforms. this is not perfect and safety, but works with most cases.
+
Fri Dec 28 23:53:18 2007 Tanaka Akira <akr@fsij.org>
* ext/strscan/strscan.c (str_new): new function for allocate an string
diff --git a/io.c b/io.c
index f9a41f3ae..d398b2392 100644
--- a/io.c
+++ b/io.c
@@ -284,7 +284,19 @@ io_unread(rb_io_t *fptr)
if (fptr->rbuf_len == 0 || fptr->mode & FMODE_DUPLEX)
return;
/* xxx: target position may be negative if buffer is filled by ungetc */
+#if defined(_WIN32) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__)
+ if (!(fptr->mode & FMODE_BINMODE)) {
+ int len = fptr->rbuf_len;
+ while (fptr->rbuf_len-- > 0) {
+ if (fptr->rbuf[fptr->rbuf_len] == '\n')
+ ++len;
+ }
+ r = lseek(fptr->fd, -len, SEEK_CUR);
+ }
+ else
+#else
r = lseek(fptr->fd, -fptr->rbuf_len, SEEK_CUR);
+#endif
if (r < 0) {
if (errno == ESPIPE)
fptr->mode |= FMODE_DUPLEX;
diff --git a/version.h b/version.h
index bdc9a332c..43564b950 100644
--- a/version.h
+++ b/version.h
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2007-12-28"
+#define RUBY_RELEASE_DATE "2007-12-29"
#define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20071228
+#define RUBY_RELEASE_CODE 20071229
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 12
-#define RUBY_RELEASE_DAY 28
+#define RUBY_RELEASE_DAY 29
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];