Commit Graph

88 Commits

Author SHA1 Message Date
christos df2bc3e4f8 add the signal safe prototypes 2013-05-04 18:30:14 +00:00
joerg cd8f66ed62 Don't pollute the name space with the various stdio macros for C++. 2013-04-26 17:37:06 +00:00
joerg 6c5ca8f80c Add missing __BEGIN_DECLS/__END_DECLS. 2013-04-19 23:42:26 +00:00
joerg 9790c07a61 Add scanf_l and wscanf_l families. 2013-04-19 23:32:16 +00:00
joerg 2561b63430 Add explicit locale versions for the printf family. Replace asprintf,
snprintf and sprintf with simple wrappers around the corresponding
va_list functions to reduce code duplication.
2013-04-19 15:22:24 +00:00
joerg 58520523b5 White space 2013-04-17 09:07:32 +00:00
christos ca5a32edc2 specify size of the array to help -fmudflap 2012-04-18 19:30:15 +00:00
christos 0ed4e38b3f funopen2() 2012-03-27 15:06:01 +00:00
christos 1897181a72 From tnozaki@: make fpos_t a complex object that keeps track of the parse
state of the stream. Change argument of the seek function to funopen() from
fpos_t to off_t. Make f{g,s}etpos() use the new fpos_t struct, while providing
backwards compatible entry points. Approved by releng@
2012-01-22 18:36:14 +00:00
joerg 3eb244d801 Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
2011-07-17 20:54:30 +00:00
tnozaki 93b7363c93 add fmemopen(3) derrived from POSIX:2008.
libc minor bump.
2010-09-24 09:21:53 +00:00
christos 748dbd74c6 Add dprintf and vdprintf. XXX: Might ifdef it if too many things break. 2010-09-06 14:52:26 +00:00
joerg 8a601553bc Consistently use __printflike and __scanflike. 2010-02-25 18:37:12 +00:00
joerg 00711901b6 Use a proper char */size_t pair in __sfileext to keep track of the line
buffer for fgetln and fgetwln. Simplifies code by dropping the INT_MAX
related logic. Drop conditionals around FREELB, free(NULL) is valid.
2010-01-11 20:39:29 +00:00
roy d4a3cf6a5a Add implementations for getdelim(3) and getline(3). 2009-07-13 22:19:24 +00:00
christos 9fa41d7348 add missing attributes to the remaining calls, even the ones that gcc has
builtin attributes for (for symmetry and consistency). In the future this
might change to use compiler-neutral macros. On the other hand I don't
know of any other compiler that provides other macros with similar
functionality, so why bother?
2008-09-21 16:59:46 +00:00
matt e90b08472f Add _POSIX_HOST_NAME_MAX and _POSIX_SYMLOOP_MAX to <limits.h> and add some
references to them in <sys/param.h>
in <stdio.h> also export v*scanf when _ISOC99_SOURCE is defined

From andy dot shevchenko at gmail dot com.
2008-08-04 17:08:49 +00:00
christos 749de7f2a4 Since _file is a short, check that the fd fits in it, otherwise bail with
EMFILE. We treat _file as an unsigned short to double our range, with a
special case for -1 (closed). Make a note of what we should do about stdio
if we ever bump libc. We could change _file in the future compatibly to an
int by putting it in the extension space but for now we don't bother.
2008-03-13 15:40:00 +00:00
kristerw 1ef79ebc7d Do not include SSP files unless _FORTIFY_SOURCE > 0. 2007-08-02 21:49:09 +00:00
tls dc99372be9 Match usage of FORTIFY_SOURCE on other platforms by not requiring special
include path: the normal header files now include the "SSP" ones (which one
should note are not really named right: SSP and FORTIFY_SOURCE are independent
features).

Disable USE_SSP on targets where the compiler doesn't support it at all
(mips, alpha) or it's known broken (sh3).  But enable FORTIFY_SOURCE,
without SSP, on those platforms -- tested on mipsel.
2007-05-30 21:14:35 +00:00
christos a12ac1f620 remove __SAFE 2007-02-02 23:00:53 +00:00
bjh21 2f3712dfa1 defined(_NETBSD_SOURCE) is equivalent to (!defined(_ANSI_SOURCE) &&
!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)), so there's no
need to check both of them.
2006-12-09 19:33:42 +00:00
christos 4ca73ce810 Don't expose _ss functions for 4.0. Requested by core. 2006-11-22 17:23:24 +00:00
christos 1e468fbf99 - flags should be unsigned short instead of short.
- add __SAFE flag, to indicate that we want async-signal-safe functionality
  only.
- add snprintf_ss, and vsnprintf_ss; these are undocumented on purpose.
2006-10-27 20:03:21 +00:00
mrg 9f88f12295 add __BEGIN_DECLS/__END_DECLS around snprintf() & vsnprintf() prototypes. 2006-05-10 21:09:45 +00:00
perry e67ad767f5 inline -> __inline for selected things (specifically, the header
file is POSIX visible and the usage isn't #ifdef _KERNEL)

Discussed with core. I may need to go farther than this but for now
compilations done with gcc -ansi (i.e. firefox) will be okay.
2005-12-27 17:21:28 +00:00
perry a2cd732268 Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 19:12:23 +00:00
kleink 926eae7f66 Include <sys/ansi.h> after <sys/cdefs.h>; from Neil Booth in PR lib/30072. 2005-05-25 20:45:38 +00:00
kleink 691c56aa2e Belatedly move snprintf() and vnsnprintf() into the XPG4.2/C99 section. 2005-05-25 19:35:07 +00:00
kleink 13034da908 Add restrict qualifiers to fopen()/freopen() arguments. 2005-05-25 16:01:24 +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
perry 19b7469a00 de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
2005-02-03 04:39:32 +00:00
kleink 11f7fb5f29 Tidy up the namespace: lint -> __lint__. 2004-07-01 22:31:28 +00:00
drochner 4bf1529244 remove fgetstr() from public sight 2004-05-10 16:53:56 +00:00
christos 63f41ce367 add fgetstr 2004-04-21 00:05:05 +00:00
agc 039cc95684 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22270, verified by myself.
2003-08-07 09:44:09 +00:00
bjh21 9656aaa598 P_tmpdir isn't in POSIX, so only define it for _XOPEN_SOURCE and
_NETBSD_SOURCE.
2003-06-05 17:51:10 +00:00
bjh21 4be7a2dcf3 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
  can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
  various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
  !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them.  In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-28 23:16:11 +00:00
kleink 898beee0b0 As with _REENTRANT, don't provide simple non-locking macro versions of
several functions when _PTHREADS is defined (usually via cc -pthread).
2003-02-27 15:56:04 +00:00
christos 32c802c315 avoid TMP_MAX redefinition 2003-01-18 17:10:16 +00:00
thorpej c62a74e6d5 Merge the nathanw_sa branch. 2003-01-18 10:32:11 +00:00
atatat 5ea6c6f13e Spelling police. "__resitrct" was not spelled cirectly enough. 2002-12-20 20:59:22 +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
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
thorpej aa676fc0b2 Parameterize the vfscanf macro's arguments. Without them, 3rd party
software can become greatly confused.

This fixes 4 GCC 3.2 testsuite failures.

This is a stop-gap measure which can be easily applied to the 1.6
release branch.  A different fix for the trunk is forthcoming.
2002-05-24 21:07:44 +00:00
thorpej b57df3dd9d Add a scanf format attribute to __svfscanf(). 2002-05-24 06:17:29 +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 81ab746b71 Sprinkle some __restrict into stdio. 2000-12-29 15:22:48 +00:00
christos 8939b770e2 protect against multiple declarations. 2000-12-18 21:22:00 +00:00
briggs e4bb13f3cd Move fmtcheck() prototype to stdio.h. It makes more sense to declare it
with the formatting functions with which it is meant to be used.  Thanks
to Klaus Klein for "encouraging" me to make this change.
2000-11-15 15:44:05 +00:00