]> Savannah Git Hosting - gnulib.git/log
gnulib.git
21 months agoreadutmp: fix comments
Paul Eggert [Fri, 4 Aug 2023 01:27:35 +0000 (18:27 -0700)]
readutmp: fix comments

21 months agoreadutmp: systemd supports only UTMP_FILE
Paul Eggert [Thu, 3 Aug 2023 23:01:52 +0000 (16:01 -0700)]
readutmp: systemd supports only UTMP_FILE

* lib/readutmp.c (read_utmp): Fail if not UTMP_FILE.
* m4/systemd.m4 (gl_SYSTEMD_CHOICE): Default to no for now,
since yes means "who /var/log/wtmp" stops working.

21 months agoreadutmp: switch new struct to struct timespec
Paul Eggert [Thu, 3 Aug 2023 23:01:50 +0000 (16:01 -0700)]
readutmp: switch new struct to struct timespec

* lib/readutmp.c (get_boot_time_uncached, get_boot_time)
(add_utmp, read_utmp):
Use struct timespec, not struct timeval.
* lib/readutmp.h: Always include <time.h>, for struct timespec.
Simplify when utmp.h and utmpx.h are included.
(struct gl_utmp): Use the same struct for both the
systemd and the dummy version.  Reorder members, and
use proper pid_t type for ut_session.  Rename ut_tv to ut_ts
and make it a struct timespec.  All uses changed.
(HAVE_GL_UTMP): New macro.  Use it where appropriate, instead
of READUTMP_USE_SYSTEMD.
(UT_USER, HAVE_STRUCT_XTMP_UT_EXIT, HAVE_STRUCT_XTMP_UT_ID)
(HAVE_STRUCT_XTMP_UT_PID, HAVE_STRUCT_XTMP_UT_HOST):
Simplify.
* modules/readutmp (Depends-on): Add time-h, timespec_get.
Remove sys_type.  Sort.

21 months agoreadutmp: fix # indentation
Paul Eggert [Thu, 3 Aug 2023 22:54:14 +0000 (15:54 -0700)]
readutmp: fix # indentation

* lib/readutmp.h: Change # indentation to standard Gnulib style.

21 months agoreadutmp: pacify -Wstrict-prototypes
Paul Eggert [Thu, 3 Aug 2023 22:54:12 +0000 (15:54 -0700)]
readutmp: pacify -Wstrict-prototypes

* lib/readutmp.c (get_boot_time_uncached, get_boot_time):
Pacify gcc 13 -Wstrict-prototypes.

21 months agoreadutmp: fix idx_t FIXME in API
Paul Eggert [Thu, 3 Aug 2023 22:53:30 +0000 (15:53 -0700)]
readutmp: fix idx_t FIXME in API

* lib/readutmp.c (read_utmp): 2nd arg is now idx_t *, not
size_t *.
* lib/readutmp.h: Include idx.h, for idx_t.
* modules/readutmp (Depends-on): Add idx.

21 months agoreadutmp: go back to simple ‘free’
Paul Eggert [Thu, 3 Aug 2023 22:53:27 +0000 (15:53 -0700)]
readutmp: go back to simple ‘free’

Omit the new free_utmp function.  Instead, allocate storage
in one block, so that using code can still just call ‘free’.
* lib/readutmp.c (struct utmp_alloc) [READUTMP_USE_SYSTEMD]: New type.
(add_utmp) [READUTMP_USE_SYSTEMD]: New function.
(read_utmp) [READUTMP_USE_SYSTEMD]: Use it.
Also, use malloc a bit less heavily.
(free_utmp): Remove.
* tests/test-readutmp.c (main): Call free, not free_utmp.

21 months agoreadutmp: simplify extract_trimmed_name via ximemdup0
Paul Eggert [Thu, 3 Aug 2023 22:31:48 +0000 (15:31 -0700)]
readutmp: simplify extract_trimmed_name via ximemdup0

* lib/readutmp.c (extract_trimmed_name): Simplify.
* modules/readutmp (Depends-on):
Add strnlen, which was a missing dependency.

* lib/readutmp.c: Include xmemdup0.
(extract_trimmed_name): Simplify.
* modules/readutmp (Depends-on): Add xmemdup0.
Add strnlen, which was a missing dependency already.

21 months agoalignasof, stdalign: Avoid some -Wundef warnings from config.h.
Bruno Haible [Thu, 3 Aug 2023 16:09:29 +0000 (18:09 +0200)]
alignasof, stdalign: Avoid some -Wundef warnings from config.h.

Reported by Tim Rühsen <tim.ruehsen@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-08/msg00012.html>.

* m4/stdalign.m4 (gl_ALIGNASOF): Test whether __cplusplus is defined
before evaluating it. Assume HAVE_STDALIGN_H, _GL_STDALIGN_NEEDS_STDDEF
are never defined to 0.

21 months agodoc: More platform detail.
Bruno Haible [Thu, 3 Aug 2023 14:41:16 +0000 (16:41 +0200)]
doc: More platform detail.

* doc/posix-functions/fnmatch.texi: Mention Solaris OpenIndiana here,
since it behaves differently than Solaris 11.4.

21 months agodoc: Add references to FreeBSD bugs.
Bruno Haible [Thu, 3 Aug 2023 12:21:17 +0000 (14:21 +0200)]
doc: Add references to FreeBSD bugs.

* doc/posix-functions/fnmatch.texi: Add commented reference to FreeBSD
bug.
* doc/posix-functions/wcscmp.texi: Likewise.
* doc/posix-functions/wcsncmp.texi: Likewise.

21 months agoreadutmp: In systemd mode, put the X11 display into the ut_host field.
Bruno Haible [Wed, 2 Aug 2023 18:20:24 +0000 (20:20 +0200)]
readutmp: In systemd mode, put the X11 display into the ut_host field.

* lib/readutmp.c (read_utmp): In sessions of type "x11", use the X11
display as host.

21 months agoautoupdate
Karl Berry [Wed, 2 Aug 2023 14:01:58 +0000 (07:01 -0700)]
autoupdate

21 months agoreadutmp: Small change to reduce the code size on the coreutils side.
Bruno Haible [Wed, 2 Aug 2023 09:40:35 +0000 (11:40 +0200)]
readutmp: Small change to reduce the code size on the coreutils side.

* lib/readutmp.h (UT_ID_SIZE): New constant and macro.

21 months agoreadutmp: Small changes to reduce the code size on the coreutils side.
Bruno Haible [Tue, 1 Aug 2023 22:56:25 +0000 (00:56 +0200)]
readutmp: Small changes to reduce the code size on the coreutils side.

* m4/readutmp.m4 (gl_READUTMP): Test also for the ut_host field in
'struct utmpx' and 'struct utmp'.
* lib/readutmp.h (HAVE_STRUCT_XTMP_UT_HOST): New macro.
(UT_USER_SIZE): Define also as a macro. Set to -1 if
READUTMP_USE_SYSTEMD.
(UT_LINE_SIZE, UT_HOST_SIZE): New constants and macros.

21 months agoreadutmp: For year-2038 safety on Linux/{x86,arm}, use systemd APIs.
Bruno Haible [Tue, 1 Aug 2023 19:44:07 +0000 (21:44 +0200)]
readutmp: For year-2038 safety on Linux/{x86,arm}, use systemd APIs.

Suggested by Thorsten Kukuk <kukuk@suse.com> in
<https://www.thkukuk.de/blog/Y2038_glibc_utmp_64bit/> and
<https://github.com/thkukuk/utmpx/blob/main/utmp-to-logind.md>.

* m4/systemd.m4: New file.
* m4/readutmp.m4 (gl_READUTMP): Require gl_SYSTEMD_CHOICE. Set
READUTMP_LIB. Conditionally define READUTMP_USE_SYSTEMD.
* lib/readutmp.h: For READUTMP_USE_SYSTEMD, include <sys/time.h> and
<utmpx.h>.
(struct gl_utmp): New type.
(UTMP_STRUCT_NAME, UT_TIME_MEMBER, UT_EXIT_E_TERMINATION,
UT_EXIT_E_EXIT, UT_USER, HAVE_STRUCT_XTMP_UT_EXIT,
HAVE_STRUCT_XTMP_UT_ID, HAVE_STRUCT_XTMP_UT_PID): Define differently for
READUTMP_USE_SYSTEMD.
(UT_USER_SIZE): Don't define for READUTMP_USE_SYSTEMD.
(UT_TYPE_EQ, UT_TYPE_NOT_DEFINED, READ_UTMP_SUPPORTED): Define also for
READUTMP_USE_SYSTEMD.
(free_utmp): New declaration.
* lib/readutmp.c: Add new includes for READUTMP_USE_SYSTEMD.
(extract_trimmed_name): Adapt to READUTMP_USE_SYSTEMD.
(get_boot_time_uncached, get_boot_time, guess_pty_name): New functions.
(read_utmp): New implementation for READUTMP_USE_SYSTEMD.
(free_utmp): New function.
* tests/test-readutmp.c (main): At the end, invoke free_utmp.
* modules/readutmp (Files): Add m4/systemd.m4.
(Link): New section.
* modules/readutmp-tests (Makefile.am): Link test-readutmp with
READUTMP_LIB.
* NEWS: Mention the free_utmp function and the READUTMP_LIB link
requirement.

21 months agoreadutmp: Trivial simplification.
Bruno Haible [Tue, 1 Aug 2023 10:58:20 +0000 (12:58 +0200)]
readutmp: Trivial simplification.

* lib/readutmp.c (extract_trimmed_name): Use constant UT_USER_SIZE.

21 months agoreadutmp tests: Show also the ut_line field.
Bruno Haible [Mon, 31 Jul 2023 21:13:37 +0000 (23:13 +0200)]
readutmp tests: Show also the ut_line field.

* tests/test-readutmp.c (main): Add a "Device" column to the table.
Adjust the column widths. Flush stdout before possibly calling abort().

21 months agoreadutmp: Fix test failure on OpenBSD.
Bruno Haible [Mon, 31 Jul 2023 20:12:51 +0000 (22:12 +0200)]
readutmp: Fix test failure on OpenBSD.

* lib/readutmp.c (desirable_utmp_entry): On OpenBSD, eliminate entirely
empty entries.

21 months agoreadutmp: Revisit portability.
Bruno Haible [Mon, 31 Jul 2023 18:33:48 +0000 (20:33 +0200)]
readutmp: Revisit portability.

* m4/readutmp.m4 (gl_READUTMP): Don't test for struct utmp.ut_exit.ut_*,
since no platform has these.
* lib/readutmp.h (UT_EXIT_E_TERMINATION): Don't test
HAVE_STRUCT_UTMP_UT_EXIT_UT_TERMINATION.
(UT_EXIT_E_EXIT): Don't test HAVE_STRUCT_UTMP_UT_EXIT_UT_EXIT.
* doc/posix-headers/utmpx.texi: Update platforms list. Mention
portability problems of specific 'struct utmpx' fields.
* doc/glibc-headers/utmp.texi: Update platforms list. Mention
portability problems of specific 'struct utmp' fields.

21 months agoreadutmp: Make argument names consistent.
Bruno Haible [Mon, 31 Jul 2023 14:29:46 +0000 (16:29 +0200)]
readutmp: Make argument names consistent.

* lib/readutmp.h (UT_TIME_MEMBER, UT_EXIT_E_TERMINATION, UT_EXIT_E_EXIT,
UT_USER, UT_PID, UT_TYPE_EQ, UT_TYPE_BOOT_TIME, UT_TYPE_USER_PROCESS,
IS_USER_PROCESS): Rename parameter to 'UT'.
* lib/readutmp.c (desirable_utmp_entry, read_utmp): Rename local
variable 'u' to 'ut'.

21 months agoreadutmp: Make the header file and function usable on all platforms.
Bruno Haible [Mon, 31 Jul 2023 14:13:11 +0000 (16:13 +0200)]
readutmp: Make the header file and function usable on all platforms.

* lib/readutmp.h (struct gl_utmp, UTMP_STRUCT_NAME, UT_TIME_MEMBER,
UT_EXIT_E_TERMINATION, UT_EXIT_E_EXIT, UT_USER): Provide fallback
definitions.
(READ_UTMP_SUPPORTED): New macro.
* lib/readutmp.c (read_utmp) [!READ_UTMP_SUPPORTED]: Provide a dummy
definition.
* modules/readutmp (Depends-on): Add sys_time.
(configure.ac): Remove conditional.
(Makefile.am): Compile readutmp.c on all platforms.
(Include): Include readutmp.h on all platforms.
* tests/test-readutmp.c: Include readutmp.h on all platforms.
(main): Invoke read_utmp on all platforms.

21 months agoreadutmp: Add tests.
Bruno Haible [Sun, 30 Jul 2023 13:11:08 +0000 (15:11 +0200)]
readutmp: Add tests.

* tests/test-readutmp.c: New file.
* modules/readutmp-tests: New file.

21 months agoreadutmp: Improve comments. Fix module description.
Bruno Haible [Sun, 30 Jul 2023 13:08:59 +0000 (15:08 +0200)]
readutmp: Improve comments. Fix module description.

* lib/readutmp.h (extract_trimmed_name): Add specification comment.
(read_utmp): Move specification comment from lib/readutmp.c to here.
Mention also UTMP_FILE and READ_UTMP_USER_PROCESS.
* lib/readutmp.c (extract_trimmed_name): Fix comment.
* modules/readutmp (Include): Only include the .h file if
HAVE_UTMPX_H || HAVE_UTMP_H.

21 months agoreadutmp: work around glibc utmpx bug
Paul Eggert [Sun, 30 Jul 2023 00:06:42 +0000 (17:06 -0700)]
readutmp: work around glibc utmpx bug

When compiled with _TIME_BITS=64, glibc <utmpx.h> does not work,
because the files use 32-bit time_t and the code passes this to
the user unmodified, but <utmpx.h> defines a struct with 64-bit
time_t.  Work around this compatibility bug.  Problem reported
by Jakub Wilk via Sven Joachim <https://bugs.gnu.org/64937>.
* lib/readutmp.c (copy_utmp_entry): New function.
(read_utmp): Use it.

21 months agowcsrtombs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:56:31 +0000 (00:56 +0200)]
wcsrtombs tests: Renumber tests.

* tests/test-wcsrtombs*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5.
* tests/test-wcsrtombs.c: Update.
* modules/wcsrtombs-tests: Update.

21 months agowcsnrtombs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:52:24 +0000 (00:52 +0200)]
wcsnrtombs tests: Renumber tests.

* tests/test-wcsnrtombs*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5.
* tests/test-wcsnrtombs.c: Update.
* modules/wcsnrtombs-tests: Update.

21 months agowcrtomb tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:48:14 +0000 (00:48 +0200)]
wcrtomb tests: Renumber tests.

* tests/test-wcrtomb.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-wcrtomb.c: Update.
* tests/test-wcrtomb-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8.
* tests/test-wcrtomb-w32.c: Update.
* modules/wcrtomb-tests: Update.

21 months agombstoc32s tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:41:06 +0000 (00:41 +0200)]
mbstoc32s tests: Renumber tests.

* tests/test-mbstoc32s-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbstoc32s.c: Update.

21 months agombsrtoc32s tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:38:01 +0000 (00:38 +0200)]
mbsrtoc32s tests: Renumber tests.

* tests/test-mbsrtoc32s-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbsrtoc32s.c: Update.

21 months agombsnrtoc32s tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:34:41 +0000 (00:34 +0200)]
mbsnrtoc32s tests: Renumber tests.

* tests/test-mbsnrtoc32s-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbsnrtoc32s.c: Update.

21 months agombstowcs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:29:19 +0000 (00:29 +0200)]
mbstowcs tests: Renumber tests.

* tests/test-mbstowcs*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbstowcs.c: Update.
* modules/mbstowcs-tests: Update.

21 months agombsrtowcs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:25:57 +0000 (00:25 +0200)]
mbsrtowcs tests: Renumber tests.

* tests/test-mbsrtowcs*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbsrtowcs.c: Update.
* modules/mbsrtowcs-tests: Update.

21 months agombsnrtowcs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:21:41 +0000 (00:21 +0200)]
mbsnrtowcs tests: Renumber tests.

* tests/test-mbsnrtowcs*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbsnrtowcs.c: Update.
* modules/mbsnrtowcs-tests: Update.

21 months agombrtoc16 tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:16:24 +0000 (00:16 +0200)]
mbrtoc16 tests: Renumber tests.

* tests/test-mbrtoc16-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbrtoc16.c: Update.
* tests/test-mbrtoc16-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8.
* tests/test-mbrtoc16-w32.c: Update.
* modules/mbrtoc16-tests: Update.

21 months agombrtoc32 tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:10:44 +0000 (00:10 +0200)]
mbrtoc32 tests: Renumber tests.

* tests/test-mbrtoc32-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbrtoc32.c: Update.
* tests/test-mbrtoc32-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8.
* tests/test-mbrtoc32-w32.c: Update.
* modules/mbrtoc32-tests: Update.

21 months agombrtowc tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 22:03:01 +0000 (00:03 +0200)]
mbrtowc tests: Renumber tests.

* tests/test-mbrtowc*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbrtowc.c: Update.
* tests/test-mbrtowc-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8.
* tests/test-mbrtowc-w32.c: Update.
* modules/mbrtowc-tests: Update.

21 months agombrlen tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 21:18:42 +0000 (23:18 +0200)]
mbrlen tests: Renumber tests.

* tests/test-mbrlen*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbrlen.c: Update.
* tests/test-mbrlen-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6
-> 8.
* tests/test-mbrlen-w32.c: Update.
* modules/mbrlen-tests: Update.

21 months agombmemcasecoll tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 21:04:32 +0000 (23:04 +0200)]
mbmemcasecoll tests: Renumber tests.

* tests/test-mbmemcasecoll*.sh: Renamed 1 -> 2 -> 3 -> 4.
* tests/test-mbmemcasecoll.c: Update.
* modules/mbmemcasecoll-tests: Update.

21 months agombmemcasecmp tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 21:02:01 +0000 (23:02 +0200)]
mbmemcasecmp tests: Renumber tests.

* tests/test-mbmemcasecmp*.sh: Renamed 1 -> 2 -> 3 -> 4.
* tests/test-mbmemcasecmp.c: Update.
* modules/mbmemcasecmp-tests: Update.

21 months agofnmatch tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 20:50:44 +0000 (22:50 +0200)]
fnmatch tests: Renumber tests.

* tests/test-fnmatch-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8.
* tests/test-fnmatch-w32.c: Update.
* modules/fnmatch-tests: Update.

21 months agoc32stombs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 20:42:13 +0000 (22:42 +0200)]
c32stombs tests: Renumber tests.

* tests/test-c32stombs-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5.
* tests/test-c32stombs.c: Update.
* modules/c32stombs-tests: Update.

21 months agoc32srtombs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 20:35:24 +0000 (22:35 +0200)]
c32srtombs tests: Renumber tests.

* tests/test-c32srtombs-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5.
* tests/test-c32srtombs.c: Update.
* modules/c32srtombs-tests: Update.

21 months agoc32snrtombs tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 20:13:41 +0000 (22:13 +0200)]
c32snrtombs tests: Renumber tests.

* tests/test-c32snrtombs-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5.
* tests/test-c32snrtombs.c: Update.
* modules/c32snrtombs-tests: Update.

21 months agoc32rtomb tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 20:02:54 +0000 (22:02 +0200)]
c32rtomb tests: Renumber tests.

* tests/test-c32rtomb.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-c32rtomb.c: Update.
* tests/test-c32rtomb-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8.
* tests/test-c32rtomb-w32.c: Update.
* modules/c32rtomb-tests: Update.

21 months agobtoc32 tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 19:44:56 +0000 (21:44 +0200)]
btoc32 tests: Renumber tests.

* tests/test-btoc32-*.sh: Renamed 1 -> 2 -> 3 -> 1.
* tests/test-btoc32.c: Update.

21 months agobtowc tests: Renumber tests.
Bruno Haible [Sat, 29 Jul 2023 19:39:02 +0000 (21:39 +0200)]
btowc tests: Renumber tests.

* tests/test-btowc*.sh: Renamed 1 -> 2 -> 3 -> 1.
* tests/test-btowc.c: Update.
* modules/btowc-tests: Update.

21 months agotime-h: Simplify after 2017-05-01 change.
Bruno Haible [Sat, 29 Jul 2023 16:22:50 +0000 (18:22 +0200)]
time-h: Simplify after 2017-05-01 change.

* m4/time_h.m4 (gl_TIME_H_DEFAULTS): Don't provide a default value for
GNULIB_GETTIMEOFDAY.

21 months agotime-h: Obey GNULIB_POSIXCHECK, not GNULIB_PORTCHECK.
Bruno Haible [Sat, 29 Jul 2023 16:07:45 +0000 (18:07 +0200)]
time-h: Obey GNULIB_POSIXCHECK, not GNULIB_PORTCHECK.

* lib/time.in.h (timespec_get, timespec_getres, time, nanosleep, tzset,
mktime, localtime_r, gmtime_r, localtime, strptime, ctime, strftime,
timegm): Add _GL_WARN_ON_USE invocation.
(asctime, ctime): Don't assume that these functions are declared, since
POSIX obsoletes them.
* m4/time_h.m4 (gl_TIME_H): Test for the declarations of asctime, ctime,
gmtime_r, localtime, localtime_r, mktime, nanosleep, strftime, strptime,
time, timegm, timespec_get, timespec_getres, tzset.
(gl_TIME_H_DEFAULTS): Initialize REPLACE_CTIME, REPLACE_LOCALTIME_R,
REPLACE_MKTIME, REPLACE_NANOSLEEP, REPLACE_STRFTIME, REPLACE_TIMEGM,
REPLACE_TIMESPEC_GET, REPLACE_TZSET with 0 instead of GNULIB_PORTCHECK.
* m4/ctime.m4 (gl_FUNC_CTIME): Don't re-initialize REPLACE_CTIME.
* m4/time_r.m4 (gl_TIME_R): Don't re-initialize REPLACE_LOCALTIME_R.
* m4/mktime.m4 (gl_FUNC_MKTIME): Don't re-initialize REPLACE_MKTIME.
* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Don't re-initialize
REPLACE_NANOSLEEP.
* m4/strftime-fixes.m4 (gl_FUNC_STRFTIME): Don't re-initialize
REPLACE_STRFTIME.
* m4/timegm.m4 (gl_FUNC_TIMEGM): Don't re-initialize REPLACE_TIMEGM.
* m4/timespec_get.m4 (gl_FUNC_TIMESPEC_GET): Don't re-initialize
REPLACE_TIMESPEC_GET.
* m4/tzset.m4 (gl_FUNC_TZSET: Don't re-initialize REPLACE_TZSET.

21 months agofnmatch: Ensure that on Cygwin ≥ 3.5.0, Cygwin's native fnmatch is used.
Bruno Haible [Fri, 28 Jul 2023 19:36:51 +0000 (21:36 +0200)]
fnmatch: Ensure that on Cygwin ≥ 3.5.0, Cygwin's native fnmatch is used.

Tested by Corinna Vinschen in
<https://cygwin.com/pipermail/cygwin/2023-July/254036.html>.

* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): On Cygwin, don't force
REPLACE_FNMATCH to 1 just because wchar_t is small.

21 months agoautoupdate
Karl Berry [Fri, 28 Jul 2023 15:27:29 +0000 (08:27 -0700)]
autoupdate

21 months agoposixcheck: Fix dependencies.
Bruno Haible [Fri, 28 Jul 2023 13:18:34 +0000 (15:18 +0200)]
posixcheck: Fix dependencies.

* modules/posixcheck (Depends-on): Add malloc-h, pthread-h, sched,
sys_random, threads-h, uchar, utmp.

21 months agouchar: Include the necessary snippets.
Bruno Haible [Fri, 28 Jul 2023 13:15:26 +0000 (15:15 +0200)]
uchar: Include the necessary snippets.

* lib/uchar.in.h: Add insertion points for _GL_ARG_NONNULL and
_GL_WARN_ON_USE.
* modules/uchar (Depends-on): Add snippet/arg-nonnull,
snippet/warn-on-use.
(Makefile.am): In uchar.h, include the ARG_NONNULL_H and WARN_ON_USE_H
snippets.

21 months agombmemcasecmp, mbmemcasecoll: Avoid test failure on MSVC.
Bruno Haible [Fri, 28 Jul 2023 11:56:15 +0000 (13:56 +0200)]
mbmemcasecmp, mbmemcasecoll: Avoid test failure on MSVC.

* tests/test-mbmemcasecmp.h (test_utf_8): Disable two tests on platforms
that don't have the upper/lower mappings for 'ü'/'Ü'.
* tests/test-mbmemcasecmp.c: Include <wchar.h>, <wctype.h>.
* tests/test-mbmemcasecoll.c: Likewise.
* modules/mbmemcasecmp-tests (Depends-on): Add mbrtowc, wctype-h.
* modules/mbmemcasecoll-tests (Depends-on): Likewise.

21 months agognulib-tool: Include ftruncate in testdirs.
Bruno Haible [Thu, 27 Jul 2023 21:15:09 +0000 (23:15 +0200)]
gnulib-tool: Include ftruncate in testdirs.

* gnulib-tool (func_create_testdir): Don't exclude module 'ftruncate'
from testdirs by default.
* pygnulib/GLTestDir.py (GLTestDir.execute): Likewise.

21 months agofnmatch-h, glob-h tests: Fix link errors (regression 2023-07-24).
Bruno Haible [Thu, 27 Jul 2023 20:19:08 +0000 (22:19 +0200)]
fnmatch-h, glob-h tests: Fix link errors (regression 2023-07-24).

* modules/fnmatch-h-c++-tests (Makefile.am): Link test-fnmatch-h-c++
with $(LIBUNISTRING).
* modules/glob-h-c++-tests (Makefile.am): Link test-glob-h-c++ with
$(LIBUNISTRING).

21 months agofnmatch, glob tests: Fix link errors (regression 2023-07-24).
Bruno Haible [Thu, 27 Jul 2023 18:52:36 +0000 (20:52 +0200)]
fnmatch, glob tests: Fix link errors (regression 2023-07-24).

* modules/fnmatch-tests (Makefile.am): Link test-fnmatch-w32 with the
same libraries as test-fnmatch.
* modules/glob (Link): Add $(LIBUNISTRING).
* modules/glob-tests (Makefile.am): Link test-glob with $(LIBUNISTRING).

21 months agowctrans: Work around bug on NetBSD.
Bruno Haible [Wed, 26 Jul 2023 14:32:48 +0000 (16:32 +0200)]
wctrans: Work around bug on NetBSD.

* lib/wctype.in.h (rpl_wctrans_t, wctrans_t, GNULIB_defined_wctrans_t):
Define if REPLACE_WCTRANS is 1.
(wctrans): Consider REPLACE_WCTRANS.
(towctrans): Override if REPLACE_WCTRANS is 1.
* m4/wctype_h.m4 (gl_WCTYPE_H_DEFAULTS): Initialize REPLACE_WCTRANS.
* m4/wctrans.m4 (gl_FUNC_WCTRANS): Define through AC_DEFUN_ONCE. Test
whether wctrans supports the "tolower" character mapping. Set
REPLACE_WCTRANS if not.
* m4/towctrans.m4 (gl_FUNC_TOWCTRANS): Require gl_FUNC_WCTRANS.
* modules/wctrans (Depends-on): Add towctrans.
(configure.ac): Consider REPLACE_WCTRANS.
* modules/towctrans (Files): Add m4/wctrans.m4.
(configure.ac): Override also if REPLACE_WCTRANS is 1.
* modules/wctype-h (Makefile.am): Substitute REPLACE_WCTRANS.
* doc/posix-functions/wctrans.texi: Mention the NetBSD bug.

21 months agotowctrans: Add tests.
Bruno Haible [Wed, 26 Jul 2023 13:26:21 +0000 (15:26 +0200)]
towctrans: Add tests.

* tests/test-towctrans.c: New file, based on
tests/test-c32_apply_mapping.c.
* modules/towctrans-tests: New file.

21 months agowctrans: Add tests.
Bruno Haible [Wed, 26 Jul 2023 13:25:35 +0000 (15:25 +0200)]
wctrans: Add tests.

* tests/test-wctrans.c: New file, based on tests/test-c32_get_mapping.c.
* modules/wctrans-tests: New file.

21 months agofnmatch: Update dependencies.
Bruno Haible [Wed, 26 Jul 2023 12:57:26 +0000 (14:57 +0200)]
fnmatch: Update dependencies.

* modules/fnmatch (Depends-on): Add wctype.

21 months agowctype: Work around wctype+iswctype bug on MSVC.
Bruno Haible [Wed, 26 Jul 2023 13:12:47 +0000 (15:12 +0200)]
wctype: Work around wctype+iswctype bug on MSVC.

* m4/wctype.m4 (gl_FUNC_WCTYPE): In the test program, test also for the
MSVC bug. Update cross-compilation guess.
* doc/posix-functions/wctype.texi: Mention the MSVC bug.

21 months agowctype: Work around wctype bug on mingw.
Bruno Haible [Wed, 26 Jul 2023 12:50:00 +0000 (14:50 +0200)]
wctype: Work around wctype bug on mingw.

* lib/wctype.in.h (rpl_wctype_t, wctype_t, GNULIB_defined_wctype_t):
Define if REPLACE_WCTYPE is 1.
(wctype): Consider REPLACE_WCTYPE.
(iswctype): Override also if REPLACE_WCTYPE is 1.
* lib/iswctype.c: If GNULIB_defined_wctype_t is defined, use the
function-pointer based implementation.
* m4/wctype_h.m4 (gl_WCTYPE_H_DEFAULTS): Initialize REPLACE_WCTYPE.
* m4/wctype.m4 (gl_FUNC_WCTYPE): Define through AC_DEFUN_ONCE. Test
whether wctype supports the "blank" character class. Set REPLACE_WCTYPE
if not.
* m4/iswctype.m4 (gl_FUNC_ISWCTYPE): Require gl_FUNC_WCTYPE.
* modules/wctype (Status, Notice): Remove.
(Depends-on): Add iswctype. Consider REPLACE_WCTYPE.
(configure.ac): Consider REPLACE_WCTYPE.
* modules/iswctype (Status, Notice): Remove.
(Files): Add m4/wctype.m4.
(configure.ac): Override also if REPLACE_WCTYPE is 1.
* modules/wctype-h (Makefile.am): Substitute REPLACE_WCTYPE.
* doc/posix-functions/wctype.texi: Mention the mingw bug.

21 months agowctype-h: Work around iswprint bug on mingw.
Bruno Haible [Wed, 26 Jul 2023 12:13:48 +0000 (14:13 +0200)]
wctype-h: Work around iswprint bug on mingw.

* lib/wctype.in.h (rpl_iswprint): On mingw, don't use the system's
iswprint function.
* tests/test-wctype-h.c (main): Verify that this character class
contains the ASCII space but not tab and newline.
* tests/test-c32isprint.c (main): For tab, \v, \f, expect the same value
on native Windows as on other platforms.
* doc/posix-functions/iswprint.texi: Mention the mingw bug.

21 months agoiswblank tests: Add more tests.
Bruno Haible [Wed, 26 Jul 2023 11:48:25 +0000 (13:48 +0200)]
iswblank tests: Add more tests.

* tests/test-iswblank.c (main): Verify that this character class
contains the ASCII space and tab, but not newline.

21 months agowctype, wctrans: Require a non-NULL argument.
Bruno Haible [Wed, 26 Jul 2023 11:40:06 +0000 (13:40 +0200)]
wctype, wctrans: Require a non-NULL argument.

* lib/wctype.in.h: Add placeholder for definition of _GL_ARG_NONNULL.
(wctype, wctrans): Mark with _GL_ARG_NONNULL ((1)).
* modules/wctype-h (Depends-on): Add snippet/arg-nonnull.
(Makefile.am): Substitute $(ARG_NONNULL_H) into wctype.h.

21 months agoiswctype: Add tests.
Bruno Haible [Tue, 25 Jul 2023 21:39:15 +0000 (23:39 +0200)]
iswctype: Add tests.

* tests/test-iswctype.c: New file, based on
tests/test-c32_apply_type_test.c.
* tests/test-c32_apply_type_test.c (main): Update accordingly.
* modules/iswctype-tests: New file.

21 months agowctype: Add tests.
Bruno Haible [Tue, 25 Jul 2023 21:38:03 +0000 (23:38 +0200)]
wctype: Add tests.

* tests/test-wctype.c: New file, based on
tests/test-c32_get_type_test.c.
* modules/wctype-tests: New file.

21 months agoCompile benchmark programs without assertions.
Bruno Haible [Tue, 25 Jul 2023 20:56:19 +0000 (22:56 +0200)]
Compile benchmark programs without assertions.

* modules/mbiter-bench-tests (Makefile.am): Compile bench-mbiter with
-DNDEBUG.
* modules/mbiterf-bench-tests (Makefile.am): Compile bench-mbiterf with
-DNDEBUG.
* modules/mbuiter-bench-tests (Makefile.am): Compile bench-mbuiter with
-DNDEBUG.
* modules/mbuiterf-bench-tests (Makefile.am): Compile bench-mbuiterf
with -DNDEBUG.
* modules/mbswidth-bench-tests (Makefile.am): Compile bench-mbswidth
with -DNDEBUG.
* modules/crypto/md5-buffer-tests (Makefile.am): Compile bench-md5 with
-DNDEBUG.
* modules/crypto/sha1-buffer-tests (Makefile.am): Compile bench-sha1
with -DNDEBUG.
* modules/crypto/sha256-buffer-tests (Makefile.am): Compile bench-sha224
and bench-sha256 with -DNDEBUG.
* modules/crypto/sha512-buffer-tests (Makefile.am): Compile bench-sha384
and bench-sha512 with -DNDEBUG.

21 months agounistr/u8-*: Make Unicode decoder more Unicode Standard compliant.
Bruno Haible [Tue, 25 Jul 2023 20:20:51 +0000 (22:20 +0200)]
unistr/u8-*: Make Unicode decoder more Unicode Standard compliant.

Based on a remark by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-07/msg00120.html>.

* tests/unistr/test-u8-mbtouc.c (test_safe_function): Change expected
results for "non-shortest form" or out-of-range byte sequences. Add new
test cases of incomplete well-formed byte sequences.
* tests/unistr/test-u8-mbsnlen.c (main): Likewise.
* lib/unistr/u8-mbtouc-aux.c (u8_mbtouc_aux): Reject a first byte in the
range 0xF5..0xF7 as invalid. Distinguish incomplete from invalid byte
sequences correctly. For the former, return only the number of bytes in
the maximal well-formed subpart.
* lib/unistr/u8-mbtouc.c (u8_mbtouc): Likewise.
* lib/unistr/u8-check.c (u8_check): Reject a first byte in the range
0xF5..0xF7 as invalid.
* lib/unistr/u8-mblen.c (u8_mblen): Likewise.
* lib/unistr/u8-mbtoucr.c (u8_mbtoucr): Likewise.
* lib/unistr/u8-strmbtouc.c (u8_strmbtouc): Likewise.
* lib/unistr/u8-strmblen.c (u8_strmblen): Likewise.
* lib/unistr/u8-prev.c (u8_prev): Likewise.

21 months agofnmatch: Overcome wchar_t limitations.
Bruno Haible [Mon, 24 Jul 2023 10:08:23 +0000 (12:08 +0200)]
fnmatch: Overcome wchar_t limitations.

* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Set REPLACE_FNMATCH to 1 on
AIX in 32-bit mode.
* lib/fnmatch.c: Include <uchar.h>. Conditionally include unistr.h.
(UCHAR_TO_WCHAR): Renamed from BTOWC.
(WCHAR_T, WINT_T, BTOWC, MBSRTOWCS, WCSLEN, WCSCAT, WMEMPCPY, WMEMCHR,
TOWLOWER, WCTYPE_T, WCTYPE, ISWCTYPE): New macros.
(IS_CHAR_CLASS): Use WCTYPE instead of wctype.
(UCHAR_TO_WCHAR): Use BTOWC instead of btowc.
(FOLD): Use TOWLOWER instead of towlower.
(CHAR): Use WCHAR_T instead of wchar_t.
(UCHAR, INT): Use WINT_T instead of wint_t.
(STRLEN): Use WCSLEN instead of wcslen.
(STRCAT): Use WCSCAT instead of wcscat.
(MEMPCPY): Use WMEMPCPY instead of wmempcpy.
(MEMCHR): Use WMEMCHR instead of wmemchr.
(is_char_class): Use WCTYPE_T instead of wctype_t, WCHAR_T instead of
wchar_t, WCTYPE instead of wctype.
(fnmatch): Use WCHAR_T instead of wchar_t, MBSRTOWCS instead of
mbsrtowcs.
* lib/fnmatch_loop.c (FCT): Use WCTYPE_T instead of wctype_t, ISWCTYPE
instead of iswctype. Update for renamed BTOWC.
* modules/fnmatch (Depends-on): Add btoc32, c32tolower,
c32_get_type_test, c32_apply_type_test, mbsrtoc32s, unistr/u32-chr,
unistr/u32-pcpy, unistr/u32-strcat, unistr/u32-strlen.
(Link): Add $(LIBUNISTRING).
* modules/fnmatch-tests (Makefile.am): Link test-fnmatch with
$(LIBUNISTRING).
* doc/posix-functions/fnmatch.texi: Move the Cygwin, mingw, MSVC, AIX
bug descriptions to the "fixed by Gnulib" section.

21 months agofnmatch: Update doc regarding Solaris 10.
Bruno Haible [Mon, 24 Jul 2023 09:10:15 +0000 (11:10 +0200)]
fnmatch: Update doc regarding Solaris 10.

* doc/posix-functions/fnmatch.texi: Move the Solaris 10 bug description
to the "fixed by Gnulib" section.

21 months agotimespec_get: port to Ubuntu 23.04
Paul Eggert [Mon, 24 Jul 2023 00:58:03 +0000 (17:58 -0700)]
timespec_get: port to Ubuntu 23.04

* m4/timespec_get.m4 (gl_FUNC_TIMESPEC_GET):
Default REPLACE_TIMESPEC_GET to 0, fixing a typo.

21 months agounistr/u32-strcat: Relicense under LGPLv2+.
Bruno Haible [Mon, 24 Jul 2023 00:00:42 +0000 (02:00 +0200)]
unistr/u32-strcat: Relicense under LGPLv2+.

* modules/unistr/u32-strcat (License): Change to LGPLv2+.
* lib/unistr/u32-strcat.c: Update license notice.
* lib/unistr/u-strcat.h: Likewise.

21 months agounistr/u32-strlen: Relicense under LGPLv2+.
Bruno Haible [Mon, 24 Jul 2023 00:00:37 +0000 (02:00 +0200)]
unistr/u32-strlen: Relicense under LGPLv2+.

* modules/unistr/u32-strlen (License): Change to LGPLv2+.
* lib/unistr/u32-strlen.c: Update license notice.

21 months agounistr/u32-chr: Relicense under LGPLv2+.
Bruno Haible [Mon, 24 Jul 2023 00:00:13 +0000 (02:00 +0200)]
unistr/u32-chr: Relicense under LGPLv2+.

* modules/unistr/u32-chr (License): Change to LGPLv2+.
* lib/unistr/u32-chr.c: Update license notice.

21 months agoutimecmp: clean up old spare1 cruft
Paul Eggert [Sun, 23 Jul 2023 18:35:10 +0000 (11:35 -0700)]
utimecmp: clean up old spare1 cruft

* lib/utimecmp.c: Remove a ‘defined HAVE_STRUCT_STAT_ST_SPARE1’
that has been false since 2007.

21 months agofnmatch tests: Avoid a test failure on FreeBSD.
Bruno Haible [Sun, 23 Jul 2023 14:49:22 +0000 (16:49 +0200)]
fnmatch tests: Avoid a test failure on FreeBSD.

* tests/test-fnmatch.c (main): In a GB18030 locale, test the towupper()
mapping of 'ö', not of 'ü'.

21 months agofnmatch: Work around bugs on FreeBSD, NetBSD, Solaris, Cygwin, Android.
Bruno Haible [Sun, 23 Jul 2023 13:26:28 +0000 (15:26 +0200)]
fnmatch: Work around bugs on FreeBSD, NetBSD, Solaris, Cygwin, Android.

* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Add three more test cases to
the test program. Reorganize its return values.
* tests/test-fnmatch.c (main): Reflect the changes done in fnmatch.m4.
* doc/posix-functions/fnmatch.texi: Move the corresponding bug
descriptions to the "fixed by Gnulib" section.

21 months agofnmatch, fnmatch-gnu: Document known bugs.
Bruno Haible [Sun, 23 Jul 2023 12:04:59 +0000 (14:04 +0200)]
fnmatch, fnmatch-gnu: Document known bugs.

* doc/posix-headers/fnmatch.texi: Mention the macros FNM_LEADING_DIR,
FNM_CASEFOLD, FNM_EXTMATCH, FNM_FILE_NAME.
* doc/posix-functions/fnmatch.texi: Reference the glibc documentation
and the Linux man page. Document the effects of the two modules and all
the known bugs in detail.

21 months agofnmatch tests: Add many more test cases.
Bruno Haible [Sat, 22 Jul 2023 23:43:43 +0000 (01:43 +0200)]
fnmatch tests: Add many more test cases.

* lib/fnmatch.in.h (GNULIB_defined_fnmatch_function): New macro.
* tests/test-fnmatch.c: Add many more test cases.
* tests/test-fnmatch-1.sh: New file, based on tests/test-mbrtoc32-5.sh.
* tests/test-fnmatch-2.sh: New file, based on tests/test-mbrtoc32-1.sh.
* tests/test-fnmatch-3.sh: New file, based on tests/test-mbrtoc32-2.sh.
* tests/test-fnmatch-4.sh: New file, based on tests/test-mbrtoc32-3.sh.
* tests/test-fnmatch-5.sh: New file, based on tests/test-mbrtoc32-4.sh.
* tests/test-fnmatch-w32.c: New file, based on tests/test-mbrtoc32-w32.c
and tests/test-fnmatch.c.
* tests/test-fnmatch-w32-1.sh: New file, based on
tests/test-mbrtoc32-w32-1.sh.
* tests/test-fnmatch-w32-2.sh: New file, based on
tests/test-mbrtoc32-w32-2.sh.
* tests/test-fnmatch-w32-3.sh: New file, based on
tests/test-mbrtoc32-w32-3.sh.
* tests/test-fnmatch-w32-4.sh: New file, based on
tests/test-mbrtoc32-w32-4.sh.
* tests/test-fnmatch-w32-5.sh: New file, based on
tests/test-mbrtoc32-w32-5.sh.
* tests/test-fnmatch-w32-6.sh: New file, based on
tests/test-mbrtoc32-w32-6.sh.
* tests/test-fnmatch-w32-7.sh: New file, based on
tests/test-mbrtoc32-w32-7.sh.
* modules/fnmatch-tests: Add the new program and shell scripts.

21 months agodoc: Mention a wctype bug.
Bruno Haible [Sat, 22 Jul 2023 22:32:47 +0000 (00:32 +0200)]
doc: Mention a wctype bug.

* doc/posix-functions/wctype.texi: Mention a bug on mingw.

21 months agoautoupdate
Karl Berry [Fri, 21 Jul 2023 14:43:18 +0000 (07:43 -0700)]
autoupdate

21 months agounistr/u8-pcpy, unistr/u16-pcpy, unistr/u32-pcpy: Add tests.
Bruno Haible [Fri, 21 Jul 2023 09:22:27 +0000 (11:22 +0200)]
unistr/u8-pcpy, unistr/u16-pcpy, unistr/u32-pcpy: Add tests.

* tests/unistr/test-pcpy.h: New file, based on tests/unistr/test-cpy.h.
* tests/unistr/test-u8-pcpy.c: New file, based on
tests/unistr/test-u8-cpy.c.
* tests/unistr/test-u16-pcpy.c: New file, based on
tests/unistr/test-u16-cpy.c.
* tests/unistr/test-u32-pcpy.c: New file, based on
tests/unistr/test-u32-cpy.c.
* modules/unistr/u8-pcpy-tests: New file, based on
modules/unistr/u8-cpy-tests.
* modules/unistr/u16-pcpy-tests: New file, based on
modules/unistr/u16-cpy-tests.
* modules/unistr/u32-pcpy-tests: New file, based on
modules/unistr/u32-cpy-tests.

21 months agounistr/u8-pcpy, unistr/u16-pcpy, unistr/u32-pcpy: New modules.
Bruno Haible [Fri, 21 Jul 2023 09:16:04 +0000 (11:16 +0200)]
unistr/u8-pcpy, unistr/u16-pcpy, unistr/u32-pcpy: New modules.

* lib/unistr.in.h (u8_pcpy, u16_pcpy, u32_pcpy): New declarations.
* lib/unistr/u-pcpy.h: New file, based on lib/wmempcpy.c.
* lib/unistr/u8-pcpy.c: New file, based on lib/unistr/u8-cpy.c.
* lib/unistr/u16-pcpy.c: New file, based on lib/unistr/u16-cpy.c.
* lib/unistr/u32-pcpy.c: New file, based on lib/unistr/u32-cpy.c.
* modules/unistr/u8-pcpy: New file, based on modules/unistr/u8-cpy.
* modules/unistr/u16-pcpy: New file, based on modules/unistr/u16-cpy.
* modules/unistr/u32-pcpy: New file, based on modules/unistr/u32-cpy.

21 months agoerror-h: Fix dependencies.
Bruno Haible [Thu, 20 Jul 2023 14:33:31 +0000 (16:33 +0200)]
error-h: Fix dependencies.

Reported by <cbh34680@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-07/msg00111.html>.

* modules/error-h (Depends-on): Add include_next.

21 months agofts: fix compilation errors with fts_cross_check()
Pádraig Brady [Thu, 20 Jul 2023 14:08:27 +0000 (15:08 +0100)]
fts: fix compilation errors with fts_cross_check()

* lib/fts.c: Fix printf format chars.
* lib/fts_.h: Provide a declaration for users.

21 months agoDocument migration path for obsolescent functions.
Bruno Haible [Wed, 19 Jul 2023 23:35:10 +0000 (01:35 +0200)]
Document migration path for obsolescent functions.

* doc/glibc-functions/timespec_get.texi: Add reference to ISO C.
* doc/posix-functions/_tolower.texi: Recommend use of tolower.
* doc/posix-functions/_toupper.texi: Recommend use of toupper.
* doc/posix-functions/asctime.texi: Recommend use of strftime.
* doc/posix-functions/asctime_r.texi: Likewise.
* doc/posix-functions/ctime.texi: Recommend use of localtime_r and
strftime.
* doc/posix-functions/ctime_r.texi: Likewise.
* doc/posix-functions/ftw.texi: Recommend use of fts.
* doc/posix-functions/getitimer.texi: Recommend use of timer_gettime.
* doc/posix-functions/gets.texi: Recommend use of fgets.
* doc/posix-functions/gettimeofday.texi: Recommend use of gettime or
timespec_get.
* doc/posix-functions/inet_addr.texi: Recommend use of inet_pton.
* doc/posix-functions/inet_ntoa.texi: Recommend use of inet_ntop.
* doc/posix-functions/pthread_getconcurrency.texi: Recommend no-op.
* doc/posix-functions/pthread_setconcurrency.texi: Recommend no-op.
* doc/posix-functions/rand_r.texi: Recommend use of random_r.
* doc/posix-functions/setitimer.texi: Recommend use of timer_create and
timer_settime.
* doc/posix-functions/setpgrp.texi: Recommend use of setpgid or setsid.
* doc/posix-functions/sighold.texi: Recommend use of sigprocmask.
* doc/posix-functions/sigignore.texi: Recommend use of sigaction.
* doc/posix-functions/siginterrupt.texi: Recommend use of sigaction.
* doc/posix-functions/sigpause.texi: Recommend use of sigsuspend.
* doc/posix-functions/sigrelse.texi: Recommend use of sigprocmask.
* doc/posix-functions/sigset.texi: Recommend use of sigaction.
* doc/posix-functions/tempnam.texi: Recommend use of mkstemp.
* doc/posix-functions/ulimit.texi: Recommend use of getrlimit and
setrlimit.
* doc/posix-functions/utime.texi: Recommend use of utimens.

21 months agoDocument POSIX obsolescence
Paul Eggert [Wed, 19 Jul 2023 20:51:55 +0000 (13:51 -0700)]
Document POSIX obsolescence

* doc/posix-functions/_longjmp.texi, doc/posix-functions/_setjmp.texi:
* doc/posix-functions/_tolower.texi, doc/posix-functions/_toupper.texi:
* doc/posix-functions/asctime.texi, doc/posix-functions/asctime_r.texi:
* doc/posix-functions/ctime.texi, doc/posix-functions/ctime_r.texi:
* doc/posix-functions/encrypt.texi, doc/posix-functions/ftw.texi:
* doc/posix-functions/getitimer.texi, doc/posix-functions/gets.texi:
* doc/posix-functions/gettimeofday.texi:
* doc/posix-functions/inet_addr.texi:
* doc/posix-functions/inet_ntoa.texi, doc/posix-functions/isascii.texi:
* doc/posix-functions/pthread_getconcurrency.texi:
* doc/posix-functions/pthread_setconcurrency.texi:
* doc/posix-functions/rand_r.texi, doc/posix-functions/setitimer.texi:
* doc/posix-functions/setkey.texi, doc/posix-functions/setpgrp.texi:
* doc/posix-functions/sighold.texi, doc/posix-functions/sigignore.texi:
* doc/posix-functions/siginterrupt.texi:
* doc/posix-functions/sigpause.texi, doc/posix-functions/sigrelse.texi:
* doc/posix-functions/sigset.texi, doc/posix-functions/tempnam.texi:
* doc/posix-functions/toascii.texi, doc/posix-functions/ulimit.texi:
* doc/posix-functions/utime.texi:
Update as per draft 3 of POSIX 10003.1-202x.

21 months agoDon’t worry about Version 7 tolower
Paul Eggert [Wed, 19 Jul 2023 20:51:55 +0000 (13:51 -0700)]
Don’t worry about Version 7 tolower

Some code ported back to pre-C89 libraries where tolower (C) had
undefined behavior if C is not an upper case character.
Nowadays that function is _tolower which is itself obsolete,
and much Gnulib code already assumes this part of C89 anyway.
Assume C89 or better tolower, which simplifies the code
and should improve performance slightly.
* lib/mbmemcasecmp.c, lib/mbmemcasecoll.c, lib/mbscasecmp.c:
* lib/mbscasestr.c, lib/mbsncasecmp.c, lib/mbspcasecmp.c:
* lib/strcasecmp.c, lib/strcasestr.c, lib/strncasecmp.c:
(TOLOWER): Remove.  All uses replaced by tolower.

21 months agoc32swidth, mbszero: Fix file list.
Bruno Haible [Wed, 19 Jul 2023 20:43:50 +0000 (22:43 +0200)]
c32swidth, mbszero: Fix file list.

* modules/c32swidth (Files): Add locale-ja.m4, locale-zh.m4, codeset.m4.
* modules/mbszero (Files): Likewise.

21 months agowcsnrtombs: Fix file list.
Bruno Haible [Wed, 19 Jul 2023 20:25:30 +0000 (22:25 +0200)]
wcsnrtombs: Fix file list.

* modules/wcsnrtombs (Files): Add locale-fr.m4.

21 months agombsnrtowcs: Fix file list.
Bruno Haible [Wed, 19 Jul 2023 20:24:27 +0000 (22:24 +0200)]
mbsnrtowcs: Fix file list.

* modules/mbsnrtowcs (Files): Add locale-fr.m4, codeset.m4.

21 months agombrtoc16: Fix file list.
Bruno Haible [Wed, 19 Jul 2023 20:23:23 +0000 (22:23 +0200)]
mbrtoc16: Fix file list.

* modules/mbrtoc16 (Files): Add locale-zh.m4.

21 months agombrlen: Fix file list.
Bruno Haible [Wed, 19 Jul 2023 20:21:47 +0000 (22:21 +0200)]
mbrlen: Fix file list.

* modules/mbrlen (Files): Add locale-fr.m4, locale-ja.m4, locale-zh.m4,
codeset.m4.

21 months agombiterf, mbuiterf: port to strict C17
Paul Eggert [Wed, 19 Jul 2023 03:33:41 +0000 (20:33 -0700)]
mbiterf, mbuiterf: port to strict C17

I ran into this problem on NetBSD 9.3.
* lib/mbiterf.h (mbiterf_next) [!GNULIB_MBRTOC32_REGULAR]:
* lib/mbuiterf.h (mbuiterf_next) [!GNULIB_MBRTOC32_REGULAR]:
Don’t label a declaration.

21 months agombiter, mbiterf, mbuiter, mbuiterf: Force inlining with clang.
Bruno Haible [Tue, 18 Jul 2023 12:10:33 +0000 (14:10 +0200)]
mbiter, mbiterf, mbuiter, mbuiterf: Force inlining with clang.

* lib/mbiter.h (MBITER_INLINE): Use _GL_ATTRIBUTE_ALWAYS_INLINE.
* lib/mbiterf.h (MBITERF_INLINE): Likewise.
* lib/mbuiter.h (MBUITER_INLINE): Likewise.
* lib/mbuiterf.h (MBUITERF_INLINE): Likewise.

21 months agombsspn: Optimize.
Bruno Haible [Tue, 18 Jul 2023 11:46:29 +0000 (13:46 +0200)]
mbsspn: Optimize.

* lib/mbsspn.c: Include mbuiterf.h instead of mbuiter.h.
(mbsspn): Use mbuif_* macros instead of mbui_* macros.
* modules/mbsspn (Depends-on): Add mbuiterf. Remove mbuiter.

21 months agombscspn: Optimize.
Bruno Haible [Tue, 18 Jul 2023 11:44:39 +0000 (13:44 +0200)]
mbscspn: Optimize.

* lib/mbscspn.c: Include mbuiterf.h instead of mbuiter.h.
(mbscspn): Use mbuif_* macros instead of mbui_* macros.
* modules/mbscspn (Depends-on): Add mbuiterf. Remove mbuiter.

21 months agombspbrk: Optimize.
Bruno Haible [Tue, 18 Jul 2023 11:43:38 +0000 (13:43 +0200)]
mbspbrk: Optimize.

* lib/mbspbrk.c: Include mbuiterf.h instead of mbuiter.h.
(mbspbrk): Use mbuif_* macros instead of mbui_* macros.
* modules/mbspbrk (Depends-on): Add mbuiterf. Remove mbuiter.