return done;
}
str = o_collect(ic, stream, kind, width, &base);
- if (str < inp_buf) return done;
+ if (str < inp_buf
+ || (str == inp_buf && *str == '-')) return done;
nrchars += str - inp_buf + 1;
if (!(flags & FL_NOASSIGN)) {
if (kind == 'd' || kind == 'i')
if (!width) return done;
str = f_collect(ic, stream, width);
- if (str < inp_buf) return done;
+ if (str < inp_buf
+ || (str == inp_buf && *str == '-')) return done;
nrchars += str - inp_buf + 1;
if (!(flags & FL_NOASSIGN)) {
ld_val = strtod(inp_buf, &tmp_string);
} /* end switch */
++format;
}
- return conv ? done : EOF;
+ return conv || (ic != EOF) ? done : EOF;
}
&& !io_testflag(stream, _IOWRITING)))
return 0;
if (io_testflag(stream, _IOREADING)) {
- (void) fseek(stream, 0L, SEEK_CUR);
+ /* (void) fseek(stream, 0L, SEEK_CUR); */
+ int adjust = 0;
+ if (stream->_buf && !io_testflag(stream,_IONBF))
+ adjust = stream->_count;
+ stream->_count = 0;
+ _lseek(fileno(stream), (off_t) adjust, SEEK_CUR);
+ if (io_testflag(stream, _IOWRITE))
+ stream->_flags &= ~(_IOREADING | _IOWRITING);
+ stream->_ptr = stream->_buf;
return 0;
} else if (io_testflag(stream, _IONBF)) return 0;