Warner Losh
c906b66373
Restore Peter's version of static __sF. There's too much pain for it
...
to be static for 5.0. I may remove this for 5.1 or 5.2. No more
binaries or libarires will be generated with __sF starting as of
yesterday. Originally the plan had been to eliminate this for 5.0,
but we didn't get the __std{in,out,err}p changes merged into -stable
until yesterday (rather than in September 2001 like it should have
been). Given that didn't happen on time, we can't do the other part
of the scheme now.
# Please do not change this without talking to me first.
2002-11-10 08:44:38 +00:00
Alfred Perlstein
ac1cc6ee11
Backout "compatibility hack" for __sF.
...
Requested by: Steve Kargl <sgk@troutmask.apl.washington.edu> (submitter)
2002-11-04 03:23:56 +00:00
Alfred Perlstein
0fc25b925d
Provide a hook to make __sF visible outside of libc for commercial apps
...
if WANT_COMPAT4_STDIO is defined when compiling libc.
Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu>
2002-11-02 19:47:53 +00:00
Tim J. Robbins
14ffdae94d
No need to include floatio.h here: vfscanf() no longer uses anything
...
it defines.
2002-11-01 05:13:01 +00:00
Alfred Perlstein
c313cb2abf
Make __sF static. This can not be allowed to exist in 5.x.
2002-10-31 01:54:27 +00:00
Tim J. Robbins
ae95ea1a26
Cross-reference putc(3).
2002-10-28 10:35:18 +00:00
Tim J. Robbins
79db40061f
The ORIENTLOCK macro is no longer needed since all functions use
...
FLOCKFILE/FUNLOCKFILE explicitly.
2002-10-25 07:01:56 +00:00
Tim J. Robbins
9619813de9
Cross-reference fmtcheck(3).
2002-10-20 03:56:37 +00:00
Peter Wemm
d7dd6ae7ec
Give in on the __sF stuff. I have a better fix in mind that is future
...
proof, but this should buy me some time for now.
2002-10-19 22:28:07 +00:00
Tim J. Robbins
118bb75e02
Indent code example with one tab, not two, for consistency with the rest.
2002-10-19 13:48:45 +00:00
Tim J. Robbins
0145ba86d1
Fix off-by-one error when pushing back a multibyte sequence in
...
wide character class (%l[) and wide string (%ls) conversions.
2002-10-17 13:04:00 +00:00
Tim J. Robbins
63b01047f4
Make part of the previous change clearer; check flags for SUPPRESS directly
...
instead of checking whether we're using a temporary buffer.
2002-10-17 12:06:29 +00:00
Tim J. Robbins
bd25c6f476
The field width for single-byte string conversions (%c, %s, %[) is the
...
maximum number of bytes that may be stored in the array, not the maximum
number of wide characters to read. The wording of the standard unfortunately
does not make this clear.
2002-10-17 12:02:36 +00:00
Tim J. Robbins
35739e072b
Count field width correctly for suppressed multibyte fields (%*lc,
...
%*ls, %*l[).
2002-10-16 14:07:08 +00:00
Tim J. Robbins
6180233fd8
Set the error bit on the stream if an encoding error occurs. Improve
...
handling of multibyte sequences representing null wide characters.
2002-10-16 12:09:43 +00:00
Tim J. Robbins
927ecbf313
Add support for the XSI %C and %S formats, which are the same as %lc
...
and %ls.
2002-10-16 03:55:53 +00:00
Tim J. Robbins
af1c9c0e4d
Use a weak reference instead of a macro to make vfscanf an alias
...
for __vfscanf.
2002-10-14 11:18:21 +00:00
Kris Kennaway
61bdf123c3
Ignore TMPDIR if the application is setugid.
...
MFC after: 2 weeks
2002-10-13 11:22:16 +00:00
Mike Barcroft
54e4e385de
Add restrict type-qualifier.
2002-10-12 16:13:41 +00:00
Tim J. Robbins
419c442678
Describe the restrictions on seeking on wide character streams, and also
...
point out that fseek() clears the ungetwc() buffer.
2002-10-12 09:22:25 +00:00
Peter Wemm
74a4ba21f7
Zap the early-adopter transition aid before we get into serious
...
5.0-R territory, as threatened. This only affects antique 5.0
systems that have not had a 'make world' done for well over a year.
2002-10-11 22:38:17 +00:00
Tim J. Robbins
ce04c11001
Cross-reference between byte and wide-character stdio functions. Remove
...
references to fputwc() and fgetwc() being macros while I'm at it.
2002-10-10 04:12:40 +00:00
Tim J. Robbins
3619568a64
Remove masking macros for getwc(), putwc(), putwchar() and getwchar().
...
Although there was nothing wrong with getwc() and putwc(), getwchar()
and putwchar() assumed that <stdio.h> had been included before <wchar.h>,
which is not allowed by the standard.
2002-09-28 07:43:44 +00:00
Tim J. Robbins
27a29543f3
Back out previous, free the buffer when __vfprintf() fails and don't bother
...
trying to shrink the buffer with realloc() before returning it.
2002-09-26 13:11:24 +00:00
Tim J. Robbins
344141d1fd
Back out previous and solve the problems a different way: move va_start/
...
va_end closer to the __vfprintf() call, free the buffer when __vfprintf()
fails and don't bother trying to shrink the buffer with realloc() before
returning it.
Submitted by: bde
2002-09-26 13:09:48 +00:00
Tim J. Robbins
23b6f7902d
Correctly handle the case where __vfwprintf() fails because it runs out
...
of memory.
2002-09-26 08:26:16 +00:00
Tim J. Robbins
3383deca89
Sync with OpenBSD: avoid memory leak when __vfprintf() fails because it
...
runs out of memory, always call va_end.
2002-09-26 07:55:18 +00:00
Tim J. Robbins
38b5abad06
Add cross-references between wide character and single-byte character
...
versions of printf() and scanf().
2002-09-24 09:22:47 +00:00
Tim J. Robbins
89265cb899
Remove an unneeded call to _sfrefill() that was missed in the conversion
...
from vfscanf() to vfwscanf(). It doesn't hurt to have it there, but it's
redundant since __fgetwc() will refill the buffer if it needs to.
2002-09-24 09:18:32 +00:00
Tim J. Robbins
d07090a880
Use the new va_copy macro to copy variable argument lists instead of
...
assignment. This is needed on powerpc but is also more correct for the
other ports.
Submitted by: grehan
Tested on: alpha, i386, sparc64
2002-09-24 00:47:27 +00:00
Tim J. Robbins
1f4ff8506a
Add implementations of wscanf() and related functions: fwscanf(), swscanf(),
...
vfwscanf(), vswscanf(), vwscanf(). As the name suggests, these are wide-
character versions of the scanf() family of functions.
2002-09-23 12:40:06 +00:00
Tim J. Robbins
4712aa3b59
Implement the %lc, %ls and %[ conversions, which read sequences of wide
...
characters, non-whitespace wide character strings and wide character
strings in a scanset.
2002-09-23 11:35:50 +00:00
Tim J. Robbins
adc106840c
The character argument for __ungetwc() should be wint_t instead of wchar_t.
2002-09-23 11:31:18 +00:00
Tim J. Robbins
5f147b57ac
Add an unlocked version of ungetwc(), __ungetwc(), that __vfwscanf()
...
will need to use.
2002-09-22 05:59:00 +00:00
Tim J. Robbins
0e2e10070d
Delete stray reference to vsnprintf().
2002-09-21 14:25:58 +00:00
Tim J. Robbins
c5604d0a50
Add implementations of the wprintf() family of functions, which perform
...
formatted wide-character output.
2002-09-21 13:00:30 +00:00
Tim J. Robbins
7591ae56ae
Lock the file once per call and use the unlocked fgetwc()/fputwc() variants.
2002-09-20 13:25:40 +00:00
Tim J. Robbins
9260341650
Lock and unlock the file once per call and use the unlocked version of
...
ungetc() instead of having ungetc() recurse on the lock.
2002-09-20 13:23:26 +00:00
Tim J. Robbins
8f030a44b8
Introduce unlocked versions of fputwc() and fgetwc() called __fputwc()
...
and __fgetwc() which can be used when we know the file is locked.
2002-09-20 13:20:41 +00:00
Tim J. Robbins
b9aac30810
Implement the %ls and %lc conversions for printing wide character strings
...
and wide characters. These were already documented in the manual page,
with an entry mentioning that they were not implemented yet. The XSI
%S and %C synoyms have not been added.
2002-09-19 12:50:28 +00:00
Tim J. Robbins
0b7bc80226
Optimise the common case where no special encoding is in use (LC_CTYPE is "C"
...
or "POSIX", other European locales). Use __sgetc() and __sputc() where
possible to avoid a wasteful lock and unlock for each byte and to avoid
function call overhead.
2002-09-18 12:17:28 +00:00
Tim J. Robbins
bddc6280f2
Logic error in previous: don't exit the loop when an incomplete multibyte
...
sequence is detected.
2002-09-18 10:21:41 +00:00
Tim J. Robbins
24990dfad0
Reimplement the functionality of fgetrune(), fputrune(), and fungetrune()
...
here in terms of mbrtowc(), wcrtomb(), and the single-byte I/O functions.
The rune I/O functions are about to become deprecated in favour of the
ones provided by ISO C90 Amd. 1 and C99.
2002-09-18 05:58:11 +00:00
Maxim Konovalov
48eaac247f
Fix vsnprintf(3) memory leak for size == 0.
...
PR: bin/36175
Obtained from: OpenBSD
Reviewed by: silence on -audit
MFC after: 5 days
2002-09-17 11:28:24 +00:00
Tim J. Robbins
4d783ded07
Convert eight space indents to tabs in the "*" format handling code.
2002-09-16 12:07:13 +00:00
Tim J. Robbins
58d38e2520
Style: One space between "restrict" qualifier and "*".
2002-09-06 11:24:06 +00:00
Jens Schweikhardt
3dd657600a
Print a '-' sign for negative zero. Tested with
...
#include <stdio.h>
int main(void)
{
printf("%+f\n", -0.0);
printf("%+f\n", +0.0);
printf("%+f\n", 0.0);
return 0;
}
to output
-0.000000
+0.000000
+0.000000
PR: bin/41823
Submitted by: GOTO Kentaro <gotoken@notwork.org>
Liked by: bde
MFC after: 3 weeks
2002-08-27 20:11:08 +00:00
Mike Barcroft
abbd890233
o Merge <machine/ansi.h> and <machine/types.h> into a new header
...
called <machine/_types.h>.
o <machine/ansi.h> will continue to live so it can define MD clock
macros, which are only MD because of gratuitous differences between
architectures.
o Change all headers to make use of this. This mainly involves
changing:
#ifdef _BSD_FOO_T_
typedef _BSD_FOO_T_ foo_t;
#undef _BSD_FOO_T_
#endif
to:
#ifndef _FOO_T_DECLARED
typedef __foo_t foo_t;
#define _FOO_T_DECLARED
#endif
Concept by: bde
Reviewed by: jake, obrien
2002-08-21 16:20:02 +00:00
Juli Mallett
6879bea818
Leave room for a trailing NUL not a NULL, that's not an ASCII character.
2002-08-19 03:52:36 +00:00
Robert Drehmel
f8418db73e
- For compliance with IEEE Std 1003.1-2001, add the 'restrict'
...
qualifier to function prototypes and definitions where
appropriate using the '__restrict' macro.
- Update the manual page.
2002-08-15 10:28:52 +00:00