Commit Graph

44 Commits

Author SHA1 Message Date
joerg af730bf1c8 Fix visibility of various C99 features, esp. for C++11. 2020-03-20 01:08:42 +00:00
maya 1530e68601 Limit wcslcat, wcslcpy visibility to _NETBSD_SOURCE
wcswidth, wcwidth to POSIX.1-2001 or _NETBSD_SOURCE

Updated patch from kretschm in PR standards/39422
2018-12-28 13:11:46 +00:00
kamil 6245abaafa Import wcsnlen(3) to libc
The wcsnlen(3) function conforms to POSIX.1-2008 and is an addition to the
ISO C standard.

size_t wcsnlen(const wchar_t *s, size_t maxlen);

The wcsnlen(3) function computes the number of wide-characters in a wide-
-string to which s points, not including NULL terminating wide-character
code and checking no more than maxlen wide-characters. This function never
examines wide-characters beyond a wide-string of maxlen size.


This function is a safer version of wcslen(3):

size_t wcslen(const wchar_t *s);


Update STANDARDS section of wmemchr(3) describing wide-character functions.
2016-10-15 14:21:59 +00:00
christos faef322439 add open_{,w}memstream 2014-10-13 00:47:03 +00:00
degroote 0809f57592 Expose properly vfwscanf and friends for POSIX_SOURCE >= 200112L 2013-11-21 09:09:52 +00:00
joerg 9c11b12444 Add nl_langinfo_l, catopen_l and wcsftime_l. 2013-08-19 08:03:33 +00:00
joerg 85a67e61f7 Add mbsnrtowcs and wcsnrtombs. Approved by core. 2013-05-28 16:57:56 +00:00
joerg d1548b5ebd More __BEGIN_DECLS / __END_DECLS wrappers. 2013-04-19 23:45:15 +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 10e0e4a06b Add wcscoll_l, wcsxfrm_l, wcsncasecmp_l, wcscasecmp_l, btowc_l,
mbrlen_l, mbsinit_l, mbsrtowcs_l, wcrtomb_l, wcsrtombs_l and wctob_l.
2013-04-18 23:24:26 +00:00
joerg 9a7fa6ff3c Add wcstof_l, wcstod_l and wcstold_l. 2013-04-18 22:23:17 +00:00
joerg 444e318434 Add support for wcstoimax_l and friends. 2013-04-16 16:52:13 +00:00
joerg 2eb3224ae9 Also add prototypes for wcwidth_l and wcswidth_l. 2013-04-16 11:55:02 +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 377cb4e4f9 1. {wctype,wctrans,mbstate}_t: switch MD to MI like other
libc implementation (such as *BSD and glibc2).

2. don't typedef void * wc{type,trans}_t, suggested by soda@-san.
   it may pass through compiler type check, it's harmful.
   so i introduce dummy struct __tag_wc{type,trans}_t(iconv_t already does).

no ABI change was made.
2010-03-27 22:14:09 +00:00
christos db576bf322 Don't define wchar_t for c++; it is native in the language. From Alexander
Nasonov
2009-11-15 22:21:03 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
christos 54097ce7af PR/34238: Aleksey Cheusov: add wcsdup, wcscasecmp and wcsncasecmp functions 2006-08-22 20:50:46 +00:00
tnozaki f9de1ba57e add c99 wcstof(3) and wcstold(3).
requested by skrll AT netbsd DOT org, thanks.

bump libc minor 138 -> 139.
2006-04-15 12:17:22 +00:00
christos cf3e6ebd2b add t_putws 2005-05-15 21:10:52 +00:00
christos 75b76923c6 Wide stdio functions. 2005-05-14 23:51:42 +00:00
christos eb808713b7 PR/29826: J. T. Conklin: Add wcsftime(3) (from FreeBSD) 2005-03-30 03:47:11 +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 c19ffd7809 C99: Provide WCHAR_{MAX,MIN} via <machine/wchar_limits.h> (we'll also
provide WINT_{MAX,MIN} along with it).
Fixes PR standards/24040 from Masao Uebayashi.
2004-05-08 21:57:05 +00:00
itojun 04392e7f81 prototype must not have variable name 2003-07-08 05:39:23 +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
tshiozak 3f9925f700 add wcstoll, wcstoimax, wcstoull and wcstoumax. (lib/20656)
- these are defined in C99 (wcsto[ui]max) and SUSv3.
  - these implementations are written by sigsegv@s25.xrea.com,
    derived from NetBSD's wcstol/wcstoul.
  - I just added some comments.
2003-03-11 09:21:22 +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
tshiozak 326ed36874 changes related to lib/20576 and lib/20577.
- add wcstok() and wcswcs(),
  - add wcstok(3),
  - move btowc() and wctob() into each ctype modules,
  - bump ctype interface ABI version,
  - bump i18n modules' minor and
  - update sets.
and fix a stupid bug in _RUNE_ISCACHED macro.
2003-03-05 20:18:14 +00:00
tshiozak 5af70bc478 - add wctob() function. (I forgot it at the last commit.)
- fix btowc(); I quite misunderstood about it.
2003-03-03 07:39:53 +00:00
tshiozak 31e2cbf0b5 add some ISO C 1995 I18N functions and types:
btowc, wctrans, towctrans, wcscoll, wcsxfrm, wctype_t and wctrans_t.
2003-03-02 22:18:11 +00:00
yamt 3eaf103145 fix prototype of fputwc, putwc and putwchar. 2002-03-14 21:22:28 +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
yamt a9c5a86aa9 add wcstod/wcstol/wcstoul. 2001-09-27 16:30:35 +00:00
kleink 6b94677e25 Sprinkle some __restrict into <wchar.h>. 2000-12-29 15:26:33 +00:00
itojun de1996b103 wcwidth is outside of standard 2000-12-22 05:31:42 +00:00
itojun ab9a937270 add wcsl{cat,cpy} 2000-12-22 05:23:27 +00:00
itojun 408f4697a6 first import of citrus LC_CTYPE locale. singlebyte only at this moment.
shot-term TODO:
- enable multibyte locales.  this includes loadable locale modules
  (#ifdef DLRUNE).
- populate LC_CTYPE definition files.
- other functions such as iconv()
- make libc functions more friendly with multibyte.
- multilingualize other LC_xx
- torture tests

XXX don't forget to "make depend" when you rebuild libc, multibyte.c is
moved from lib/libc/stdlib to lib/libc/locale.
2000-12-21 11:29:47 +00:00
itojun 4c56e769f6 add dummy wcwidth() and wcswidth(). wcwidth() will be updated later. 2000-12-21 08:30:52 +00:00
itojun b6ad76f487 add wcs* functions. consier it as part of libc minor crank 68 -> 69.
add decl of WEOF into wchar.h.  ISO/IEC 9899:1999(E)..
2000-12-21 05:12:18 +00:00
itojun e07051a797 ISO 9899-1990: #include <wchar.h> should pull definition for "NULL" in.
checked with Norihiro Kumagai <kuma@oasis.sharplabs.com>
2000-12-20 22:36:25 +00:00
itojun 97e0963d33 add wmem* functions, from citrus. bump libc shlib minor. 2000-12-20 14:53:23 +00:00
kleink 405a7540e7 * Move <wchar.h> from libcurses to include (for the missing functionality
is to be provided by libc).
* Define wint_t and size_t in <wchar.h> as well.
2000-04-20 09:56:36 +00:00