mirror of
https://abf.rosa.ru/djam/coreutils.git
synced 2025-02-24 09:42:49 +00:00
Update version to 9.5
This commit is contained in:
parent
dbad36e87c
commit
9912002c6c
7 changed files with 477 additions and 96 deletions
2
.abf.yml
2
.abf.yml
|
@ -1,3 +1,3 @@
|
||||||
sources:
|
sources:
|
||||||
coreutils-9.4.tar.xz: 7effa305c3f4bc0d40d79f1854515ebf5f688a18
|
coreutils-9.5.tar.xz: 867fed7ce2ee15c5150a355a5f3a3b50578cf78d
|
||||||
coreutils_man_ru.tar.gz: e39aa20bd84831221d73a758b3ef70bbb50c78f9
|
coreutils_man_ru.tar.gz: e39aa20bd84831221d73a758b3ef70bbb50c78f9
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
diff -ruN a/src/dircolors.hin b/src/dircolors.hin
|
diff -ruN a/src/dircolors.hin b/src/dircolors.hin
|
||||||
--- a/src/dircolors.hin 2023-07-04 20:06:08.000000000 +0900
|
--- a/src/dircolors.hin 2024-03-13 00:22:01.000000000 +0900
|
||||||
+++ b/src/dircolors.hin 2024-02-16 08:13:49.573667513 +0900
|
+++ b/src/dircolors.hin 2024-04-10 18:47:21.219731934 +0900
|
||||||
@@ -9,6 +9,10 @@
|
@@ -9,6 +9,10 @@
|
||||||
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
|
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
|
||||||
# slackware version of dircolors) are recognized but ignored.
|
# slackware version of dircolors) are recognized but ignored.
|
||||||
|
@ -45,16 +45,16 @@ diff -ruN a/src/dircolors.hin b/src/dircolors.hin
|
||||||
+.csh 01;32
|
+.csh 01;32
|
||||||
|
|
||||||
# archives or compressed (bright red)
|
# archives or compressed (bright red)
|
||||||
.tar 01;31
|
|
||||||
@@ -144,6 +148,7 @@
|
|
||||||
.7z 01;31
|
.7z 01;31
|
||||||
.rz 01;31
|
@@ -111,6 +115,7 @@
|
||||||
|
.bz 01;31
|
||||||
|
.bz2 01;31
|
||||||
.cab 01;31
|
.cab 01;31
|
||||||
+.iso 01;31
|
+.iso 01;31
|
||||||
.wim 01;31
|
.cpio 01;31
|
||||||
.swm 01;31
|
.crate 01;31
|
||||||
.dwm 01;31
|
.deb 01;31
|
||||||
@@ -153,6 +158,8 @@
|
@@ -160,6 +165,8 @@
|
||||||
.avif 01;35
|
.avif 01;35
|
||||||
.jpg 01;35
|
.jpg 01;35
|
||||||
.jpeg 01;35
|
.jpeg 01;35
|
||||||
|
@ -63,7 +63,7 @@ diff -ruN a/src/dircolors.hin b/src/dircolors.hin
|
||||||
.mjpg 01;35
|
.mjpg 01;35
|
||||||
.mjpeg 01;35
|
.mjpeg 01;35
|
||||||
.gif 01;35
|
.gif 01;35
|
||||||
@@ -166,6 +173,7 @@
|
@@ -173,6 +180,7 @@
|
||||||
.tif 01;35
|
.tif 01;35
|
||||||
.tiff 01;35
|
.tiff 01;35
|
||||||
.png 01;35
|
.png 01;35
|
||||||
|
@ -71,7 +71,7 @@ diff -ruN a/src/dircolors.hin b/src/dircolors.hin
|
||||||
.svg 01;35
|
.svg 01;35
|
||||||
.svgz 01;35
|
.svgz 01;35
|
||||||
.mng 01;35
|
.mng 01;35
|
||||||
@@ -178,6 +186,9 @@
|
@@ -185,6 +193,9 @@
|
||||||
.webm 01;35
|
.webm 01;35
|
||||||
.webp 01;35
|
.webp 01;35
|
||||||
.ogm 01;35
|
.ogm 01;35
|
||||||
|
@ -81,7 +81,7 @@ diff -ruN a/src/dircolors.hin b/src/dircolors.hin
|
||||||
.mp4 01;35
|
.mp4 01;35
|
||||||
.m4v 01;35
|
.m4v 01;35
|
||||||
.mp4v 01;35
|
.mp4v 01;35
|
||||||
@@ -217,6 +228,12 @@
|
@@ -224,6 +235,12 @@
|
||||||
.ogg 00;36
|
.ogg 00;36
|
||||||
.ra 00;36
|
.ra 00;36
|
||||||
.wav 00;36
|
.wav 00;36
|
||||||
|
@ -94,7 +94,7 @@ diff -ruN a/src/dircolors.hin b/src/dircolors.hin
|
||||||
|
|
||||||
# https://wiki.xiph.org/MIME_Types_and_File_Extensions
|
# https://wiki.xiph.org/MIME_Types_and_File_Extensions
|
||||||
.oga 00;36
|
.oga 00;36
|
||||||
@@ -224,27 +241,80 @@
|
@@ -231,27 +248,80 @@
|
||||||
.spx 00;36
|
.spx 00;36
|
||||||
.xspf 00;36
|
.xspf 00;36
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
--- coreutils-8.14/lib/getugroups.c.getgrouplist~ 2011-10-20 20:03:09.911334912 +0200
|
diff -ruN a/lib/getugroups.c b/lib/getugroups.c
|
||||||
+++ coreutils-8.14/lib/getugroups.c 2011-10-20 20:03:18.968325315 +0200
|
--- a/lib/getugroups.c 2024-04-10 20:11:58.434321202 +0900
|
||||||
|
+++ b/lib/getugroups.c 2024-04-10 20:15:11.853008324 +0900
|
||||||
@@ -19,6 +19,9 @@
|
@@ -19,6 +19,9 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -10,14 +11,15 @@
|
||||||
#include "getugroups.h"
|
#include "getugroups.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -128,3 +131,4 @@ getugroups (int maxcount, gid_t *groupli
|
@@ -131,3 +134,4 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_GRP_H */
|
#endif /* HAVE_GRP_H */
|
||||||
+#endif /* have getgrouplist */
|
+#endif /* have getgrouplist */
|
||||||
--- coreutils-8.14/lib/mgetgroups.c.getgrouplist~ 2011-04-29 21:39:05.000000000 +0200
|
diff -ruN a/lib/mgetgroups.c b/lib/mgetgroups.c
|
||||||
+++ coreutils-8.14/lib/mgetgroups.c 2011-10-20 20:03:18.969325314 +0200
|
--- a/lib/mgetgroups.c 2024-04-10 20:11:58.438321382 +0900
|
||||||
@@ -115,9 +115,17 @@ mgetgroups (char const *username, gid_t
|
+++ b/lib/mgetgroups.c 2024-04-10 20:15:11.854008369 +0900
|
||||||
|
@@ -120,9 +120,17 @@
|
||||||
/* else no username, so fall through and use getgroups. */
|
/* else no username, so fall through and use getgroups. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -38,7 +40,7 @@
|
||||||
|
|
||||||
/* If we failed to count groups because there is no supplemental
|
/* If we failed to count groups because there is no supplemental
|
||||||
group support, then return an array containing just GID.
|
group support, then return an array containing just GID.
|
||||||
@@ -139,10 +147,25 @@ mgetgroups (char const *username, gid_t
|
@@ -144,10 +152,25 @@
|
||||||
if (g == NULL)
|
if (g == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -68,13 +70,14 @@
|
||||||
|
|
||||||
if (ng < 0)
|
if (ng < 0)
|
||||||
{
|
{
|
||||||
--- coreutils-8.14/m4/jm-macros.m4.getgrouplist~ 2011-10-10 09:30:55.000000000 +0200
|
diff -ruN a/m4/jm-macros.m4 b/m4/jm-macros.m4
|
||||||
+++ coreutils-8.14/m4/jm-macros.m4 2011-10-20 20:04:27.697252776 +0200
|
--- a/m4/jm-macros.m4 2024-01-01 22:27:23.000000000 +0900
|
||||||
@@ -77,6 +77,7 @@ AC_DEFUN([coreutils_MACROS],
|
+++ b/m4/jm-macros.m4 2024-04-10 20:16:13.349770362 +0900
|
||||||
|
@@ -67,6 +67,7 @@
|
||||||
|
fallocate
|
||||||
fchown
|
fchown
|
||||||
fchmod
|
fchmod
|
||||||
ftruncate
|
|
||||||
+ getgrouplist
|
+ getgrouplist
|
||||||
iswspace
|
setgroups
|
||||||
mkfifo
|
sethostname
|
||||||
mbrlen
|
siginterrupt
|
|
@ -1,27 +1,14 @@
|
||||||
diff -ruN a/bootstrap.conf b/bootstrap.conf
|
diff -ruN a/bootstrap.conf b/bootstrap.conf
|
||||||
--- a/bootstrap.conf 2023-08-29 20:39:27.000000000 +0900
|
--- a/bootstrap.conf 2024-01-01 22:27:23.000000000 +0900
|
||||||
+++ b/bootstrap.conf 2024-02-16 09:02:04.062423387 +0900
|
+++ b/bootstrap.conf 2024-04-10 20:10:39.935795554 +0900
|
||||||
@@ -167,6 +167,7 @@
|
@@ -163,6 +163,7 @@
|
||||||
maintainer-makefile
|
maintainer-makefile
|
||||||
malloc-gnu
|
malloc-gnu
|
||||||
manywarnings
|
manywarnings
|
||||||
+ mbfile
|
+ mbfile
|
||||||
mbrlen
|
mbrlen
|
||||||
|
mbrtoc32
|
||||||
mbrtowc
|
mbrtowc
|
||||||
mbsalign
|
|
||||||
diff -ruN a/configure.ac b/configure.ac
|
|
||||||
--- a/configure.ac 2023-08-29 20:39:27.000000000 +0900
|
|
||||||
+++ b/configure.ac 2024-02-16 09:02:04.062423387 +0900
|
|
||||||
@@ -448,6 +448,8 @@
|
|
||||||
# I'm leaving it here for now. This whole thing needs to be modernized...
|
|
||||||
gl_WINSIZE_IN_PTEM
|
|
||||||
|
|
||||||
+gl_MBFILE
|
|
||||||
+
|
|
||||||
gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
|
|
||||||
|
|
||||||
if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
|
|
||||||
diff -ruN a/lib/mbchar.h b/lib/mbchar.h
|
|
||||||
--- a/lib/mbchar.h 2023-07-30 19:58:32.000000000 +0900
|
--- a/lib/mbchar.h 2023-07-30 19:58:32.000000000 +0900
|
||||||
+++ b/lib/mbchar.h 2024-02-16 09:02:04.062423387 +0900
|
+++ b/lib/mbchar.h 2024-02-16 09:02:04.062423387 +0900
|
||||||
@@ -167,9 +167,7 @@
|
@@ -167,9 +167,7 @@
|
||||||
|
@ -60,16 +47,28 @@ diff -ruN a/lib/mbchar.h b/lib/mbchar.h
|
||||||
new_mbc->ptr = old_mbc->ptr;
|
new_mbc->ptr = old_mbc->ptr;
|
||||||
new_mbc->bytes = old_mbc->bytes;
|
new_mbc->bytes = old_mbc->bytes;
|
||||||
if ((new_mbc->wc_valid = old_mbc->wc_valid))
|
if ((new_mbc->wc_valid = old_mbc->wc_valid))
|
||||||
|
diff -ruN a/configure.ac b/configure.ac
|
||||||
|
--- a/configure.ac 2024-03-22 22:09:03.000000000 +0900
|
||||||
|
+++ b/configure.ac 2024-04-10 20:10:39.936795599 +0900
|
||||||
|
@@ -504,6 +504,8 @@
|
||||||
|
# I'm leaving it here for now. This whole thing needs to be modernized...
|
||||||
|
gl_WINSIZE_IN_PTEM
|
||||||
|
|
||||||
|
+gl_MBFILE
|
||||||
|
+
|
||||||
|
gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
|
||||||
|
|
||||||
|
if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
|
||||||
diff -ruN a/lib/mbfile.c b/lib/mbfile.c
|
diff -ruN a/lib/mbfile.c b/lib/mbfile.c
|
||||||
--- a/lib/mbfile.c 1970-01-01 09:00:00.000000000 +0900
|
--- a/lib/mbfile.c 1970-01-01 09:00:00.000000000 +0900
|
||||||
+++ b/lib/mbfile.c 2024-02-16 09:02:04.063423435 +0900
|
+++ b/lib/mbfile.c 2024-04-10 20:10:39.936795599 +0900
|
||||||
@@ -0,0 +1,3 @@
|
@@ -0,0 +1,3 @@
|
||||||
+#include <config.h>
|
+#include <config.h>
|
||||||
+#define MBFILE_INLINE _GL_EXTERN_INLINE
|
+#define MBFILE_INLINE _GL_EXTERN_INLINE
|
||||||
+#include "mbfile.h"
|
+#include "mbfile.h"
|
||||||
diff -ruN a/lib/mbfile.h b/lib/mbfile.h
|
diff -ruN a/lib/mbfile.h b/lib/mbfile.h
|
||||||
--- a/lib/mbfile.h 1970-01-01 09:00:00.000000000 +0900
|
--- a/lib/mbfile.h 1970-01-01 09:00:00.000000000 +0900
|
||||||
+++ b/lib/mbfile.h 2024-02-16 09:02:04.063423435 +0900
|
+++ b/lib/mbfile.h 2024-04-10 20:10:39.936795599 +0900
|
||||||
@@ -0,0 +1,255 @@
|
@@ -0,0 +1,255 @@
|
||||||
+/* Multibyte character I/O: macros for multi-byte encodings.
|
+/* Multibyte character I/O: macros for multi-byte encodings.
|
||||||
+ Copyright (C) 2001, 2005, 2009-2015 Free Software Foundation, Inc.
|
+ Copyright (C) 2001, 2005, 2009-2015 Free Software Foundation, Inc.
|
||||||
|
@ -328,7 +327,7 @@ diff -ruN a/lib/mbfile.h b/lib/mbfile.h
|
||||||
+#endif /* _MBFILE_H */
|
+#endif /* _MBFILE_H */
|
||||||
diff -ruN a/m4/mbfile.m4 b/m4/mbfile.m4
|
diff -ruN a/m4/mbfile.m4 b/m4/mbfile.m4
|
||||||
--- a/m4/mbfile.m4 1970-01-01 09:00:00.000000000 +0900
|
--- a/m4/mbfile.m4 1970-01-01 09:00:00.000000000 +0900
|
||||||
+++ b/m4/mbfile.m4 2024-02-16 09:02:04.063423435 +0900
|
+++ b/m4/mbfile.m4 2024-04-10 20:10:39.936795599 +0900
|
||||||
@@ -0,0 +1,14 @@
|
@@ -0,0 +1,14 @@
|
||||||
+# mbfile.m4 serial 7
|
+# mbfile.m4 serial 7
|
||||||
+dnl Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc.
|
+dnl Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc.
|
||||||
|
@ -345,9 +344,9 @@ diff -ruN a/m4/mbfile.m4 b/m4/mbfile.m4
|
||||||
+ :
|
+ :
|
||||||
+])
|
+])
|
||||||
diff -ruN a/src/expand.c b/src/expand.c
|
diff -ruN a/src/expand.c b/src/expand.c
|
||||||
--- a/src/expand.c 2023-07-17 21:07:45.000000000 +0900
|
--- a/src/expand.c 2024-01-01 22:27:23.000000000 +0900
|
||||||
+++ b/src/expand.c 2024-02-16 09:02:21.444260194 +0900
|
+++ b/src/expand.c 2024-04-10 20:10:39.937795644 +0900
|
||||||
@@ -37,6 +37,9 @@
|
@@ -38,6 +38,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -357,7 +356,7 @@ diff -ruN a/src/expand.c b/src/expand.c
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "expand-common.h"
|
#include "expand-common.h"
|
||||||
|
|
||||||
@@ -95,19 +98,20 @@
|
@@ -96,19 +99,20 @@
|
||||||
{
|
{
|
||||||
/* Input stream. */
|
/* Input stream. */
|
||||||
FILE *fp = next_file (nullptr);
|
FILE *fp = next_file (nullptr);
|
||||||
|
@ -382,7 +381,7 @@ diff -ruN a/src/expand.c b/src/expand.c
|
||||||
/* The following variables have valid values only when CONVERT
|
/* The following variables have valid values only when CONVERT
|
||||||
is true: */
|
is true: */
|
||||||
|
|
||||||
@@ -117,17 +121,23 @@
|
@@ -118,17 +122,23 @@
|
||||||
/* Index in TAB_LIST of next tab stop to examine. */
|
/* Index in TAB_LIST of next tab stop to examine. */
|
||||||
size_t tab_index = 0;
|
size_t tab_index = 0;
|
||||||
|
|
||||||
|
@ -410,7 +409,7 @@ diff -ruN a/src/expand.c b/src/expand.c
|
||||||
{
|
{
|
||||||
/* Column the next input tab stop is on. */
|
/* Column the next input tab stop is on. */
|
||||||
uintmax_t next_tab_column;
|
uintmax_t next_tab_column;
|
||||||
@@ -146,32 +156,34 @@
|
@@ -147,32 +157,34 @@
|
||||||
if (putchar (' ') < 0)
|
if (putchar (' ') < 0)
|
||||||
write_error ();
|
write_error ();
|
||||||
|
|
||||||
|
@ -454,9 +453,9 @@ diff -ruN a/src/expand.c b/src/expand.c
|
||||||
}
|
}
|
||||||
|
|
||||||
diff -ruN a/src/unexpand.c b/src/unexpand.c
|
diff -ruN a/src/unexpand.c b/src/unexpand.c
|
||||||
--- a/src/unexpand.c 2023-07-17 21:07:45.000000000 +0900
|
--- a/src/unexpand.c 2024-01-01 22:27:23.000000000 +0900
|
||||||
+++ b/src/unexpand.c 2024-02-16 09:02:04.063423435 +0900
|
+++ b/src/unexpand.c 2024-04-10 20:10:39.937795644 +0900
|
||||||
@@ -38,6 +38,9 @@
|
@@ -39,6 +39,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -466,7 +465,7 @@ diff -ruN a/src/unexpand.c b/src/unexpand.c
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "expand-common.h"
|
#include "expand-common.h"
|
||||||
|
|
||||||
@@ -104,11 +107,12 @@
|
@@ -105,11 +108,12 @@
|
||||||
{
|
{
|
||||||
/* Input stream. */
|
/* Input stream. */
|
||||||
FILE *fp = next_file (nullptr);
|
FILE *fp = next_file (nullptr);
|
||||||
|
@ -480,7 +479,7 @@ diff -ruN a/src/unexpand.c b/src/unexpand.c
|
||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return;
|
return;
|
||||||
@@ -116,12 +120,14 @@
|
@@ -117,12 +121,14 @@
|
||||||
/* The worst case is a non-blank character, then one blank, then a
|
/* The worst case is a non-blank character, then one blank, then a
|
||||||
tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so
|
tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so
|
||||||
allocate MAX_COLUMN_WIDTH bytes to store the blanks. */
|
allocate MAX_COLUMN_WIDTH bytes to store the blanks. */
|
||||||
|
@ -497,7 +496,7 @@ diff -ruN a/src/unexpand.c b/src/unexpand.c
|
||||||
|
|
||||||
/* If true, perform translations. */
|
/* If true, perform translations. */
|
||||||
bool convert = true;
|
bool convert = true;
|
||||||
@@ -155,12 +161,19 @@
|
@@ -156,12 +162,19 @@
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -520,7 +519,7 @@ diff -ruN a/src/unexpand.c b/src/unexpand.c
|
||||||
|
|
||||||
if (blank)
|
if (blank)
|
||||||
{
|
{
|
||||||
@@ -177,16 +190,16 @@
|
@@ -178,16 +191,16 @@
|
||||||
if (next_tab_column < column)
|
if (next_tab_column < column)
|
||||||
error (EXIT_FAILURE, 0, _("input line is too long"));
|
error (EXIT_FAILURE, 0, _("input line is too long"));
|
||||||
|
|
||||||
|
@ -540,7 +539,7 @@ diff -ruN a/src/unexpand.c b/src/unexpand.c
|
||||||
|
|
||||||
if (! (prev_blank && column == next_tab_column))
|
if (! (prev_blank && column == next_tab_column))
|
||||||
{
|
{
|
||||||
@@ -194,13 +207,14 @@
|
@@ -195,13 +208,14 @@
|
||||||
will be replaced by tabs. */
|
will be replaced by tabs. */
|
||||||
if (column == next_tab_column)
|
if (column == next_tab_column)
|
||||||
one_blank_before_tab_stop = true;
|
one_blank_before_tab_stop = true;
|
||||||
|
@ -557,7 +556,7 @@ diff -ruN a/src/unexpand.c b/src/unexpand.c
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Discard pending blanks, unless it was a single
|
/* Discard pending blanks, unless it was a single
|
||||||
@@ -208,7 +222,7 @@
|
@@ -209,7 +223,7 @@
|
||||||
pending = one_blank_before_tab_stop;
|
pending = one_blank_before_tab_stop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -566,7 +565,7 @@ diff -ruN a/src/unexpand.c b/src/unexpand.c
|
||||||
{
|
{
|
||||||
/* Go back one column, and force recalculation of the
|
/* Go back one column, and force recalculation of the
|
||||||
next tab stop. */
|
next tab stop. */
|
||||||
@@ -218,7 +232,7 @@
|
@@ -219,7 +233,7 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -575,7 +574,7 @@ diff -ruN a/src/unexpand.c b/src/unexpand.c
|
||||||
if (!column)
|
if (!column)
|
||||||
error (EXIT_FAILURE, 0, _("input line is too long"));
|
error (EXIT_FAILURE, 0, _("input line is too long"));
|
||||||
}
|
}
|
||||||
@@ -226,8 +240,11 @@
|
@@ -227,8 +241,11 @@
|
||||||
if (pending)
|
if (pending)
|
||||||
{
|
{
|
||||||
if (pending > 1 && one_blank_before_tab_stop)
|
if (pending > 1 && one_blank_before_tab_stop)
|
||||||
|
@ -589,7 +588,7 @@ diff -ruN a/src/unexpand.c b/src/unexpand.c
|
||||||
write_error ();
|
write_error ();
|
||||||
pending = 0;
|
pending = 0;
|
||||||
one_blank_before_tab_stop = false;
|
one_blank_before_tab_stop = false;
|
||||||
@@ -237,16 +254,17 @@
|
@@ -238,16 +255,17 @@
|
||||||
convert &= convert_entire_line || blank;
|
convert &= convert_entire_line || blank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -612,7 +611,7 @@ diff -ruN a/src/unexpand.c b/src/unexpand.c
|
||||||
|
|
||||||
diff -ruN a/tests/expand/mb.sh b/tests/expand/mb.sh
|
diff -ruN a/tests/expand/mb.sh b/tests/expand/mb.sh
|
||||||
--- a/tests/expand/mb.sh 1970-01-01 09:00:00.000000000 +0900
|
--- a/tests/expand/mb.sh 1970-01-01 09:00:00.000000000 +0900
|
||||||
+++ b/tests/expand/mb.sh 2024-02-16 09:02:04.064423484 +0900
|
+++ b/tests/expand/mb.sh 2024-04-10 20:10:39.937795644 +0900
|
||||||
@@ -0,0 +1,98 @@
|
@@ -0,0 +1,98 @@
|
||||||
+#!/bin/sh
|
+#!/bin/sh
|
||||||
+
|
+
|
||||||
|
@ -713,9 +712,9 @@ diff -ruN a/tests/expand/mb.sh b/tests/expand/mb.sh
|
||||||
+
|
+
|
||||||
+exit $fail
|
+exit $fail
|
||||||
diff -ruN a/tests/local.mk b/tests/local.mk
|
diff -ruN a/tests/local.mk b/tests/local.mk
|
||||||
--- a/tests/local.mk 2023-08-29 20:39:27.000000000 +0900
|
--- a/tests/local.mk 2024-03-22 22:09:03.000000000 +0900
|
||||||
+++ b/tests/local.mk 2024-02-16 09:02:04.064423484 +0900
|
+++ b/tests/local.mk 2024-04-10 20:10:39.937795644 +0900
|
||||||
@@ -585,6 +585,7 @@
|
@@ -590,6 +590,7 @@
|
||||||
tests/du/threshold.sh \
|
tests/du/threshold.sh \
|
||||||
tests/du/trailing-slash.sh \
|
tests/du/trailing-slash.sh \
|
||||||
tests/du/two-args.sh \
|
tests/du/two-args.sh \
|
||||||
|
@ -723,7 +722,7 @@ diff -ruN a/tests/local.mk b/tests/local.mk
|
||||||
tests/id/gnu-zero-uids.sh \
|
tests/id/gnu-zero-uids.sh \
|
||||||
tests/id/no-context.sh \
|
tests/id/no-context.sh \
|
||||||
tests/id/context.sh \
|
tests/id/context.sh \
|
||||||
@@ -738,6 +739,7 @@
|
@@ -746,6 +747,7 @@
|
||||||
tests/touch/read-only.sh \
|
tests/touch/read-only.sh \
|
||||||
tests/touch/relative.sh \
|
tests/touch/relative.sh \
|
||||||
tests/touch/trailing-slash.sh \
|
tests/touch/trailing-slash.sh \
|
||||||
|
@ -733,7 +732,7 @@ diff -ruN a/tests/local.mk b/tests/local.mk
|
||||||
# See tests/factor/create-test.sh.
|
# See tests/factor/create-test.sh.
|
||||||
diff -ruN a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
|
diff -ruN a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
|
||||||
--- a/tests/unexpand/mb.sh 1970-01-01 09:00:00.000000000 +0900
|
--- a/tests/unexpand/mb.sh 1970-01-01 09:00:00.000000000 +0900
|
||||||
+++ b/tests/unexpand/mb.sh 2024-02-16 09:02:04.064423484 +0900
|
+++ b/tests/unexpand/mb.sh 2024-04-10 20:10:39.937795644 +0900
|
||||||
@@ -0,0 +1,97 @@
|
@@ -0,0 +1,97 @@
|
||||||
+#!/bin/sh
|
+#!/bin/sh
|
||||||
+
|
+
|
||||||
|
|
|
@ -13,9 +13,9 @@ Subject: [PATCH] coreutils-i18n-un-expand-BOM.patch
|
||||||
6 files changed, 342 insertions(+), 2 deletions(-)
|
6 files changed, 342 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
diff -ruN a/src/expand.c b/src/expand.c
|
diff -ruN a/src/expand.c b/src/expand.c
|
||||||
--- a/src/expand.c 2024-02-16 08:30:40.806356257 +0900
|
--- a/src/expand.c 2024-04-10 20:11:58.449321876 +0900
|
||||||
+++ b/src/expand.c 2024-02-16 08:33:35.652890747 +0900
|
+++ b/src/expand.c 2024-04-10 20:12:39.007143472 +0900
|
||||||
@@ -100,12 +100,34 @@
|
@@ -101,12 +101,34 @@
|
||||||
FILE *fp = next_file (nullptr);
|
FILE *fp = next_file (nullptr);
|
||||||
mb_file_t mbf;
|
mb_file_t mbf;
|
||||||
mbf_char_t c;
|
mbf_char_t c;
|
||||||
|
@ -51,7 +51,7 @@ diff -ruN a/src/expand.c b/src/expand.c
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@@ -130,6 +152,27 @@
|
@@ -131,6 +153,27 @@
|
||||||
if ((mb_iseof (c)) && (fp = next_file (fp)))
|
if ((mb_iseof (c)) && (fp = next_file (fp)))
|
||||||
{
|
{
|
||||||
mbf_init (mbf, fp);
|
mbf_init (mbf, fp);
|
||||||
|
@ -80,17 +80,17 @@ diff -ruN a/src/expand.c b/src/expand.c
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
diff -ruN a/src/expand-common.c b/src/expand-common.c
|
diff -ruN a/src/expand-common.c b/src/expand-common.c
|
||||||
--- a/src/expand-common.c 2023-08-29 20:39:27.000000000 +0900
|
--- a/src/expand-common.c 2024-01-01 22:27:23.000000000 +0900
|
||||||
+++ b/src/expand-common.c 2024-02-16 08:31:42.593018769 +0900
|
+++ b/src/expand-common.c 2024-04-10 20:12:39.008143517 +0900
|
||||||
@@ -18,6 +18,7 @@
|
@@ -19,6 +19,7 @@
|
||||||
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
+#include <mbfile.h>
|
+#include <mbfile.h>
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "fadvise.h"
|
#include "fadvise.h"
|
||||||
#include "quote.h"
|
#include "quote.h"
|
||||||
@@ -122,6 +123,119 @@
|
@@ -123,6 +124,119 @@
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,8 +211,8 @@ diff -ruN a/src/expand-common.c b/src/expand-common.c
|
||||||
to the list of tab stops. */
|
to the list of tab stops. */
|
||||||
extern void
|
extern void
|
||||||
diff -ruN a/src/expand-common.h b/src/expand-common.h
|
diff -ruN a/src/expand-common.h b/src/expand-common.h
|
||||||
--- a/src/expand-common.h 2023-08-29 20:39:27.000000000 +0900
|
--- a/src/expand-common.h 2024-01-01 22:27:23.000000000 +0900
|
||||||
+++ b/src/expand-common.h 2024-02-16 08:31:42.593018769 +0900
|
+++ b/src/expand-common.h 2024-04-10 20:12:39.008143517 +0900
|
||||||
@@ -25,6 +25,18 @@
|
@@ -25,6 +25,18 @@
|
||||||
/* The desired exit status. */
|
/* The desired exit status. */
|
||||||
extern int exit_status;
|
extern int exit_status;
|
||||||
|
@ -233,9 +233,9 @@ diff -ruN a/src/expand-common.h b/src/expand-common.h
|
||||||
extern void
|
extern void
|
||||||
add_tab_stop (uintmax_t tabval);
|
add_tab_stop (uintmax_t tabval);
|
||||||
diff -ruN a/src/unexpand.c b/src/unexpand.c
|
diff -ruN a/src/unexpand.c b/src/unexpand.c
|
||||||
--- a/src/unexpand.c 2024-02-16 08:30:40.806356257 +0900
|
--- a/src/unexpand.c 2024-04-10 20:11:58.449321876 +0900
|
||||||
+++ b/src/unexpand.c 2024-02-16 08:31:42.593018769 +0900
|
+++ b/src/unexpand.c 2024-04-10 20:12:39.008143517 +0900
|
||||||
@@ -113,16 +113,36 @@
|
@@ -114,16 +114,36 @@
|
||||||
include characters other than spaces, so the blanks must be
|
include characters other than spaces, so the blanks must be
|
||||||
stored, not merely counted. */
|
stored, not merely counted. */
|
||||||
mbf_char_t *pending_blank;
|
mbf_char_t *pending_blank;
|
||||||
|
@ -273,7 +273,7 @@ diff -ruN a/src/unexpand.c b/src/unexpand.c
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@@ -166,6 +186,27 @@
|
@@ -167,6 +187,27 @@
|
||||||
if ((mb_iseof (c)) && (fp = next_file (fp)))
|
if ((mb_iseof (c)) && (fp = next_file (fp)))
|
||||||
{
|
{
|
||||||
mbf_init (mbf, fp);
|
mbf_init (mbf, fp);
|
||||||
|
@ -302,8 +302,8 @@ diff -ruN a/src/unexpand.c b/src/unexpand.c
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
diff -ruN a/tests/expand/mb.sh b/tests/expand/mb.sh
|
diff -ruN a/tests/expand/mb.sh b/tests/expand/mb.sh
|
||||||
--- a/tests/expand/mb.sh 2024-02-16 08:30:40.806356257 +0900
|
--- a/tests/expand/mb.sh 2024-04-10 20:11:58.449321876 +0900
|
||||||
+++ b/tests/expand/mb.sh 2024-02-16 08:31:42.593018769 +0900
|
+++ b/tests/expand/mb.sh 2024-04-10 20:12:39.008143517 +0900
|
||||||
@@ -109,4 +109,75 @@
|
@@ -109,4 +109,75 @@
|
||||||
expand < in > out || fail=1
|
expand < in > out || fail=1
|
||||||
compare exp out > /dev/null 2>&1 || fail=1
|
compare exp out > /dev/null 2>&1 || fail=1
|
||||||
|
@ -381,8 +381,8 @@ diff -ruN a/tests/expand/mb.sh b/tests/expand/mb.sh
|
||||||
+
|
+
|
||||||
exit $fail
|
exit $fail
|
||||||
diff -ruN a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
|
diff -ruN a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
|
||||||
--- a/tests/unexpand/mb.sh 2024-02-16 08:30:40.806356257 +0900
|
--- a/tests/unexpand/mb.sh 2024-04-10 20:11:58.449321876 +0900
|
||||||
+++ b/tests/unexpand/mb.sh 2024-02-16 08:31:42.594018812 +0900
|
+++ b/tests/unexpand/mb.sh 2024-04-10 20:12:39.008143517 +0900
|
||||||
@@ -111,3 +111,62 @@
|
@@ -111,3 +111,62 @@
|
||||||
|
|
||||||
unexpand -a < in > out || fail=1
|
unexpand -a < in > out || fail=1
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
|
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
|
||||||
Name: coreutils
|
Name: coreutils
|
||||||
Version: 9.4
|
Version: 9.5
|
||||||
Release: 2
|
Release: 1
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: System/Base
|
Group: System/Base
|
||||||
Url: http://www.gnu.org/software/coreutils/
|
Url: http://www.gnu.org/software/coreutils/
|
||||||
|
@ -23,6 +23,8 @@ Source4: coreutils-colorls.csh
|
||||||
# Russian man page
|
# Russian man page
|
||||||
Source5: coreutils_man_ru.tar.gz
|
Source5: coreutils_man_ru.tar.gz
|
||||||
Source6: gcc-wrapper.sh
|
Source6: gcc-wrapper.sh
|
||||||
|
# need for patch2108
|
||||||
|
Source7: mbchar.h
|
||||||
# require_selinux_(): use selinuxenabled(8) if available
|
# require_selinux_(): use selinuxenabled(8) if available
|
||||||
Patch105: coreutils-8.26-selinuxenable.patch
|
Patch105: coreutils-8.26-selinuxenable.patch
|
||||||
#SELINUX Patch - implements Redhat changes
|
#SELINUX Patch - implements Redhat changes
|
||||||
|
@ -41,7 +43,7 @@ Patch909: coreutils-5.1.0-64bit-fixes.patch
|
||||||
# https://qa.mandriva.com/show_bug.cgi?id=38577
|
# https://qa.mandriva.com/show_bug.cgi?id=38577
|
||||||
Patch911: coreutils-8.3-groupfix.patch
|
Patch911: coreutils-8.3-groupfix.patch
|
||||||
|
|
||||||
Patch1011: coreutils-9.4-DIR_COLORS-mdkconf.patch
|
Patch1011: coreutils-9.5-DIR_COLORS-mdkconf.patch
|
||||||
#(peroyvind): fix a test that fails to compile with -Werror=format-security
|
#(peroyvind): fix a test that fails to compile with -Werror=format-security
|
||||||
Patch1014: coreutils-8.22-check-string-format.patch
|
Patch1014: coreutils-8.22-check-string-format.patch
|
||||||
#(peroyvind): add missing header includes
|
#(peroyvind): add missing header includes
|
||||||
|
@ -69,7 +71,7 @@ Patch2112: coreutils-i18n-un-expand-BOM.patch
|
||||||
Patch2115: coreutils-9.4-if-lint.patch
|
Patch2115: coreutils-9.4-if-lint.patch
|
||||||
|
|
||||||
#getgrouplist() patch from Ulrich Drepper.
|
#getgrouplist() patch from Ulrich Drepper.
|
||||||
Patch2908: coreutils-8.14-getgrouplist.patch
|
Patch2908: coreutils-9.5-getgrouplist.patch
|
||||||
|
|
||||||
#BuildRequires: locales-fr
|
#BuildRequires: locales-fr
|
||||||
#BuildRequires: locales-ja
|
#BuildRequires: locales-ja
|
||||||
|
@ -123,7 +125,11 @@ BuildArch: noarch
|
||||||
This package contains coreutils documentation in GNU info format.
|
This package contains coreutils documentation in GNU info format.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -p1
|
%setup -q
|
||||||
|
|
||||||
|
cp %{SOURCE7} ./lib
|
||||||
|
|
||||||
|
%apply_patches
|
||||||
|
|
||||||
chmod +w ./src/dircolors.h
|
chmod +w ./src/dircolors.h
|
||||||
./src/dcgen ./src/dircolors.hin > ./src/dircolors.h
|
./src/dcgen ./src/dircolors.hin > ./src/dircolors.h
|
||||||
|
|
373
mbchar.h
Normal file
373
mbchar.h
Normal file
|
@ -0,0 +1,373 @@
|
||||||
|
/* Multibyte character data type.
|
||||||
|
Copyright (C) 2001, 2005-2007, 2009-2023 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2.1 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This file is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
/* Written by Bruno Haible <bruno@clisp.org>. */
|
||||||
|
|
||||||
|
/* A multibyte character is a short subsequence of a char* string,
|
||||||
|
representing a single 32-bit wide character.
|
||||||
|
|
||||||
|
We use multibyte characters instead of 32-bit wide characters because
|
||||||
|
of the following goals:
|
||||||
|
1) correct multibyte handling, i.e. operate according to the LC_CTYPE
|
||||||
|
locale,
|
||||||
|
2) ease of maintenance, i.e. the maintainer needs not know all details
|
||||||
|
of the ISO C 99 standard,
|
||||||
|
3) don't fail grossly if the input is not in the encoding set by the
|
||||||
|
locale, because often different encodings are in use in the same
|
||||||
|
countries (ISO-8859-1/UTF-8, EUC-JP/Shift_JIS, ...),
|
||||||
|
4) fast in the case of ASCII characters.
|
||||||
|
|
||||||
|
Multibyte characters are only accessed through the mb* macros.
|
||||||
|
|
||||||
|
mb_ptr (mbc)
|
||||||
|
return a pointer to the beginning of the multibyte sequence.
|
||||||
|
|
||||||
|
mb_len (mbc)
|
||||||
|
returns the number of bytes occupied by the multibyte sequence.
|
||||||
|
Always > 0.
|
||||||
|
|
||||||
|
mb_iseq (mbc, sc)
|
||||||
|
returns true if mbc is the standard ASCII character sc.
|
||||||
|
|
||||||
|
mb_isnul (mbc)
|
||||||
|
returns true if mbc is the nul character.
|
||||||
|
|
||||||
|
mb_cmp (mbc1, mbc2)
|
||||||
|
returns a positive, zero, or negative value depending on whether mbc1
|
||||||
|
sorts after, same or before mbc2.
|
||||||
|
|
||||||
|
mb_casecmp (mbc1, mbc2)
|
||||||
|
returns a positive, zero, or negative value depending on whether mbc1
|
||||||
|
sorts after, same or before mbc2, modulo upper/lowercase conversion.
|
||||||
|
|
||||||
|
mb_equal (mbc1, mbc2)
|
||||||
|
returns true if mbc1 and mbc2 are equal.
|
||||||
|
|
||||||
|
mb_caseequal (mbc1, mbc2)
|
||||||
|
returns true if mbc1 and mbc2 are equal modulo upper/lowercase conversion.
|
||||||
|
|
||||||
|
mb_isalnum (mbc)
|
||||||
|
returns true if mbc is alphanumeric.
|
||||||
|
|
||||||
|
mb_isalpha (mbc)
|
||||||
|
returns true if mbc is alphabetic.
|
||||||
|
|
||||||
|
mb_isascii(mbc)
|
||||||
|
returns true if mbc is plain ASCII.
|
||||||
|
|
||||||
|
mb_isblank (mbc)
|
||||||
|
returns true if mbc is a blank.
|
||||||
|
|
||||||
|
mb_iscntrl (mbc)
|
||||||
|
returns true if mbc is a control character.
|
||||||
|
|
||||||
|
mb_isdigit (mbc)
|
||||||
|
returns true if mbc is a decimal digit.
|
||||||
|
|
||||||
|
mb_isgraph (mbc)
|
||||||
|
returns true if mbc is a graphic character.
|
||||||
|
|
||||||
|
mb_islower (mbc)
|
||||||
|
returns true if mbc is lowercase.
|
||||||
|
|
||||||
|
mb_isprint (mbc)
|
||||||
|
returns true if mbc is a printable character.
|
||||||
|
|
||||||
|
mb_ispunct (mbc)
|
||||||
|
returns true if mbc is a punctuation character.
|
||||||
|
|
||||||
|
mb_isspace (mbc)
|
||||||
|
returns true if mbc is a space character.
|
||||||
|
|
||||||
|
mb_isupper (mbc)
|
||||||
|
returns true if mbc is uppercase.
|
||||||
|
|
||||||
|
mb_isxdigit (mbc)
|
||||||
|
returns true if mbc is a hexadecimal digit.
|
||||||
|
|
||||||
|
mb_width (mbc)
|
||||||
|
returns the number of columns on the output device occupied by mbc.
|
||||||
|
Always >= 0.
|
||||||
|
|
||||||
|
mb_putc (mbc, stream)
|
||||||
|
outputs mbc on stream, a byte oriented FILE stream opened for output.
|
||||||
|
|
||||||
|
mb_setascii (&mbc, sc)
|
||||||
|
assigns the standard ASCII character sc to mbc.
|
||||||
|
(Only available if the 'mbfile' module is in use.)
|
||||||
|
|
||||||
|
mb_copy (&destmbc, &srcmbc)
|
||||||
|
copies srcmbc to destmbc.
|
||||||
|
|
||||||
|
Here are the function prototypes of the macros.
|
||||||
|
|
||||||
|
extern const char * mb_ptr (const mbchar_t mbc);
|
||||||
|
extern size_t mb_len (const mbchar_t mbc);
|
||||||
|
extern bool mb_iseq (const mbchar_t mbc, char sc);
|
||||||
|
extern bool mb_isnul (const mbchar_t mbc);
|
||||||
|
extern int mb_cmp (const mbchar_t mbc1, const mbchar_t mbc2);
|
||||||
|
extern int mb_casecmp (const mbchar_t mbc1, const mbchar_t mbc2);
|
||||||
|
extern bool mb_equal (const mbchar_t mbc1, const mbchar_t mbc2);
|
||||||
|
extern bool mb_caseequal (const mbchar_t mbc1, const mbchar_t mbc2);
|
||||||
|
extern bool mb_isalnum (const mbchar_t mbc);
|
||||||
|
extern bool mb_isalpha (const mbchar_t mbc);
|
||||||
|
extern bool mb_isascii (const mbchar_t mbc);
|
||||||
|
extern bool mb_isblank (const mbchar_t mbc);
|
||||||
|
extern bool mb_iscntrl (const mbchar_t mbc);
|
||||||
|
extern bool mb_isdigit (const mbchar_t mbc);
|
||||||
|
extern bool mb_isgraph (const mbchar_t mbc);
|
||||||
|
extern bool mb_islower (const mbchar_t mbc);
|
||||||
|
extern bool mb_isprint (const mbchar_t mbc);
|
||||||
|
extern bool mb_ispunct (const mbchar_t mbc);
|
||||||
|
extern bool mb_isspace (const mbchar_t mbc);
|
||||||
|
extern bool mb_isupper (const mbchar_t mbc);
|
||||||
|
extern bool mb_isxdigit (const mbchar_t mbc);
|
||||||
|
extern int mb_width (const mbchar_t mbc);
|
||||||
|
extern void mb_putc (const mbchar_t mbc, FILE *stream);
|
||||||
|
extern void mb_setascii (mbchar_t *new, char sc);
|
||||||
|
extern void mb_copy (mbchar_t *new, const mbchar_t *old);
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _MBCHAR_H
|
||||||
|
#define _MBCHAR_H 1
|
||||||
|
|
||||||
|
/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE. */
|
||||||
|
#if !_GL_CONFIG_H_INCLUDED
|
||||||
|
#error "Please include config.h first."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <uchar.h>
|
||||||
|
|
||||||
|
_GL_INLINE_HEADER_BEGIN
|
||||||
|
#ifndef MBCHAR_INLINE
|
||||||
|
# define MBCHAR_INLINE _GL_INLINE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The longest multibyte characters, nowadays, are 4 bytes long.
|
||||||
|
Regardless of the values of MB_CUR_MAX and MB_LEN_MAX. */
|
||||||
|
#define MBCHAR_BUF_SIZE 4
|
||||||
|
|
||||||
|
struct mbchar
|
||||||
|
{
|
||||||
|
const char *ptr; /* pointer to current character */
|
||||||
|
size_t bytes; /* number of bytes of current character, > 0 */
|
||||||
|
bool wc_valid; /* true if wc is a valid 32-bit wide character */
|
||||||
|
char32_t wc; /* if wc_valid: the current character */
|
||||||
|
#if defined GNULIB_MBFILE
|
||||||
|
char buf[MBCHAR_BUF_SIZE]; /* room for the bytes, used for file input only */
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
/* EOF (not a real character) is represented with bytes = 0 and
|
||||||
|
wc_valid = false. */
|
||||||
|
|
||||||
|
typedef struct mbchar mbchar_t;
|
||||||
|
|
||||||
|
/* Access the current character. */
|
||||||
|
#define mb_ptr(mbc) ((mbc).ptr)
|
||||||
|
#define mb_len(mbc) ((mbc).bytes)
|
||||||
|
|
||||||
|
/* Comparison of characters. */
|
||||||
|
#define mb_iseq(mbc, sc) ((mbc).wc_valid && (mbc).wc == (sc))
|
||||||
|
#define mb_isnul(mbc) ((mbc).wc_valid && (mbc).wc == 0)
|
||||||
|
#define mb_cmp(mbc1, mbc2) \
|
||||||
|
((mbc1).wc_valid \
|
||||||
|
? ((mbc2).wc_valid \
|
||||||
|
? _GL_CMP ((mbc1).wc, (mbc2).wc) \
|
||||||
|
: -1) \
|
||||||
|
: ((mbc2).wc_valid \
|
||||||
|
? 1 \
|
||||||
|
: (mbc1).bytes == (mbc2).bytes \
|
||||||
|
? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \
|
||||||
|
: (mbc1).bytes < (mbc2).bytes \
|
||||||
|
? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \
|
||||||
|
: (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1)))
|
||||||
|
#define mb_casecmp(mbc1, mbc2) \
|
||||||
|
((mbc1).wc_valid \
|
||||||
|
? ((mbc2).wc_valid \
|
||||||
|
? _GL_CMP (c32tolower ((mbc1).wc), c32tolower ((mbc2).wc)) \
|
||||||
|
: -1) \
|
||||||
|
: ((mbc2).wc_valid \
|
||||||
|
? 1 \
|
||||||
|
: (mbc1).bytes == (mbc2).bytes \
|
||||||
|
? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \
|
||||||
|
: (mbc1).bytes < (mbc2).bytes \
|
||||||
|
? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \
|
||||||
|
: (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1)))
|
||||||
|
#define mb_equal(mbc1, mbc2) \
|
||||||
|
((mbc1).wc_valid && (mbc2).wc_valid \
|
||||||
|
? (mbc1).wc == (mbc2).wc \
|
||||||
|
: (mbc1).bytes == (mbc2).bytes \
|
||||||
|
&& memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0)
|
||||||
|
#define mb_caseequal(mbc1, mbc2) \
|
||||||
|
((mbc1).wc_valid && (mbc2).wc_valid \
|
||||||
|
? c32tolower ((mbc1).wc) == c32tolower ((mbc2).wc) \
|
||||||
|
: (mbc1).bytes == (mbc2).bytes \
|
||||||
|
&& memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0)
|
||||||
|
|
||||||
|
/* <ctype.h>, <wctype.h> classification. */
|
||||||
|
#define mb_isascii(mbc) \
|
||||||
|
((mbc).wc_valid && (mbc).wc >= 0 && (mbc).wc <= 127)
|
||||||
|
#define mb_isalnum(mbc) ((mbc).wc_valid && c32isalnum ((mbc).wc))
|
||||||
|
#define mb_isalpha(mbc) ((mbc).wc_valid && c32isalpha ((mbc).wc))
|
||||||
|
#define mb_isblank(mbc) ((mbc).wc_valid && c32isblank ((mbc).wc))
|
||||||
|
#define mb_iscntrl(mbc) ((mbc).wc_valid && c32iscntrl ((mbc).wc))
|
||||||
|
#define mb_isdigit(mbc) ((mbc).wc_valid && c32isdigit ((mbc).wc))
|
||||||
|
#define mb_isgraph(mbc) ((mbc).wc_valid && c32isgraph ((mbc).wc))
|
||||||
|
#define mb_islower(mbc) ((mbc).wc_valid && c32islower ((mbc).wc))
|
||||||
|
#define mb_isprint(mbc) ((mbc).wc_valid && c32isprint ((mbc).wc))
|
||||||
|
#define mb_ispunct(mbc) ((mbc).wc_valid && c32ispunct ((mbc).wc))
|
||||||
|
#define mb_isspace(mbc) ((mbc).wc_valid && c32isspace ((mbc).wc))
|
||||||
|
#define mb_isupper(mbc) ((mbc).wc_valid && c32isupper ((mbc).wc))
|
||||||
|
#define mb_isxdigit(mbc) ((mbc).wc_valid && c32isxdigit ((mbc).wc))
|
||||||
|
|
||||||
|
/* Extra <wchar.h> function. */
|
||||||
|
|
||||||
|
/* Unprintable characters appear as a small box of width 1. */
|
||||||
|
#define MB_UNPRINTABLE_WIDTH 1
|
||||||
|
|
||||||
|
MBCHAR_INLINE int
|
||||||
|
mb_width_aux (char32_t wc)
|
||||||
|
{
|
||||||
|
int w = c32width (wc);
|
||||||
|
/* For unprintable characters, arbitrarily return 0 for control characters
|
||||||
|
and MB_UNPRINTABLE_WIDTH otherwise. */
|
||||||
|
return (w >= 0 ? w : c32iscntrl (wc) ? 0 : MB_UNPRINTABLE_WIDTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define mb_width(mbc) \
|
||||||
|
((mbc).wc_valid ? mb_width_aux ((mbc).wc) : MB_UNPRINTABLE_WIDTH)
|
||||||
|
|
||||||
|
/* Output. */
|
||||||
|
#define mb_putc(mbc, stream) fwrite ((mbc).ptr, 1, (mbc).bytes, (stream))
|
||||||
|
|
||||||
|
#if defined GNULIB_MBFILE
|
||||||
|
/* Assignment. */
|
||||||
|
# define mb_setascii(mbc, sc) \
|
||||||
|
((mbc)->ptr = (mbc)->buf, (mbc)->bytes = 1, (mbc)->wc_valid = 1, \
|
||||||
|
(mbc)->wc = (mbc)->buf[0] = (sc))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Copying a character. */
|
||||||
|
MBCHAR_INLINE void
|
||||||
|
mb_copy (mbchar_t *new_mbc, const mbchar_t *old_mbc)
|
||||||
|
{
|
||||||
|
#if defined GNULIB_MBFILE
|
||||||
|
if (old_mbc->ptr == &old_mbc->buf[0])
|
||||||
|
{
|
||||||
|
memcpy (&new_mbc->buf[0], &old_mbc->buf[0], old_mbc->bytes);
|
||||||
|
new_mbc->ptr = &new_mbc->buf[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
new_mbc->ptr = old_mbc->ptr;
|
||||||
|
new_mbc->bytes = old_mbc->bytes;
|
||||||
|
if ((new_mbc->wc_valid = old_mbc->wc_valid))
|
||||||
|
new_mbc->wc = old_mbc->wc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* is_basic(c) tests whether the single-byte character c is
|
||||||
|
- in the ISO C "basic character set" or is one of '@', '$', and '`'
|
||||||
|
which ISO C 23 § 5.2.1.1.(1) guarantees to be single-byte and in
|
||||||
|
practice are safe to treat as basic in the execution character set,
|
||||||
|
or
|
||||||
|
- in the POSIX "portable character set", which
|
||||||
|
<https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap06.html>
|
||||||
|
equally guarantees to be single-byte.
|
||||||
|
This is a convenience function, and is in this file only to share code
|
||||||
|
between mbiter.h, mbuiter.h, and mbfile.h. */
|
||||||
|
#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
||||||
|
&& ('$' == 36) && ('%' == 37) && ('&' == 38) && ('\'' == 39) \
|
||||||
|
&& ('(' == 40) && (')' == 41) && ('*' == 42) && ('+' == 43) \
|
||||||
|
&& (',' == 44) && ('-' == 45) && ('.' == 46) && ('/' == 47) \
|
||||||
|
&& ('0' == 48) && ('1' == 49) && ('2' == 50) && ('3' == 51) \
|
||||||
|
&& ('4' == 52) && ('5' == 53) && ('6' == 54) && ('7' == 55) \
|
||||||
|
&& ('8' == 56) && ('9' == 57) && (':' == 58) && (';' == 59) \
|
||||||
|
&& ('<' == 60) && ('=' == 61) && ('>' == 62) && ('?' == 63) \
|
||||||
|
&& ('@' == 64) && ('A' == 65) && ('B' == 66) && ('C' == 67) \
|
||||||
|
&& ('D' == 68) && ('E' == 69) && ('F' == 70) && ('G' == 71) \
|
||||||
|
&& ('H' == 72) && ('I' == 73) && ('J' == 74) && ('K' == 75) \
|
||||||
|
&& ('L' == 76) && ('M' == 77) && ('N' == 78) && ('O' == 79) \
|
||||||
|
&& ('P' == 80) && ('Q' == 81) && ('R' == 82) && ('S' == 83) \
|
||||||
|
&& ('T' == 84) && ('U' == 85) && ('V' == 86) && ('W' == 87) \
|
||||||
|
&& ('X' == 88) && ('Y' == 89) && ('Z' == 90) && ('[' == 91) \
|
||||||
|
&& ('\\' == 92) && (']' == 93) && ('^' == 94) && ('_' == 95) \
|
||||||
|
&& ('`' == 96) && ('a' == 97) && ('b' == 98) && ('c' == 99) \
|
||||||
|
&& ('d' == 100) && ('e' == 101) && ('f' == 102) && ('g' == 103) \
|
||||||
|
&& ('h' == 104) && ('i' == 105) && ('j' == 106) && ('k' == 107) \
|
||||||
|
&& ('l' == 108) && ('m' == 109) && ('n' == 110) && ('o' == 111) \
|
||||||
|
&& ('p' == 112) && ('q' == 113) && ('r' == 114) && ('s' == 115) \
|
||||||
|
&& ('t' == 116) && ('u' == 117) && ('v' == 118) && ('w' == 119) \
|
||||||
|
&& ('x' == 120) && ('y' == 121) && ('z' == 122) && ('{' == 123) \
|
||||||
|
&& ('|' == 124) && ('}' == 125) && ('~' == 126)
|
||||||
|
/* The character set is ISO-646, not EBCDIC. */
|
||||||
|
# define IS_BASIC_ASCII 1
|
||||||
|
|
||||||
|
/* All locale encodings (see localcharset.h) map the characters 0x00..0x7F
|
||||||
|
to U+0000..U+007F, like ASCII, except for
|
||||||
|
CP864 different mapping of '%'
|
||||||
|
SHIFT_JIS different mappings of 0x5C, 0x7E
|
||||||
|
JOHAB different mapping of 0x5C
|
||||||
|
However, these characters in the range 0x20..0x7E are in the ISO C
|
||||||
|
"basic character set" and in the POSIX "portable character set", which
|
||||||
|
ISO C and POSIX guarantee to be single-byte. Thus, locales with these
|
||||||
|
encodings are not POSIX compliant. And they are most likely not in use
|
||||||
|
any more (as of 2023). */
|
||||||
|
# define is_basic(c) ((unsigned char) (c) < 0x80)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
MBCHAR_INLINE bool
|
||||||
|
is_basic (char c)
|
||||||
|
{
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case '\0':
|
||||||
|
case '\007': case '\010':
|
||||||
|
case '\t': case '\n': case '\v': case '\f': case '\r':
|
||||||
|
case ' ': case '!': case '"': case '#': case '$': case '%':
|
||||||
|
case '&': case '\'': case '(': case ')': case '*':
|
||||||
|
case '+': case ',': case '-': case '.': case '/':
|
||||||
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
|
case ':': case ';': case '<': case '=': case '>':
|
||||||
|
case '?': case '@':
|
||||||
|
case 'A': case 'B': case 'C': case 'D': case 'E':
|
||||||
|
case 'F': case 'G': case 'H': case 'I': case 'J':
|
||||||
|
case 'K': case 'L': case 'M': case 'N': case 'O':
|
||||||
|
case 'P': case 'Q': case 'R': case 'S': case 'T':
|
||||||
|
case 'U': case 'V': case 'W': case 'X': case 'Y':
|
||||||
|
case 'Z':
|
||||||
|
case '[': case '\\': case ']': case '^': case '_': case '`':
|
||||||
|
case 'a': case 'b': case 'c': case 'd': case 'e':
|
||||||
|
case 'f': case 'g': case 'h': case 'i': case 'j':
|
||||||
|
case 'k': case 'l': case 'm': case 'n': case 'o':
|
||||||
|
case 'p': case 'q': case 'r': case 's': case 't':
|
||||||
|
case 'u': case 'v': case 'w': case 'x': case 'y':
|
||||||
|
case 'z': case '{': case '|': case '}': case '~':
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_GL_INLINE_HEADER_END
|
||||||
|
|
||||||
|
#endif /* _MBCHAR_H */
|
Loading…
Add table
Reference in a new issue