summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio
Commit message (Collapse)AuthorAgeFilesLines
* Back out disabling ungetc() at 0, use different solution:ache2001-09-015-34/+48
| | | | | keep negative offset internally, but return 0 externally in ftell*() I.e. use 0 now as 'unspecified value' per POSIX ungetc() description.
* Add originally missing __sinit() call.ache2001-08-311-0/+4
|
* Simplify offset underflow checks even moreache2001-08-311-12/+2
|
* Describe that we disallow ungetc at offset 0 now.ache2001-08-311-1/+4
|
* Disallow ungetc at offset 0 (to prevent negative offset happens), so simplifyache2001-08-312-22/+15
| | | | checks in ftell.
* Drop buffer first, _then_ ask for real positionache2001-08-311-4/+4
|
* The same big piece of ftell code repeated in 3 places. Simplify things movingache2001-08-313-94/+30
| | | | | it into one subfunction instead. Try to use real offset in strange cases.
* If file offset is smaller than internal buffer character left count, just dropache2001-08-312-16/+30
| | | | internal buffer and trust offset, not return error.
* Initialize _offset to 0 in fopen(), it helps to optimize fseek/ftellache2001-08-311-0/+2
|
* Detect fp->_offset overflow on readache2001-08-311-9/+23
| | | | Use errno to catch negative seek with -1 offset
* Use ``.Rv -std'' wherever possible.ru2001-08-311-7/+3
| | | | Submitted by: yar
* Try to discard some ungetc data in saved internal buffer checks too,ache2001-08-302-7/+25
| | | | if offset tends to be negative.
* goto dumb; if can't obtain curoff for whence != SEEK_CUR cases, as supposedache2001-08-301-8/+4
|
* Add more EOVERFLOW checks.ache2001-08-302-31/+94
| | | | | | | | | | | | When file offset tends to be negative due to internal and ungetc buffers additions counted, try to discard some ungetc data first, then return EBADF. Later one can happens if lseek(fileno(fd),...) called f.e. POSIX says that ungetc beyond beginning of the file results are undefined, so we can just discard some of ungetc data in that case. Don't rely on gcc cast when checking for overflow, use OFF_MAX. Cosmetique.
* Cosmetique fixes from bdeache2001-08-261-2/+0
|
* Cosmetique: correct English in commentsache2001-08-231-2/+2
|
* Mark some functions as __printflike() and/or taking const char * argumentskris2001-08-201-1/+1
| | | | | | instead of char *. MFC after: 2 weeks
* Add about rewind+errno, describe ESPIPE, minor formatting.ache2001-08-191-6/+23
|
* Simplify overflow calculations a bitache2001-08-171-4/+2
|
* Remove extra check, already done in upper level caller, i.e. inache2001-08-171-5/+1
| | | | _fseeko()
* Mention ftell & ftello in EOVERFLOW section too.ache2001-08-171-1/+5
|
* Add more overflow checks in case of fseek()ache2001-08-171-0/+8
|
* Don't clear "we have offset" flag even if long is overflow for fseek(),ache2001-08-171-1/+0
| | | | there is no harm to have it, it will reduce next call efforts.
* fseek.c:ache2001-08-174-10/+36
| | | | | | | | | | | | Resulting fseek() offset must fit in long, required by POSIX (pointed by bde), so add LONG_MAX and final tests for it. rewind.c: 1) add missing __sinit() as in fseek() it pretends to be. 2) use clearerr_unlocked() since we already lock stream before _fseeko() 3) don't zero errno at the end, it explicitely required by POSIX as the only one method to test rewind() error condition. 4) don't clearerr() if error happens in _fseeko()
* Explain the relation of getchar() to getc() in less words.dd2001-08-161-5/+1
| | | | Submitted by: ru
* Use smarter overflow testsache2001-08-151-3/+6
| | | | Suggested by: bde
* 1) Disallow negative seek as POSIX require for fseek{o} (but not for lseek):ache2001-08-153-13/+45
| | | | | | | | | | | | "[EINVAL] ... The resulting file-position indicator would be set to a negative value." Moreover, in real life negative seek in stdio cause EOF indicator cleared and not set again forever even if EOF returned. 2) Catch few possible off_t overflows. Reviewed by: arch discussion
* Rip out the old __stdin/out/err stuff. It was completely 100% useless. :-(peter2001-08-131-15/+6
| | | | | | | | | | | | | | | | It was foiled because of dynamic copy relocations that caused compile-time space to be reserved in .bss and at run time a blob of data was copied to that space and everything used the .bss version.. The problem is that the space is reserved at compile time, not runtime... So we *still* could not change the size of FILE. Sigh. :-( Replace it with something that does actually work and really does let us make 'FILE' extendable. It also happens to be the same as Linux does in glibc, but has the slight cost of a pointer. Note that this is the same cost that 'fp = fopen(), fprintf(fp, ...); fclose(fp);' has. Fortunately, actual references to stdin/out/err are not all that common since we have implicit stdin/out/err-using versions of functions (printf() vs. fprintf()).
* Use .Fn, .Fa, and .Dv where appropriate.dd2001-08-101-2/+6
|
* Use the ``.Rv -std'' mdoc(7) macro in appropriate cases.yar2001-08-091-6/+1
| | | | Reviewed by: ru
* mdoc(7) police:ru2001-08-071-4/+2
| | | | | | | Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text. Not only this slows down the mdoc(7) processing significantly, but it also has an undesired (in this case) effect of disabling hyphenation within the entire enclosed block.
* Avoid any chance of being misunderstood as having libelled developerssheldonh2001-07-291-1/+1
| | | | | | | | or developers' vendors without compromising the importance of warning against bad practice. Reported by: mjacob MFC after: 1 week
* Remove whitespace at EOL.dd2001-07-159-29/+29
|
* mdoc(7) police: removed HISTORY info from the .Os call.ru2001-07-102-2/+2
|
* mdoc(7) police: remove extraneous .Pp before and/or after .Sh.dd2001-07-092-2/+0
|
* Attempt to use the environment variable TMPDIR for the temporarymikeh2001-07-072-3/+20
| | | | | | | | directory, defaulting to /tmp. PR: bin/16924 Reviewed by: dd MFC after: 2 weeks
* mdoc(7) police: fixed/simplified formatting.ru2001-07-041-130/+81
|
* (cantwrite): do not allocate memory for a NULL stringassar2001-06-181-1/+2
| | | | | | | | PR: misc/26044 MFC after: 1 week Submitted by: bde
* revert freeing of memory that gets allocated when str == NULLassar2001-06-184-8/+0
| | | | | | (this will be fixed in a better way) PR: misc/26044
* free memory that gets allocated by vfprintf when str == NULLassar2001-06-164-0/+8
| | | | | | PR: misc/26044 MFC after: 1 week
* Add description for the 'll' modifier for long long. In essence a copyschweikh2001-06-131-4/+24
| | | | | | | | from the 'l' description with s/long/long long/g. PR: 27017 Submitted by: Guy Harris <guy@alum.mit.edu> MFC after: 2 weeks
* Back out my changes describing how snprintf nul terminates. Itimp2001-06-051-9/+11
| | | | | | | was from the iso standard. Keep the sentence that says it is always NUL terminated to make sure that people understand that. Requested by: bde
* Minor improvements:imp2001-06-051-15/+29
| | | | | | o Explain snprintf's return value better. o Document snprintf, et al, were defined in C-99 o Warn against %n.
* Properly initialize a temporary FILE that is allocated off the stack.deischen2001-06-042-0/+10
| | | | | | | The change to reuse _up from FILE (to allow FILE to grow without changing size) overlooked FILE being allocated off the stack. Approved by: sobomax
* Correct the documentation for snprintf() and vsprintf() which actuallygshapiro2001-05-301-1/+12
| | | | | | | return the number of characters that would have been in the new string. Obtained from: OpenBSD MFC after: 3 days
* Add warnings about trusting user-supplied data.eric2001-05-251-0/+14
| | | | | | Reviewed by: ru Approved by: murray Obtained from: OpenBSD
* mdoc(7) police: fix markup.ru2001-04-181-2/+6
|
* To be consistent, use the __weak_reference macro from <sys/cdefs.h>deischen2001-04-101-4/+4
| | | | | | | | instead of #pragma weak to create weak definitions. This macro is improperly named, though, since a weak definition is not the same thing as a weak reference. Suggested by: bde
* MAN[1-9] -> MAN.ru2001-03-271-1/+1
|
* Fix style nit.obrien2001-03-051-1/+1
|
OpenPOWER on IntegriCloud