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
Robert Drehmel
71a00a449f
- Introduce the 'restrict' qualifier to function prototypes and
...
definitions to comply with IEEE Std 1003.1-2001.
- Update the manual pages.
2002-08-15 09:47:10 +00:00
Robert Drehmel
3248d0a517
- Add the 'restrict' qualifier to the function definitions and
...
public prototypes of setbuf(3) and setvbuf(3) using the
'__restrict' macro from <sys/cdefs.h> to be compliant with
IEEE Std 1003.1-2001.
- Replace the K&R with ANSI-C function definitions.
- Bring the manual page up-to-date.
2002-08-14 23:45:42 +00:00
Poul-Henning Kamp
209c34ba95
Unbreak one of the most confusing breaks of the tree I've seen.
...
The last commit cannot possibly have been tested.
2002-08-13 18:55:51 +00:00
Tim J. Robbins
439cb19e04
Tidy up SRCS and MAN assignments.
2002-08-13 11:56:02 +00:00
Tim J. Robbins
73ab4b2b33
Remove the Bugs section, which is not relevant to FreeBSD: there is no
...
one-character ungetwc(3) buffer limit.
2002-08-13 10:50:22 +00:00
Tim J. Robbins
46624699bd
FreeBSD-ify: use In macro for header files in Synopsis, St C-99 instead of
...
St C99 in Standards section.
2002-08-13 10:47:17 +00:00
Tim J. Robbins
e74101e4ef
Basic support for wide character I/O: getwc(), fgetwc(), getwchar(),
...
putwc(), fputwc(), putwchar(), ungetwc(), fwide().
2002-08-13 09:30:41 +00:00
Tim J. Robbins
01533af5a0
Manual pages for fwide(), getwc(), fgetwc(), getwchar(), putwc(), fputwc(),
...
putwchar(), ungetwc() from NetBSD and Citrus Project, unmodified except
for the addition of $FreeBSD$.
Obtained from: NetBSD, Citrus Project
2002-08-12 13:23:12 +00:00
Jens Schweikhardt
2b239dd118
Fix typos; each file has at least one s/seperat/separat/
...
(I skipped those in contrib/, gnu/ and crypto/)
While I was at it, fixed a lot more found by ispell that I
could identify with certainty to be errors. All of these
were in comments or text, not in actual code.
Suggested by: bde
MFC after: 3 days
2002-08-11 13:05:30 +00:00
Ruslan Ermilov
a8272f7106
mdoc(7) police: punctuation.
2002-08-09 11:24:21 +00:00
Garrett Wollman
c98a4bf3fb
Don't claim to fully implement C99 in the STANDARDS section and then disclaim
...
compliance in the BUGS section immediately below.
2002-07-15 19:46:06 +00:00
Garrett Wollman
647e4efd97
Note that fseeko() and ftello() are standard in 1003.1-2001.
...
(Prefer the more-encompassing POSIX standard to SUSv2.)
2002-07-15 19:42:25 +00:00
Chris Costello
1b5c321d3f
Fix style and wording bugs introduced in my last commit.
...
Sponsored by: DARPA, NAI Labs
2002-06-18 08:55:17 +00:00
Chris Costello
5f9c048ce7
o Move more information from BUGS into SECURITY CONSIDERATIONS and
...
condense the redundant bits.
o Provide an example for using snprintf over sprintf. This may be
supplemented with an asprintf() example soon.
Sponsored by: DARPA, NAI Labs
2002-06-15 06:00:56 +00:00
Chris Costello
7bc7869122
Include information on the dangers of passing a user-supplied string as
...
a format string. This will later on be changed to a reference to the
FreeBSD Security Architecture after it has been committed.
PR: docs/39320
Sposnored by: DARPA, NAI Labs
2002-06-13 23:35:22 +00:00
Archie Cobbs
6accdce98b
Grammar fix: "contents" is plural.
...
MFC after: 1 day
2002-05-31 05:01:17 +00:00
Ruslan Ermilov
432e57ebfa
mdoc(7) police: markup nits.
2002-05-30 09:53:47 +00:00
Ruslan Ermilov
16fb684936
mdoc(7) police: fix markup for types.
2002-05-29 15:42:59 +00:00
Alfred Perlstein
a82bbc730e
Assume __STDC__, remove non-__STDC__ code.
...
Submitted by: keramida
2002-05-28 17:03:12 +00:00
Robert Drehmel
6e818f06aa
Correct a check for NUL.
...
Spotted by: bde
2002-05-27 19:27:43 +00:00
Robert Drehmel
fb08c0489d
- Move the loop conditional into the "for" header.
...
- Remove redundant "? :" construct.
style(9):
- Place a space after return statements.
- Compare pointers to NULL.
- Do not use ! to compare a character to nul.
2002-05-27 11:01:30 +00:00
Robert Drehmel
ccccc4e1c3
Avoid wandering over the beginning of the actual buffer
...
if the passed template string contains only 'X' characters.
Submitted by: Mark Andrews <marka@isc.org> (patch modified)
PR: 38402
2002-05-23 14:21:02 +00:00
Tony Finch
cfad593dbd
Clarify that the value of getc() etc. is an unsigned char converted
...
to an int (as per the C standard) i.e. it can be passed straight to
isalpha() etc.
Approved by: dwmalone (mentor)
MFC after: 3 days
2002-05-15 16:55:58 +00:00
Bill Fenner
946b2d0057
Implement several of the c99 updates to scanf(3):
...
- New length modifiers: hh, j, ll, t, z.
Still to do:
- %C, %S, %lc, %ls (wide character support)
- %a/%A (exact hex representation of floating-point numbers)
Removed old compatability equivalents:
- %D for %ld, %O for %lo, %X for %lx, %E and %F for %le & %lf (these
were buggy anyway, since they should have represented %Le & %Lf).
- %[unknown uppercase char] for %ld, %[unknown lowercase char] for %d
2002-04-20 17:00:56 +00:00
Tom Rhodes
7d358b9a2a
scanf.3 has an obsolete ``this release''.
...
PR: 35610
MFC after: 2 days
2002-04-10 20:52:49 +00:00
David E. O'Brien
1114a754ed
Fix the style of the SCM ID's.
...
I believe have made all of libc .h's as consistent as possible.
2002-03-22 23:42:05 +00:00
David E. O'Brien
333fc21e3c
Fix the style of the SCM ID's.
...
I believe have made all of libc .c's as consistent as possible.
2002-03-22 21:53:29 +00:00