Commit Graph

384 Commits

Author SHA1 Message Date
christos
098f26dce7 Document that passing NULL to %s prints "(null)". 2005-06-21 18:43:17 +00:00
lukem
d249206e30 use "tempnam" instead of "tmpname" 2005-06-18 10:50:25 +00:00
he
12d0c406c7 Initialize expsize to appease -Wuninitialized for sh3 and m68000.
Marked with XXXGCC -Wuninitialized [sh3,m68000].
2005-06-15 09:31:27 +00:00
lukem
0f879c5d2a vfwprintf.c and vfwscanf.c now compile with -Wuninitialized 2005-06-12 05:49:12 +00:00
lukem
ef7b3cd60b Appease gcc -Wuninitialized 2005-06-12 05:48:41 +00:00
lukem
81c4b0d591 Ensure nconv isn't used in __mbsconv() before being initialized.
Appease gcc -Wuninitialized elsewhere.
2005-06-12 05:45:38 +00:00
lukem
88c3eadbfa Add missing __RCSID() 2005-06-12 05:21:25 +00:00
wiz
649ba88889 Sort options. 2005-06-03 20:32:20 +00:00
lukem
7fbaf47f83 Compile the following files with -Wno-uninitialized:
vfprintf.c	See rev 1.46 for why we can't fix this.
vfwprintf.c	Needs some effort
vfwscanf.c	Needs some effort
2005-06-01 11:06:01 +00:00
kleink
13034da908 Add restrict qualifiers to fopen()/freopen() arguments. 2005-05-25 16:01:24 +00:00
christos
f432bbb6fd Add the missing wide char support functions from freebsd.
XXX: long double support is missing until we get gdtoa, and add the
necessary wide functions.
2005-05-14 23:51:02 +00:00
dsl
7f90294800 Re-implement in terms of fseek0() 2005-03-04 16:25:20 +00:00
dsl
28c48df97b de __P 2005-03-04 16:04:58 +00:00
kleink
fd5cb0acea A little libc namespace housekeeping exercise:
* Make vfprintf_unlocked() an internal function, c.f. __svfscanf_unlocked().
* Add internal names for arc4random(), endnetpath(), fhstatvfs(),
  fstatvfs(), mkstemp(), shquote(), statvfs(), taddr2uaddr(), uaddr2taddr(),
  uuid_create_nil(), uuid_is_nil(), and wcwidth().
* Include namespace.h where supposed to.
2005-02-09 21:35:46 +00:00
christos
b725a0a1fa add a cast and remove another. 2005-01-09 05:04:02 +00:00
christos
4b9f9bad8c remove __UNCONST definition; it is now in <sys/cdefs.h> 2004-07-02 03:00:01 +00:00
jmc
b2f782612f Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
2004-06-20 22:20:14 +00:00
drochner
f56a8e5871 make this build in the tools/compat reachover
case if HAVE_FPARSELN is not present
patch from Christian Limpach
2004-05-11 17:31:04 +00:00
drochner
d1a752ca4b put back the CAVEATS section
pointed out by wiz
2004-05-10 17:15:28 +00:00
drochner
1626697cbc remove the fgetstr manpage 2004-05-10 17:02:21 +00:00
drochner
64b5a4f2c6 Add FLOCKFILE() locking - should be threadsafe now.
(Didn't test the !HAVE_FPARSELN && !_REENTRANT case -- this might be
hit in tools/compat on some host platforms.)
2004-05-10 16:50:23 +00:00
drochner
db594c6591 After discussion with christos, turn fgetstr() into an internal function.
Its API in inherently non-threadsafe (and it depends on certain properties
of the underlying stdio implementation), so it shouldn't be a first-class
function for general use, polluting the application namespace.
Also remove the FLOCKFILE() code from it - this is under control of the
calling function now.
(XXX I'm not sure whether the FLOCKFILE() should be kept in fgetln(),
this function cannot be used in multiple threads anyway. It doesn't
hurt much, and it might prevent corruption of internal FILE structures.)
2004-05-10 16:47:11 +00:00
kleink
a060c8818b We now need an internal name for fileno(), since when buildling libc
_REENTRANT we can no longer use the macro version from <stdio.h>.
2004-05-09 17:27:53 +00:00
jdolecek
55c776851d fix reference Nx 2.1 to Nx 3.0 2004-05-05 08:48:36 +00:00
wiz
58da84e9bf Bump date for previous. 2004-04-21 00:21:04 +00:00
wiz
74eeae1bcf Drop trailing whitespace; null -> nul; & -> \*[Am] 2004-04-21 00:19:40 +00:00
christos
6321f42fe9 Add a generalized version of fgetln that can stop at an arbitrary delimiter,
and implement fgetln on top of that.
2004-04-21 00:01:57 +00:00
drochner
4634f0716d Don't zero a floating point variable on entry -- this causes the FPU to
be allocated needlessly by almost every program (at least on i386/amd64).
2004-03-03 11:19:05 +00:00
wiz
cef0afe940 Lots of grammar and wording changes from jmc@openbsd, with some
additional consistency changes by me.
2004-01-24 16:58:54 +00:00
martin
7fd2c31d41 Add support for scanf "hh" format modifiers - we use it in int_fmtio.h
for SCNd8 and friends - so we should support it properly (and not only
by pure luck on alignment blind little endian archs - it used the
"h" code path, storing a 16bit int via a byte pointer).

This makes sparc64 pass regress/lib/libc/int_fmtio.
2003-12-30 22:10:20 +00:00
lukem
a8c35a134f remove superfluous assignment 2003-12-14 23:56:28 +00:00
grant
9510307938 simplify a sentence 2003-12-09 21:40:54 +00:00
uebayasi
0b30fd3d69 Spaces. 2003-12-05 00:57:36 +00:00
grant
a1e0a00965 "The fgets() and functions gets() do not..." ->
"The fgets() and gets() functions do not..."
2003-10-30 12:59:23 +00:00
lukem
171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

    *	Consistently move the inclusion of nbtool_config.h to before
    	<sys/cdefs.h> so that the former can provide __RCSID() (et al),
    	and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
	#if HAVE_NBTOOL_CONFIG_H
	#include "nbtool_config.h"
	#endif
to the top of the source files (for the general case).
2003-10-27 00:12:41 +00:00
jmc
0c336c7f37 Move include for reentrant.h inside CONFIG_H test so this works correctly
with tools/compat. Fixes PR#21344
2003-10-23 20:06:16 +00:00
wiz
910124a085 Make the plural of X' X's instead of `Xs'.
Following a suggestion from jmc@openbsd.
2003-10-15 19:44:51 +00:00
christos
e752a6f68a PR/23158: Johan Danielsson: Portable usage of the mk*temp() functions requires
six `X's.
2003-10-14 14:29:46 +00:00
simonb
62887f0740 Remove another unneeded cast to size_t.
Pointed out by Anil Madhavapeddy in private email.
2003-10-10 05:38:45 +00:00
simonb
444e6dce83 No need to cast "len" to a size_t now that "len" is a size_t. 2003-10-09 00:50:34 +00:00
itojun
1bb83f4a4a avoid signed->unsigned assignment. openbsd PR 1709 2003-10-08 20:33:17 +00:00
wiz
dca9ccd375 Use St -isoC-9X instead of St -isoC9X, to be in sync with groff. 2003-09-08 17:54:31 +00:00
heas
6333112bb9 plural "characters" for ret of {v}snprintf 2003-08-27 18:47:14 +00:00
agc
eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
nathanw
6d30f1a3db Disable cancellation on the first lock, too, not just on internal
recursive locks (Duh).

Disable cancellation around the cond_wait() call, since that's also a
cancellation point. Arguably, that would be better handled with
pthread_cleanup_*(), but stubbing those for libc is difficult, and the
current non-exception-based implementation of cleanup handlers is
probably no faster than disabling and reenabling cancellation.
Finally, it only happens in the slow path where the thread is going to
sleep anyway...
2003-07-22 00:56:25 +00:00
nathanw
5a5cd67fff Set the _LOCKINTERNAL() count on initial locking as well as subsequent
recursive locks.
2003-07-21 22:24:47 +00:00
nathanw
d3ebb21ecd Use threadlib stub rather than pthread_setcancelstate() directly. 2003-07-19 05:06:16 +00:00
nathanw
a74e50ddaf #include "local.h" to get __flockfile_internal() prototype. 2003-07-18 21:52:16 +00:00
nathanw
ad09d62fcc Move guts of flockfile()/funlockfile() to __flockfile_internal(), which
takes an additional argument indicating whether this is an internal caller
taking the lock or an external (application) caller. When making an internal
lock, save the current thread cancellation state and disable cancellation
until the matching unlock. This should prevent canccelled threads from exiting
inside of stdio while holding a file lock and potentially leaving other
parts of the FILE structure in an inconsistent state.
2003-07-18 21:50:41 +00:00
nathanw
b5665a9b84 Add fields to struct __sfileext to track how many times the lock has been
taken by internal stdio functions, and what the cancellation state was when
the first such lock was taken.
2003-07-18 21:46:41 +00:00
thorpej
119837ff52 Fix handing of -ve hexadecimal numbers in the %i format. Fixes
PR lib/21691.  Patch from Simon Burge.
2003-05-27 14:32:29 +00:00
wiz
a363cdabc4 Drop trailing space. 2003-05-11 16:21:18 +00:00
kleink
861db62607 Oops, typo in previous. 2003-05-11 16:16:41 +00:00
kleink
8d06f60601 As prompted by Thomas Klausner, add a RETURN VALUES section. 2003-05-11 16:15:07 +00:00
wiz
737de9f803 Misc. fixes from jmc@openbsd. 2003-05-03 19:43:00 +00:00
wiz
472351e13d Use
.In header.h
instead of
.Fd #include \*[Lt]header.h\*[Gt]
Much easier to read and write, and supported by groff for ages.
Okayed by ross.
2003-04-16 13:34:34 +00:00
pooka
0e9bf3053c avoid using multiple different ways of saying the same thing 2003-03-28 17:00:49 +00:00
tshiozak
5abc4b4f43 add fgetws() and fputws() (lib/20576).
Note: fgetws.c, fgetws.3, fputws.c and fputws.3 are obtained from FreeBSD,
and fitted by sigsegv@infoseek.jp and me.
2003-03-07 07:11:35 +00:00
wiz
b3ee4720f5 Use strlcpy, not strcpy, in one more place. From deraadt. 2003-02-16 16:21:59 +00:00
nathanw
34c915eb3d Revert the conversion to libpthread's recursive mutexes. Too much
trouble is caused by the memory allocation in the mutex initialization,
and uncontested mutexes and condition variables have become faster in the
meantime.
2003-02-01 03:25:00 +00:00
wiz
9804cdc7fc a, b, and c. 2003-01-28 20:33:25 +00:00
kleink
5b62d84e6e Add a manual page for flockfile(3) etc.; while here, also add *_unlocked()
to stdio(3) overview documentation.  Fixes PR lib/20096 from Jason Thorpe.
2003-01-28 20:26:04 +00:00
nathanw
6003a24dd4 Use recursive mutexes from libpthread rather than implementing
our own with normal mutexes and condition variables.
2003-01-21 23:26:02 +00:00
thorpej
3fdac2b8c5 Merge the nathanw_sa branch. 2003-01-18 10:52:16 +00:00
kristerw
a505fc7826 Fix two bugs:
1. snprintf(foo, 0. "XXX") is guaranteed not to write in foo by the
   standard (ISO/IEC 9899 7.19.6.5) but our implementation handles this
   as if the buffer has a size of (size_t)-1.

2. snprintf(NULL, 0, "XXX") leaks memory since cantwrite() allocates
   memory if _bf._base == NULL, and this buffer is never freed
   (PR 16483).
2003-01-05 11:05:47 +00:00
mjl
71b7c0b242 Fix typos (from PR 19650) 2003-01-03 21:41:28 +00:00
lukem
b1e79510cf - Migrate fparseln(3) from libutil to libc, where it should have been in
the first place...
- Bump libutil major (to 7.0) and libc minor (to 12.91).
2002-11-30 03:04:44 +00:00
simonb
0b3c8ee193 Document that the *printf() functions can return a negative value under
output error conditions.
2002-11-11 17:26:19 +00:00
wiz
6569c5c509 New sentence, new line. From Robert Elz. 2002-10-01 17:22:00 +00:00
thorpej
922525072e Allow mktemp to be built as a host tool. 2002-09-14 04:26:23 +00:00
wiz
3f9c36b9de Drop superfluous Ns and fix a formatting glitch. 2002-08-20 16:10:01 +00:00
yamt
e7d9fe95ae - add description of the race.
- fix typo.
from OpenBSD.
2002-08-10 16:34:29 +00:00
yamt
dccfe06f50 use more Xs for filename templates.
from OpenBSD.
2002-08-10 16:28:51 +00:00
yamt
04adc81fbf if the path is directory, remove(3) behaves as rmdir instead of unlink.
from OpenBSD.
2002-08-10 09:42:23 +00:00
yamt
5d8e52e7ab bring in EXAMPLES and BUGS from openbsd. 2002-08-10 09:32:19 +00:00
mjl
a32f58ffa9 Correct wrong comparison in example. 2002-07-21 19:04:03 +00:00
yamt
673cbedc13 import CAVEATS sections from OpenBSD.
with little tweak by me.
2002-07-10 14:37:12 +00:00
wiz
53f8a68c5f Add Xr to fileno(3). 2002-06-12 09:21:40 +00:00
wiz
3fb28eec1f __STDC__ is always defined on NetBSD. 2002-05-26 14:43:59 +00:00
thorpej
42320e8223 * Move the prototype of __svfscanf from <stdio.h> to libc/stdio/local.h.
* Add prototype for vfscanf to <stdio.h>.
* Remove #define of vfscanf to __svfscanf from <stdio.h>.
* Include local.h in libc files which need __svfscanf.
* Add vfscanf weak alias to __svfscanf.

Fixes standards/16997.

NOTE: libc minor not bumped -- ride on the bump to 12.84 made by
itojun today.
2002-05-24 22:17:20 +00:00
kleink
eedae55de3 Consistent wording: plain files -> regular files. 2002-05-15 07:00:22 +00:00
bjh21
c9e4965681 Revert addition of mkdtemp() to libnbcompat. I don't think we need mktemp(1)
after all.
2002-04-01 13:59:34 +00:00
bjh21
58017a564d Add mkdtemp to libnbcompat, since glibc doesn't have it an mktemp(1) will
need it.
2002-03-31 18:04:11 +00:00
yamt
ffca92c5a2 putwc and putwchar's argument is wchar_t, not wint_t. 2002-03-14 21:21:00 +00:00
christos
9588aa8fef fully initialize the structure to avoid gcc complaints. 2002-03-12 22:56:16 +00:00
ross
814f296b77 Generate <>& symbolically. 2002-02-07 07:00:09 +00:00
wiz
38462ff661 Punctuation nit, and slight grammar improvement. 2002-02-02 10:50:52 +00:00
yamt
ec88065e0f note that our fsetpos/fgetpos don't know about stream's state.
it's a bug since we now have stateful encodings like iso2022 and
wide char functions like fgetwc.
2002-02-02 08:56:53 +00:00
kleink
222fdd84c8 One pasto, one typo. 2002-01-21 11:54:15 +00:00
wiz
1f01816d38 Avoid Po/Pq. 2001-12-07 12:36:40 +00:00
wiz
69486f2d3a Slight grammar improvement. 2001-12-07 12:36:11 +00:00
wiz
881a6c7de6 Markup getwc in one place. 2001-12-07 12:35:54 +00:00
wiz
aa5abf3731 Grammar improvements, some additional markup and a typo fix. 2001-12-07 12:35:13 +00:00
yamt
fa787c7eba g/c #if 0. 2001-12-07 12:18:53 +00:00
yamt
a510b02e77 add files forgotten in my previous commit. 2001-12-07 12:02:07 +00:00
yamt
17f3654a64 - make FILE structure extensible without breaking binary-compatibility.
- add fputwc, fgetwc, fwide and related functions.
- add hooks needed to maintain the orientation of file stream.
2001-12-07 11:47:40 +00:00
kleink
2a6842fe56 C99: Recognize %F here, too. 2001-12-02 20:53:49 +00:00
kleink
f2c0cf9cec Fix a mis-pasting in previous; pointed out by Thomas Klausner. 2001-12-02 20:41:12 +00:00
kleink
dcf4ce2588 C99:
* Recognize %F.
* Convert {Infinity,NaN} to {"inf","nan"} for %[efg], and to
  {"INF","NAN"} for %[EFG].
2001-12-02 20:12:03 +00:00
kleink
80f30d4de0 Since we're returned the sign of a floating-point number by __dtoa(),
use that to decide whether to include a minus sign in the result.
Fixes printing -0.0, and thus PR lib/3137.
2001-11-28 11:58:22 +00:00