summaryrefslogtreecommitdiff
path: root/libc/stdio/stdio.c
AgeCommit message (Collapse)Author
2003-05-15Fix (hopefully) scanf behavior for nul bytes in the stream when processingManuel Novoa III
%c, %s, and %[ specifiers. Note that scanf is undergoing rewrite so I didn't bother optimizing this. I did run all my regression tests though. Set EOF correctly for fmemopen on readonly streams. I really need to check what glibc behavior is for the various open modes though.
2003-01-23Wasn't thinking... we don't need to seek to end when appending if stdioManuel Novoa III
is built without buffer support.
2003-01-22Fixed a bug related file position in append mode. _stdio_fwrite nowManuel Novoa III
seeks to the end of the stream when append mode is set and we are transitioning to write mode, so that subsequent ftell() return values are correct. Also fix _stdio_fopen to support fdopen() with append specified when the underlying file didn't have O_APPEND set. It now sets the O_APPEND flag as recommended by SUSv3 and is done by glibc.
2003-01-05Fix a silly bug in _wstdio_fwrite. wprintf %s should now work correctly.Manuel Novoa III
2002-12-20The big thing is locale dependent collation support.Manuel Novoa III
Also added outdigit support and (legacy) YESSTR/NOSTR support.
2002-11-22Ok... here's the summary:Manuel Novoa III
Hopefully locale support will build when cross compiling now. Collation is still not supported, but that's what I'm currently working on. In the next couple of days, I'll probably put up a couple of files for download that will save people the trouble of generating all the glibc locales. Added *wprintf functions, although they currently don't support floating point. That will be fixed when I rewrite _dtostr... or possibly before. Added the wcsto{inttype} functions. Added iconv() and a mini iconv utility. The require locale support and only provide for conversions involving the various unicode encodings { UCS-4*, UCS-2*, UTF-32*, UTF-16*, UTF-8 }, the 8-bit codesets built with the locale data, and the internal WCHAR_T.
2002-11-05For now, leave the "Oddly enough, __fsetlocking() is NOT threadsafe."Eric Andersen
comment as an mjn3 only item.
2002-11-03Implement locale-specific grouping in printf for base 10 integer conversionsManuel Novoa III
when the grouping flag "'" is specified. Grouping for floating point values may wait until I do a rewrite of the floating pt to string code...
2002-08-25Changed fclose behavior when custom streams were enabled. Previously,Manuel Novoa III
the cookie pointer was set to NULL as a debugging aid. However, some of the perl 5.8 test rely on being able to close stderr and still try writing to it. So now, the cookie pointer and handler function pointers are set to that it is a "normal" file with a file descriptor of -1. Note: The cookie pointer is reset to NULL if the FILE struct is free'd by fclose.
2002-08-13__fsetlocking() and FILE field user_locking were completely broken. :-(Manuel Novoa III
I think they're fixed now (I've run a few tests). Note: __fsetlocking() is not threadsafe... but glibc's doesn't appear to be either.
2002-08-12Revert commit by davidm to printf.c that initialized conv_numManuel Novoa III
needlessly. To do so increases the generated code size with bcc. Eliminate duplicate define warnings in wstring.c. Fix potentially broken preprocessor comparisons. The preprocessor converts integers to maximal signed type, so inequality comparisons involving UINTMAX_MAX, ULLONG_MAX, and (if no long long) ULONG_MAX were potentially broken.
2002-08-06Changed fflush() behavior to no-op for r/w streams in read-mode.Manuel Novoa III
This falls under undefined behavior wrt ANSI/ISO C99, but SUSv3 seems to treat it as a no-op and it occurs in some apps. Fixed a problem with _stdio_fwrite() not checking for underlying write() failures. Fixed both _stdio_fwrite() and _stdio_fread() to make sure that the putc and getc macros were disabled if the stream was in and error state. The above changes should take care of a problem initially reported by "Steven J. Hill" <sjhill@realitydiluted.com>.
2002-08-03A couple of little cleanups I forgot to check in.Manuel Novoa III
2002-07-07Attempt to clean up the strerror_r situation.Manuel Novoa III
2002-07-03Enable WCHAR support for C/POSIX stub locales.Manuel Novoa III
Implemented unformatted wide i/o functions. (ungetwc still needs testing) Fix a few bugs in wchar.c. Modifications for bcc/elks support.
2002-06-18Fix perror() and printf("%m") to not call strerror(), as required by theManuel Novoa III
standards. Temporarily added a utility function to wrap Erik's strerror_r so that "Unknown error xxx" strings can be generated for errno's which cause strerror_r to fail. That utility function will eventually be merged in with the strerror/strerror_r functions when I change over to optionallly mmap'ing the system error strings to provide for lower mem comsumption on non-MMU platforms, as well as locale-specific system error messages.
2002-06-11Revert Erik's patch to vasprintf and fix the real issue.Manuel Novoa III
The writer for the stream returned by open_memstream was supposed to keep the buffer nul-terminated. I apparently left out a statement.
2002-04-09Fix the read/write auto-transition bugs. Note that if we can'tManuel Novoa III
auto-transition, we fail the operation. This is different than glibc's apparent behavior for writing of clearing the read buffer and still failing the write without setting the stream's error flag. Also, change a number of "errno = xxx" assignments to use __set_errno(). Also, change setvbuf(file, NULL, _IO{LF}BF, 0) behavior to more closely match glibc's by keeping the current buffer and only changing the buffering mode. Update setlinebuf() in the process to match the man page behavior.
2002-03-21Compile in flockfile and friends by defaultEric Andersen
-Erik
2002-03-16Fix a pointer bug in setvbuf reported by Bart Visscher <magick@Linux-Fan.com>.Manuel Novoa III
2002-03-14I vow to rerun _all_ the tests before making commits. :-(Manuel Novoa III
I successfully managed to blow away all the modeflags for the file _except_ the one dealing with buffering...
2002-03-13Fix stdin/stdout initialization of buffering type. I had changed theManuel Novoa III
default static initiailization and forgotten to update _stdio_init().
2002-03-12Fix another O_LARGEFILE bug. Also, I forget to make floating point optionalManuel Novoa III
in the new printf code.
2002-03-12So much for fcntl flags being resonably consistent across archs... (hopefully)Manuel Novoa III
fix O_APPEND and O_LARGEFILE handling in _stdio_fopen(). Someone else will have to check of course...
2002-03-12Fix fflush(NULL) and tweak _stdio_term() for the unbuffered stdio option.Manuel Novoa III
2002-03-12Deal with cvs "feature"... or is that cvs _user_...Manuel Novoa III
2002-03-12Swap in the new stdio code.Manuel Novoa III
2002-02-26Be consistant and use an unsigned char * throughoutEric Andersen
2002-02-25I shouldn't try to program when sleepy, since I totally botchedEric Andersen
the fcntl interface... -Erik
2002-02-25When messing with fd NONBLOCK status, put things back the way we foundEric Andersen
them afterwards. As was, this hosed things up for fds shared with a parent process. Very bad for shells... Oops. -Erik
2002-02-23IEEE Std 1003.1-2001 says that the "fclose() function shall fail [with]Eric Andersen
EINTR [when] the fclose() function was interrupted by a signal". But looking in the current uClibc stdio.c for some bizarre reason we had a special case where when errno was EINTR, we would keep on trying instead. Doh! Fix that, -Erik
2002-02-23Per discussion with Manuel, when we call __stdio_flush_buffersEric Andersen
from abort() and from _exit(), we need to ensure that flushing will not cause us to block. So use fcntl to set the fd's to non-block mode...
2002-02-18Rename __stdio_close_all to __stdio_flush_buffers. Eliminate anEric Andersen
unnecessary variable
2001-11-21Add missing ctermid. Also add putc and getc (in case they getEric Andersen
undefined which is a valid thing to do) -Erik
2001-10-17This commit makes large file support actually work (when enabled inEric Andersen
the config file). I've tested this and it works for me. -Erik
2001-09-25Fix fseek behavior.Manuel Novoa III
2001-08-24Use "stdin", "stdout", and "stderr", not "_stdin", "_stdout", andEric Andersen
"_stderr", since this is what gcc and libgcc expect... -Erik
2001-08-24Add the __fopen prototype, since I pulled it from stdio.hEric Andersen
2001-07-28Oops... left in a debugging line.Manuel Novoa III
2001-07-28Back out the changes to _uClibc_fread and loop in fread() if incomplete, toManuel Novoa III
avoid problems with fgets on tty streams. I actually did some testing this time. ;-) Note: there is a difference in behavior between glibc and uClibc here regarding fread() on a tty stream. glibc's fread() seems to return after reading all _available_ data even if not at end-of-file, while uClibc's fread() continues reading until all requested or eof or error. The latter behavior seems correct w.r.t. the standards.
2001-07-26Yes... the previous "fix" was broken too... the result of careless cuttingManuel Novoa III
and pasting while pressed for time. I haven't checked this one either. :-(
2001-07-25Ok... the fix wasn't quite so straightforward. Hopefully this will do it.Manuel Novoa III
2001-07-25Fix fread bug reported by Vodz. The fix is straightforward, but I haven'tManuel Novoa III
tested it (lack of time).
2001-06-07Commit _uClibc_fread bug fix (with minor edit) posted by Johan Adolfsson ↵Manuel Novoa III
<johan.adolfsson@axis.com>.
2001-05-07Fix fwrite return value bug reported by Matthias Kilian ↵Manuel Novoa III
<kili@outback.escape.de>.
2001-04-25Be really sneaky and use GNU ld special stuff so that whenever folksEric Andersen
use the unsafe gets, they will get a warning from the linker. muahahaha. This method will soon be applied to fork() w/o an mmu etc... -Erik
2001-04-06Fix include/errno.h to not use kernel header, and instead use bits/errno.h.Eric Andersen
This required we use _LIBC instead of __LIBC__ to be consistent with glibc. This had some sideffects in sys/syscalls.h. While fixing things, I made everything use __set_errno() for (eventual) thread support. -Erik
2001-03-17Fix fdopen mode-compatibility test and errno setting.Manuel Novoa III
2001-03-07Fix a bad assertion test.Manuel Novoa III
2001-03-01Stupid buglet fix. Don't trash FILE bufstart if buffer allocation fails.Manuel Novoa III