backupfile
base32
base64
- btowc
+ btoc32
buffer-lcm
byteswap
c-strcase
+ c32iscntrl
+ c32isprint
+ c32isspace
+ c32width
canon-host
canonicalize
chmodat
malloc-gnu
manywarnings
mbrlen
+ mbrtoc32
mbrtowc
mbschr
mbslen
verify
verror
version-etc-fsf
- wcwidth
winsz-ioctl
winsz-termios
write-any-file
#include <sys/types.h>
#include <getopt.h>
#include <c-ctype.h>
-#include <wchar.h>
-#include <wctype.h>
+#include <uchar.h>
#include "system.h"
#include "assure.h"
for (char *src = cell; src != srcend; src += n)
{
- wchar_t wc;
+ char32_t wc;
size_t srcbytes = srcend - src;
- n = mbrtowc (&wc, src, srcbytes, &mbstate);
+ n = mbrtoc32 (&wc, src, srcbytes, &mbstate);
bool ok = n <= srcbytes;
if (ok)
- ok = !iswcntrl (wc);
+ ok = !c32iscntrl (wc);
else
n = 1;
#include <getopt.h>
#include <signal.h>
#include <selinux/selinux.h>
-#include <wchar.h>
+#include <uchar.h>
#if HAVE_LANGINFO_CODESET
# include <langinfo.h>
mbstate_t mbstate; mbszero (&mbstate);
do
{
- wchar_t wc;
+ char32_t wc;
size_t bytes;
int w;
- bytes = mbrtowc (&wc, p, plimit - p, &mbstate);
+ bytes = mbrtoc32 (&wc, p, plimit - p, &mbstate);
if (bytes == (size_t) -1)
{
/* A null wide character was encountered. */
bytes = 1;
- w = wcwidth (wc);
+ w = c32width (wc);
if (w >= 0)
{
/* A printable multibyte character.
wchar_t wc; \
size_t slen = strlen (s); \
ssize_t bytes; \
+ /* Use mbrtowc not mbrtoc32, as per POSIX. */ \
bytes = mbrtowc (&wc, s, slen, &mbstate); \
if (0 < bytes) \
{ \
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
-#include <wchar.h>
-#include <wctype.h>
+#include <uchar.h>
#include "system.h"
#include "assure.h"
static int
isnbspace (int c)
{
- return iswnbspace (btowc (c));
+ return iswnbspace (btoc32 (c));
}
/* FILE is the name of the file (or null for standard input)
bytes_read += prev;
do
{
- wchar_t wide_char;
+ char32_t wide_char;
size_t n;
bool wide = true;
#if SUPPORT_OLD_MBRTOWC
backup_state = state;
#endif
- n = mbrtowc (&wide_char, p, bytes_read, &state);
+ n = mbrtoc32 (&wide_char, p, bytes_read, &state);
if (n == (size_t) -2)
{
#if SUPPORT_OLD_MBRTOWC
in_word = false;
break;
default:
- if (wide && iswprint (wide_char))
+ if (wide && c32isprint (wide_char))
{
- /* wcwidth can be expensive on OSX for example,
+ /* c32width can be expensive on OSX for example,
so avoid if not needed. */
if (print_linelength)
{
- int width = wcwidth (wide_char);
+ int width = c32width (wide_char);
if (width > 0)
linepos += width;
}
- if (iswspace (wide_char) || iswnbspace (wide_char))
+ if (c32isspace (wide_char) || iswnbspace (wide_char))
goto mb_word_separator;
in_word = true;
}