Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libHX for openSUSE:Factory checked in at 2025-10-13 15:34:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libHX (Old) and /work/SRC/openSUSE:Factory/.libHX.new.18484 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libHX" Mon Oct 13 15:34:04 2025 rev:84 rq:1310716 version:5.1 Changes: -------- --- /work/SRC/openSUSE:Factory/libHX/libHX.changes 2025-09-11 14:40:02.173561850 +0200 +++ /work/SRC/openSUSE:Factory/.libHX.new.18484/libHX.changes 2025-10-13 15:34:06.610138083 +0200 @@ -1,0 +2,25 @@ +Sat Oct 11 11:47:36 UTC 2025 - Jan Engelhardt <[email protected]> + +- Update to release 5.1 + * getopt6: ``HXTYPE_STRP`` can now be used for HXoption::type + for argument assignment without incurring strdup. + * map: resolve corruption of HXmap::items field. + +------------------------------------------------------------------- +Tue Sep 30 20:34:42 UTC 2025 - Jan Engelhardt <[email protected]> + +- Update to release 5.0 + * getopt6: new function set ``HX_getopt6`` which allows for + parsing options with an iterative style. + * getopt6: the result set no longer forces strdup-ed results on + the user. + * Deleted functions ``HX_getopt``, ``HX_getopt5`` (use + ``HX_getopt6`` instead), ``HX_strnlen`` (use ``strnlen`` + instead), ``HX_strsep`` (use ``strtok_r`` instead), + ``HX_stpltrim`` (no replacement). + * The struct members ``HXclist::items``, ``HXdeque::items``, + ``HXmap::items`` have changed from ``unsigned int`` to + ``size_t``. The function ``HXdeque_to_vec`` has accordingly + changed the result parameter type. + +------------------------------------------------------------------- Old: ---- libHX-4.28.tar.asc libHX-4.28.tar.zst New: ---- libHX-5.1.tar.asc libHX-5.1.tar.zst ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libHX.spec ++++++ --- /var/tmp/diff_new_pack.gVsm76/_old 2025-10-13 15:34:07.390170893 +0200 +++ /var/tmp/diff_new_pack.gVsm76/_new 2025-10-13 15:34:07.394171061 +0200 @@ -1,7 +1,7 @@ # # spec file for package libHX # -# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2025 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,8 +17,8 @@ Name: libHX -%define lname libHX32 -Version: 4.28 +%define lname libHX43 +Version: 5.1 Release: 0 Summary: Collection of routines for C and C++ programming License: LGPL-2.1-or-later @@ -66,11 +66,11 @@ %build mkdir obj -pushd obj/ +cd obj/ %define _configure ../configure %configure --includedir="%_includedir/%name" --docdir="%_docdir/%name" %make_build -popd +cd - %install b="%buildroot" @@ -86,7 +86,7 @@ %ldconfig_scriptlets -n %lname %files -n %lname -%_libdir/libHX*.so.32* +%_libdir/libHX*.so.43* %files devel %_docdir/%name/ ++++++ _scmsync.obsinfo ++++++ --- /var/tmp/diff_new_pack.gVsm76/_old 2025-10-13 15:34:07.430172576 +0200 +++ /var/tmp/diff_new_pack.gVsm76/_new 2025-10-13 15:34:07.434172744 +0200 @@ -1,4 +1,4 @@ -mtime: 1757525495 -commit: 7af814b73bea7894015b953d801b9af89971785be09c0f76686de674de16d20b +mtime: 1760184076 +commit: f92a1ddda772f3a0c1d0abc135958e32234f1b3ee5f7cd975d7df147aca2b073 url: https://src.opensuse.org/jengelh/libHX ++++++ build.specials.obscpio ++++++ ++++++ build.specials.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.gitignore new/.gitignore --- old/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/.gitignore 2025-10-11 14:01:32.000000000 +0200 @@ -0,0 +1 @@ +.osc ++++++ libHX-4.28.tar.zst -> libHX-5.1.tar.zst ++++++ ++++ 1810 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/configure.ac new/libHX-5.1/configure.ac --- old/libHX-4.28/configure.ac 2025-09-10 14:35:43.671408638 +0200 +++ new/libHX-5.1/configure.ac 2025-10-11 12:27:30.027323850 +0200 @@ -1,4 +1,4 @@ -AC_INIT([libHX], [4.28]) +AC_INIT([libHX], [5.1]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/doc/api.rst new/libHX-5.1/doc/api.rst --- old/libHX-4.28/doc/api.rst 2025-09-10 14:17:58.357281221 +0200 +++ new/libHX-5.1/doc/api.rst 2025-09-30 20:33:59.669895723 +0200 @@ -9,7 +9,7 @@ ====== ====== ====== ======================================== RMV MinVer FirstA Name ====== ====== ====== ======================================== -4.28 4.28 4.28 HXdeque_to_vecx +5.0 5.0 4.28 HXdeque_to_vecx 4.28 4.28 4.28 HX_getopt6 4.28 4.28 4.28 HX_getopt6_clean 4.28 inline 4.28 HXOPT_CONST_INPUT @@ -26,7 +26,6 @@ 4.25 inline 4.25 le{16,32,64}p_to_cpu be{16,32,64}p_to_cpu 4.25 4.25 4.25 HXSIZEOF_UNITSEC64 4.24 4.24 4.24 HX_getcwd -4.19 4.18 4.18 HX_getopt5 4.16 4.16 4.16 HX_strtoull_nsec 4.15 4.15 4.15 HX_flpr 4.15 4.15 4.15 HX_flprf @@ -44,7 +43,6 @@ 4.2 4.2 4.2 HX_unit_size_cu 4.2 4.2 4.2 HX_strtod_unit 4.2 4.2 4.2 HX_strtoull_unit -3.27 3.27 3.27 HXOPT_KEEP_ARGV 3.27 3.27 3.27 HXproc_top_fd 3.27 3.27 3.27 HXproc_switch_user 3.27 3.27 3.27 HXPROC_SU_SUCCESS @@ -58,10 +56,7 @@ 3.27 3.27 3.27 HX_slurp_file 3.25 3.25 3.25 HX_split_fixed 3.25 3.25 3.25 HX_split_inplace -3.22 3.22 3.22 HXQUOTE_SQLBQUOTE 3.21 3.21 3.21 xml_getnsprop -3.19 3.19 3.19 HXQUOTE_SQLSQUOTE -3.18 3.18 3.18 HX_stpltrim 3.17 3.17 3.17 HX_LONGLONG_FMT 3.17 3.17 3.17 HX_SIZET_FMT 3.16 3.16 3.16 container_of @@ -84,7 +79,6 @@ 3.13 3.13 3.13 HX_timeval_sub 3.12 3.12 1.10.0 HX_mkdir 3.12 3.12 3.12 HX_strndup -3.12 3.12 3.12 HX_strnlen 3.12 3.0 3.0 HXMAP_CDATA 3.12 3.0 3.0 HXMAP_CKEY 3.12 3.0 3.0 HXMAP_SCDATA @@ -225,7 +219,7 @@ 1.28 1.28 1.28 HXTYPE_UINT32 1.28 1.28 1.28 HXTYPE_UINT64 1.28 1.28 1.28 HXTYPE_UINT8 -1.26 1.26 1.26 HX_hexdump +1.26 5.0 1.26 HX_hexdump 1.26 1.26 1.26 HX_time_compare 1.25 1.25 1.25 HX_getl 1.25 1.25 1.25 HXmc_free @@ -275,7 +269,6 @@ 1.10.0 1.10.0 1.10.0 HXOPT_AND 1.10.0 1.10.0 1.10.0 HXOPT_AUTOHELP 1.10.0 1.10.0 1.10.0 HXOPT_DEC -1.10.0 1.10.0 1.10.0 HXOPT_DESTROY_OLD 1.10.0 1.10.0 1.10.0 HXOPT_ERR_MIS 1.10.0 1.10.0 1.10.0 HXOPT_ERR_UNKN 1.10.0 1.10.0 1.10.0 HXOPT_ERR_VOID @@ -315,13 +308,10 @@ 1.10.0 1.10.0 1.10.0 HX_dlerror 1.10.0 1.10.0 1.10.0 HX_dlopen 1.10.0 1.10.0 1.10.0 HX_dlsym -1.10.0 1.10.0 1.10.0 HX_dlsym<> -1.10.0 1.10.0 1.10.0 HX_getopt 1.10.0 1.10.0 1.10.0 HX_getopt_help 1.10.0 1.10.0 1.10.0 HX_getopt_usage 1.10.0 1.10.0 1.10.0 HX_irand 1.10.0 1.10.0 1.10.0 HX_memdup -1.10.0 1.10.0 1.10.0 HX_memdup<> 1.10.0 1.10.0 1.10.0 HX_rand 1.10.0 1.10.0 1.10.0 HX_rrmdir 1.10.0 1.10.0 1.10.0 HX_shconfig_free @@ -337,7 +327,6 @@ 1.10.0 1.10.0 1.10.0 HX_strrcspn 1.10.0 1.10.0 1.10.0 HX_strrev 1.10.0 1.10.0 1.10.0 HX_strrtrim -1.10.0 1.10.0 1.10.0 HX_strsep 1.10.0 1.10.0 1.10.0 HX_strsep2 1.10.0 1.10.0 1.10.0 HX_strupper 1.10.0 1.10.0 1.10.0 HX_zvecfree @@ -350,8 +339,7 @@ 1.10.0 1.10.0 1.10.0 HXdeque_pop 1.10.0 1.10.0 1.10.0 HXdeque_push 1.10.0 1.10.0 1.10.0 HXdeque_shift -1.10.0 1.10.0 1.10.0 HXdeque_to_vec -1.10.0 1.10.0 1.10.0 HXdeque_to_vec<> +5.0 5.0 1.10.0 HXdeque_to_vec 1.10.0 1.10.0 1.10.0 HXdeque_unshift 1.10.0 1.10.0 1.10.0 SHCONF_ONE ====== ====== ====== ======================================== @@ -363,6 +351,7 @@ ====== ====== ================================================ MinVer FirstA ====== ====== ================================================ +4.28 4.28 struct HXopt6_result 2.0 2.0 struct HXdeque_node.sptr 1.10.0 1.10.0 struct HXdeque_node 1.10.0 1.10.0 struct HXdeque diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/doc/changelog.rst new/libHX-5.1/doc/changelog.rst --- old/libHX-4.28/doc/changelog.rst 2025-09-10 14:35:43.677408617 +0200 +++ new/libHX-5.1/doc/changelog.rst 2025-10-11 12:27:19.979351337 +0200 @@ -1,3 +1,36 @@ +v5.1 (2025-10-11) +================= + +Enhancements: + +* getopt6: ``HXTYPE_STRP`` can now be used for HXoption::type. This will + perform assignment without strdup. +* io: handle undocumented return code from FreeBSD/OpenBSD mkdir("/") + +Fixes: + +* map: resolve corruption of HXmap::items field + + +v5.0 (2025-10-01) +================= + +Enhancements: + +* getopt6: new function set ``HX_getopt6`` which allows for parsing options + with an iterative style. +* getopt6: the result set no longer forces strdup-ed results on the user. + +Changes: + +* Deleted functions ``HX_getopt``, ``HX_getopt5`` (use ``HX_getopt6`` instead), + ``HX_strnlen`` (use ``strnlen`` instead), ``HX_strsep`` (use ``strtok_r`` + instead), ``HX_stpltrim`` (no replacement). +* The struct members ``HXclist::items``, ``HXdeque::items``, ``HXmap::items`` + have changed from ``unsigned int`` to ``size_t``. The function + ``HXdeque_to_vec`` has accordingly changed the result parameter type. + + v4.28 (2025-09-10) ================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/doc/misc_functions.rst new/libHX-5.1/doc/misc_functions.rst --- old/libHX-4.28/doc/misc_functions.rst 2025-09-10 14:11:31.721296268 +0200 +++ new/libHX-5.1/doc/misc_functions.rst 2025-09-18 14:46:49.088074793 +0200 @@ -36,7 +36,7 @@ .. code-block:: c #include <libHX/io.h> - void HX_hexdump(FILE *fp, const void *ptr, unsigned int len); + void HX_hexdump(FILE *fp, const void *ptr, size_t len); ``HX_hexdump`` Outputs a nice pretty-printed hex and ASCII dump to the filedescriptor diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/doc/option_parsing.rst new/libHX-5.1/doc/option_parsing.rst --- old/libHX-4.28/doc/option_parsing.rst 2025-09-10 00:27:16.509025810 +0200 +++ new/libHX-5.1/doc/option_parsing.rst 2025-10-10 23:03:26.262890877 +0200 @@ -115,6 +115,11 @@ allocation so that subsequently modifying the original argument string in any way will not falsely propagate. +``HXTYPE_STRP`` + The argument string pointer is stored in ``*(char **)ptr``. + No allocation occurs, but you are responsible for ensuring lifetime + adherence. + ``HXTYPE_STRDQ`` The argument string is duplicated to a new memory region and the resulting pointer is added to the given HXdeque. Note that you often diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/doc/string_ops.rst new/libHX-5.1/doc/string_ops.rst --- old/libHX-4.28/doc/string_ops.rst 2025-09-10 14:11:31.721296268 +0200 +++ new/libHX-5.1/doc/string_ops.rst 2025-09-30 20:33:59.669895723 +0200 @@ -102,7 +102,6 @@ char *HX_chomp(char *s); size_t HX_strltrim(char *s); - char *HX_stpltrim(const char *s); char *HX_strlower(char *s); char *HX_strrev(char *s); size_t HX_strrtrim(char *s); @@ -117,9 +116,6 @@ on the left edge of the string. Returns the number of characters that were stripped. -``HX_stpltrim`` - Returns a pointer to the first non-whitespace character in ``s``. - ``HX_strlower`` Transforms all characters in the string ``s`` into lowercase using ``tolower``(3). Returns the original argument. @@ -184,18 +180,6 @@ ``HXQUOTE_URIENC`` Escapes the string so that it becomes a valid part for an URI. -``HXQUOTE_SQLSQUOTE`` - Escapes all single quotes in the string by double single-quotes, as - required for using it in a single-quoted SQL string. No surrounding - quotes will be generated to facilitate concatenating of HX_strquote - results. - -``HXQUOTE_SQLBQUOTE`` - Escape all backticks in the string by double backticks, as required for - using it in a backtick-quoted SQL string (used for table names and - columns). No surrounding ticks will be generated to facilitate - concatenation. - .. _RFC 4514: http://tools.ietf.org/html/rfc4514 .. _RFC 4515: http://tools.ietf.org/html/rfc4515 .. _RFC 4648: http://tools.ietf.org/html/rfc4648 @@ -246,7 +230,6 @@ char **HX_split(const char *s, const char *delimiters, size_t *fields, int max); char **HX_split_inplace(char *s, const char *delimiters, int *fields, int max); int HX_split_fixed(char *s, const char *delimiters, int max, char **arr); - char *HX_strsep(char **sp, const char *delimiters); char *HX_strsep2(char **sp, const char *dstr); ``HX_split`` @@ -277,20 +260,15 @@ .. [#fixfoot] An implementation may however decide to put ``NULL`` in the unassigned fields, but this is implementation-dependent. -``HX_strsep`` - Extract tokens from a string. This implementation of strsep has been - added since the function is non-standard (according to the manpage, - conforms to BSD4.4 only) and may not be available on every operating - system. This function extracts tokens, separated by one of the - characters in ``delimiters``. The string is modified in-place and thus - must be mutable. The delimiters in the string are then overwritten with - ``'\0'``, ``*sp`` is advanced to the character after the delimiter, and - the original pointer is returned. After the final token, ``HX_strsep`` - will return ``NULL``. - ``HX_strsep2`` - Like ``HX_strsep``, but ``dstr`` is not an array of delimiting - characters, but an entire substring that acts as one delimiter. + strsep is a string tokenization function from BSD4.4; the POSIX + replacement is + + strsep(&string, delim) <=> + strtok_r(nullptr, delim, &string). + + Whereas strsep/strtok would split on any character in ``delim``, + our strsep2 splits only on the entire ``delim`` string. Size-bounded string operations @@ -303,7 +281,6 @@ char *HX_strlcat(char *dest, const char *src, size_t length); char *HX_strlcpy(char *dest, const char *src, size_t length); char *HX_strlncat(char *dest, const char *src, size_t dlen, size_t slen); - size_t HX_strnlen(const char *src, size_t max); ``HX_strlcat`` and ``HX_strlcpy`` provide implementations of the BSD-originating ``strlcat``(3) and ``strlcpy``(3) functions. ``strlcat`` and @@ -312,10 +289,6 @@ of just the length that is to be written. The functions guarantee that the buffer is ``'\0'``-terminated. -``HX_strnlen`` will return the length of the input string or the upper bound -given by ``max``, whichever is less. It will not attempt to access more than -this many bytes in the input buffer. - Allocation-related ================== @@ -562,21 +535,3 @@ callme(line); HX_zvecfree(field); } - -Using HX_strsep ---------------- - -``HX_strsep`` provides for thread- and reentrant-safe tokenizing a string where -strtok from the C standard would otherwise fail. - -.. code-block:: c - - #include <stdio.h> - #include <libHX/string.h> - - char line[] = "root:x:0:0:root:/root:/bin/bash"; - char *wp, *p; - - wp = line; - while ((p = HX_strsep(&wp, ":")) != NULL) - printf("%s\n", p) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/include/libHX/deque.h new/libHX-5.1/include/libHX/deque.h --- old/libHX-4.28/include/libHX/deque.h 2025-09-10 14:11:31.722296266 +0200 +++ new/libHX-5.1/include/libHX/deque.h 2025-09-18 14:46:49.084074801 +0200 @@ -25,7 +25,7 @@ struct HXdeque_node *first; void *ptr; struct HXdeque_node *last; - unsigned int items; + size_t items; }; extern struct HXdeque *HXdeque_init(void); @@ -39,7 +39,7 @@ extern void *HXdeque_del(struct HXdeque_node *); extern void HXdeque_free(struct HXdeque *); extern void HXdeque_genocide2(struct HXdeque *, void (*)(void *)); -extern void **HXdeque_to_vec(const struct HXdeque *, unsigned int *); +extern void **HXdeque_to_vec(const struct HXdeque *, size_t *); extern void **HXdeque_to_vecx(const struct HXdeque *, size_t *); static __inline__ void HXdeque_genocide(struct HXdeque *dq) @@ -49,39 +49,6 @@ #ifdef __cplusplus } /* extern "C" */ - -extern "C++" { - -template<typename type> static __inline__ type HXdeque_pop(struct HXdeque *dq) -{ - return reinterpret_cast<type>(HXdeque_pop(dq)); -} - -template<typename type> static __inline__ type -HXdeque_shift(struct HXdeque *dq) -{ - return reinterpret_cast<type>(HXdeque_shift(dq)); -} - -template<typename type> static __inline__ type -HXdeque_get(struct HXdeque *dq, const void *ptr) -{ - return reinterpret_cast<type>(HXdeque_get(dq, ptr)); -} - -template<typename type> static __inline__ type -HXdeque_del(struct HXdeque_node *nd) -{ - return reinterpret_cast<type>(HXdeque_del(nd)); -} - -template<typename type> static __inline__ type * -HXdeque_to_vec(struct HXdeque *dq, unsigned int *n) -{ - return reinterpret_cast<type *>(HXdeque_to_vec(dq, n)); -} - -} /* extern "C++" */ #endif #endif /* _LIBHX_DEQUE_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/include/libHX/io.h new/libHX-5.1/include/libHX/io.h --- old/libHX-4.28/include/libHX/io.h 2025-09-10 14:11:31.722296266 +0200 +++ new/libHX-5.1/include/libHX/io.h 2025-09-18 14:46:49.089074791 +0200 @@ -45,7 +45,7 @@ extern ssize_t HXio_fullwrite(int, const void *, size_t); #ifndef HX_HEXDUMP_DECLARATION #define HX_HEXDUMP_DECLARATION 1 -extern void HX_hexdump(FILE *, const void *, unsigned int); +extern void HX_hexdump(FILE *, const void *, size_t); #endif #ifdef __cplusplus diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/include/libHX/list.h new/libHX-5.1/include/libHX/list.h --- old/libHX-4.28/include/libHX/list.h 2025-09-10 14:11:31.722296266 +0200 +++ new/libHX-5.1/include/libHX/list.h 2025-09-18 14:46:49.084074801 +0200 @@ -104,7 +104,7 @@ struct HXlist_head *next, *prev; }; }; - unsigned int items; + size_t items; }; #define HXCLIST_HEAD_INIT(name) {{{&(name).list, &(name).list}}, 0} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/include/libHX/map.h new/libHX-5.1/include/libHX/map.h --- old/libHX-4.28/include/libHX/map.h 2025-09-10 14:11:31.722296266 +0200 +++ new/libHX-5.1/include/libHX/map.h 2025-10-11 01:14:12.204878337 +0200 @@ -73,7 +73,9 @@ * @flags: flags for this map */ struct HXmap { - unsigned int items, flags; + size_t items; + unsigned int flags; + /* extended by HXmap_private, check it too */ }; struct HXmap_ops { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/include/libHX/misc.h new/libHX-5.1/include/libHX/misc.h --- old/libHX-4.28/include/libHX/misc.h 2025-09-10 14:11:31.722296266 +0200 +++ new/libHX-5.1/include/libHX/misc.h 2025-09-18 14:46:49.089074791 +0200 @@ -63,7 +63,7 @@ extern double HX_flpr(double, double); #ifndef HX_HEXDUMP_DECLARATION #define HX_HEXDUMP_DECLARATION 1 -extern void HX_hexdump(FILE *, const void *, unsigned int); +extern void HX_hexdump(FILE *, const void *, size_t); #endif extern bool HX_timespec_isneg(const struct timespec *); extern struct timespec *HX_timespec_neg(struct timespec *, @@ -104,16 +104,6 @@ #ifdef __cplusplus } /* extern "C" */ - -extern "C++" { - -template<typename type> static __inline__ type -HX_dlsym(void *handle, const char *symbol) -{ - return reinterpret_cast<type>(HX_dlsym(handle, symbol)); -} - -} /* extern "C++" */ #endif #endif /* _LIBHX_MISC_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/include/libHX/option.h new/libHX-5.1/include/libHX/option.h --- old/libHX-4.28/include/libHX/option.h 2025-09-10 14:11:31.723296263 +0200 +++ new/libHX-5.1/include/libHX/option.h 2025-10-07 18:38:43.357105072 +0200 @@ -28,12 +28,9 @@ extern void HXformat_free(struct HXformat_map *); extern int HXformat_add(struct HXformat_map *, const char *, const void *, unsigned int); -#define HXformat_aprintf(a, b, c) HXformat3_aprintf((a), (b), (c)) -#define HXformat_fprintf(a, b, c) HXformat3_fprintf((a), (b), (c)) -#define HXformat_sprintf(a, b, c, d) HXformat3_sprintf((a), (b), (c), (d)) -extern ssize_t HXformat3_aprintf(const struct HXformat_map *, hxmc_t **, const char *); -extern ssize_t HXformat3_fprintf(const struct HXformat_map *, FILE *, const char *); -extern ssize_t HXformat3_sprintf(const struct HXformat_map *, char *, size_t, const char *); +extern ssize_t HXformat_aprintf(const struct HXformat_map *, hxmc_t **, const char *); +extern ssize_t HXformat_fprintf(const struct HXformat_map *, FILE *, const char *); +extern ssize_t HXformat_sprintf(const struct HXformat_map *, char *, size_t, const char *); /* * OPT.C @@ -60,7 +57,7 @@ * %HXTYPE_FLOAT: [fo] (float *) Read a floating point number * %HXTYPE_DOUBLE: [fo] (double *) Read a floating point number * %HXTYPE_STRING: [fo] (char **) Any string. - * %HXTYPE_STRP: [f-] (const char *const *) A string. + * %HXTYPE_STRP: [fo] (const char *const *) A string. * %HXTYPE_STRDQ: [-o] (struct HXdeque *) A string. * %HXTYPE_UINT8: [-o] (uint8_t *) An integer. * %HXTYPE_UINT16: [-o] (uint8_t *) An integer. @@ -136,15 +133,12 @@ /** * Flags to HX_getopt. - * %HXOPT_PTHRU: pass-through unknown options to new argv (obsolete) - * %HXOPT_DESTROY_OLD: destroy old argv after parsing is successful * %HXOPT_QUIET: do not output any warnings to stderr * %HXOPT_HELPONERR: print out help when a parsing error occurs * %HXOPT_USAGEONERR: print out short usage when a parsing error occurs * %HXOPT_RQ_ORDER: Options and non-options must not be mixed (first * non-option stops parsing) and the environment variable * POSIXLY_CORRECT is ignored. - * %HXOPT_KEEP_ARGV: do not replace argc/argv at all * %HXOPT_ANY_ORDER: Options and non-options may be mixed and the * environment variable POSIXLY_CORRECT is ignored. * %HXOPT_CONST_INPUT: User declaration that elements in input argv can NOT @@ -154,13 +148,10 @@ * %HXOPT_DUP_ARGS: (HX_getopt6 only) Populate result.dup_argv. */ enum { - HXOPT_PTHRU = 0x1U, - HXOPT_DESTROY_OLD = 0x2U, HXOPT_QUIET = 0x4U, HXOPT_HELPONERR = 0x8U, HXOPT_USAGEONERR = 0x10U, HXOPT_RQ_ORDER = 0x20U, - HXOPT_KEEP_ARGV = 0x40U, HXOPT_ANY_ORDER = 0x80U, HXOPT_CONST_INPUT = 0x100U, HXOPT_ITER_OPTS = 0x200U, @@ -265,15 +256,8 @@ char **dup_argv; }; -#ifndef LIBHX_ZVECFREE_DECLARATION -#define LIBHX_ZVECFREE_DECLARATION -extern void HX_zvecfree(char **); -#endif -extern int HX_getopt(const struct HXoption *, int *, char ***, unsigned int); -extern int HX_getopt5(const struct HXoption *, char **argv, int *nargc, char ***nargv, unsigned int flags); extern int HX_getopt6(const struct HXoption *, int, char **argv, struct HXopt6_result *, unsigned int flags); extern void HX_getopt6_clean(struct HXopt6_result *); -#define HX_getopt(a, b, c, d) HX_getopt((a), (b), const_cast3(char ***, (c)), (d)) extern void HX_getopt_help(const struct HXoptcb *, FILE *); extern void HX_getopt_help_cb(const struct HXoptcb *); extern void HX_getopt_usage(const struct HXoptcb *, FILE *); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/include/libHX/string.h new/libHX-5.1/include/libHX/string.h --- old/libHX-4.28/include/libHX/string.h 2025-09-10 14:11:31.723296263 +0200 +++ new/libHX-5.1/include/libHX/string.h 2025-09-30 20:33:59.669895723 +0200 @@ -26,8 +26,6 @@ HXQUOTE_LDAPRDN, HXQUOTE_BASE64, HXQUOTE_URIENC, - HXQUOTE_SQLSQUOTE, - HXQUOTE_SQLBQUOTE, HXQUOTE_BASE64URL, HXQUOTE_BASE64IMAP, _HXQUOTE_MAX, @@ -91,15 +89,12 @@ extern char *HX_strlncat(char *, const char *, size_t, size_t); extern char *HX_strlower(char *); extern size_t HX_strltrim(char *); -extern char *HX_stpltrim(const char *); extern char *HX_strmid(const char *, long, long); extern char *HX_strndup(const char *, size_t); -extern size_t HX_strnlen(const char *, size_t); extern char *HX_strquote(const char *, unsigned int, char **); extern size_t HX_strrcspn(const char *, const char *); extern char *HX_strrev(char *); extern size_t HX_strrtrim(char *); -extern char *HX_strsep(char **, const char *); extern char *HX_strsep2(char **, const char *); extern char *HX_strupper(char *); extern double HX_strtod_unit(const char *, char **, unsigned int exponent); @@ -123,16 +118,4 @@ } /* extern "C" */ #endif -#ifdef __cplusplus -extern "C++" { - -template<typename type> static __inline__ type -HX_memdup(const void *data, size_t n) -{ - return reinterpret_cast<type>(HX_memdup(data, n)); -} - -} /* extern "C++" */ -#endif - #endif /* _LIBHX_STRING_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/Makefile.am new/libHX-5.1/src/Makefile.am --- old/libHX-4.28/src/Makefile.am 2025-09-10 14:11:31.724296260 +0200 +++ new/libHX-5.1/src/Makefile.am 2025-10-11 01:15:16.433140970 +0200 @@ -9,7 +9,7 @@ mc.c misc.c opt.c proc.c \ rand.c socket.c string.c time.c libHX_la_LIBADD = ${libdl_LIBS} -lm ${libpthread_LIBS} ${librt_LIBS} ${libsocket_LIBS} -libHX_la_LDFLAGS = -no-undefined -version-info 41:0:9 +libHX_la_LDFLAGS = -no-undefined -version-info 43:0:0 if WITH_LDSYM libHX_la_LDFLAGS += -Wl,--version-script=${srcdir}/libHX.map endif @@ -60,7 +60,7 @@ check_PROGRAMS += tx-compile tx-cast tx-deque tx-dir \ tx-intdiff tx-list tx-list2 \ tx-misc tx-netio \ - tx-option tx-proc tx-rand tx-strchr2 tx-string \ + tx-proc tx-rand tx-strchr2 tx-string \ tx-strquote tx-time TESTS += tx-strchr2 tx-strquote tx_cast_SOURCES = tx-cast.cpp @@ -80,8 +80,6 @@ tx_misc_LDADD = libHX.la tx_netio_SOURCES = tx-netio.cpp tx_netio_LDADD = libHX.la ${libsocket_LIBS} -tx_option_SOURCES = tx-option.cpp -tx_option_LDADD = libHX.la tx_proc_SOURCES = tx-proc.cpp tx_proc_LDADD = libHX.la tx_rand_SOURCES = tx-rand.cpp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/deque.c new/libHX-5.1/src/deque.c --- old/libHX-4.28/src/deque.c 2025-09-10 14:18:45.299068063 +0200 +++ new/libHX-5.1/src/deque.c 2025-09-18 14:46:49.084074801 +0200 @@ -186,13 +186,9 @@ } EXPORT_SYMBOL void ** -HXdeque_to_vec(const struct HXdeque *dq, unsigned int *num) +HXdeque_to_vec(const struct HXdeque *dq, size_t *num) { - size_t nelem = 0; - void **ret = HXdeque_to_veci(dq, &nelem, true); - if (num != nullptr) - *num = nelem < UINT_MAX ? nelem : UINT_MAX; - return ret; + return HXdeque_to_veci(dq, num, true); } EXPORT_SYMBOL void ** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/format.c new/libHX-5.1/src/format.c --- old/libHX-4.28/src/format.c 2025-09-10 14:11:31.725296258 +0200 +++ new/libHX-5.1/src/format.c 2025-10-11 13:44:46.708171735 +0200 @@ -20,9 +20,6 @@ #undef HXformat_aprintf #undef HXformat_fprintf #undef HXformat_sprintf -extern int HXformat_aprintf(const struct HXformat_map *, hxmc_t **, const char *); -extern int HXformat_sprintf(const struct HXformat_map *, char *, size_t, const char *); -extern int HXformat_fprintf(const struct HXformat_map *, FILE *, const char *); /* To make it easier on the highlighter */ #define C_OPEN '(' @@ -380,7 +377,7 @@ hxmc_t *ret, *ret2, **argv; struct HXdeque *dq; const char *s, *delim; - int err = 0; + ssize_t err = 0; dq = HXdeque_init(); if (dq == NULL) @@ -563,13 +560,13 @@ /* Closing parenthesis - variable */ const struct fmt_entry *entry; hxmc_t *new_name = NULL; - int eret; + ssize_t eret; *pptr = ++s; eret = HXformat_aprintf(blk, &new_name, name); if (eret <= 0) { ret = NULL; - } else if (*new_name == '\0') { + } else if (new_name == nullptr || *new_name == '\0') { ret = &HXformat2_nexp; } else { entry = HXmap_get(blk->vars, new_name); @@ -630,14 +627,7 @@ return NULL; } -EXPORT_SYMBOL int HXformat_aprintf(const struct HXformat_map *blk, - hxmc_t **resultp, const char *fmt) -{ - ssize_t ret = HXformat3_aprintf(blk, resultp, fmt); - return ret > INT_MAX ? INT_MAX : ret; -} - -EXPORT_SYMBOL ssize_t HXformat3_aprintf(const struct HXformat_map *blk, +EXPORT_SYMBOL ssize_t HXformat_aprintf(const struct HXformat_map *blk, hxmc_t **resultp, const char *fmt) { hxmc_t *ex, *ts, *out; @@ -686,20 +676,13 @@ return ret; } -EXPORT_SYMBOL int HXformat_fprintf(const struct HXformat_map *ftable, - FILE *filp, const char *fmt) -{ - ssize_t ret = HXformat3_fprintf(ftable, filp, fmt); - return ret > INT_MAX ? INT_MAX : ret; -} - -EXPORT_SYMBOL ssize_t HXformat3_fprintf(const struct HXformat_map *ftable, +EXPORT_SYMBOL ssize_t HXformat_fprintf(const struct HXformat_map *ftable, FILE *filp, const char *fmt) { hxmc_t *str; ssize_t ret; - if ((ret = HXformat3_aprintf(ftable, &str, fmt)) <= 0) + if ((ret = HXformat_aprintf(ftable, &str, fmt)) <= 0) return ret; errno = 0; if (fputs(str, filp) < 0) @@ -708,14 +691,7 @@ return ret; } -EXPORT_SYMBOL int HXformat_sprintf(const struct HXformat_map *ftable, - char *dest, size_t size, const char *fmt) -{ - ssize_t ret = HXformat3_sprintf(ftable, dest, size, fmt); - return ret > INT_MAX ? INT_MAX : ret; -} - -EXPORT_SYMBOL ssize_t HXformat3_sprintf(const struct HXformat_map *ftable, +EXPORT_SYMBOL ssize_t HXformat_sprintf(const struct HXformat_map *ftable, char *dest, size_t size, const char *fmt) { hxmc_t *str = nullptr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/io.c new/libHX-5.1/src/io.c --- old/libHX-4.28/src/io.c 2025-09-10 00:27:16.521025780 +0200 +++ new/libHX-5.1/src/io.c 2025-10-02 18:01:31.948043352 +0200 @@ -65,8 +65,14 @@ if (mkdir(d, mode) == 0) /* use umask() for permissions */ #endif return 1; +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) + /* Undocumented extra error codes */ + if (errno != EEXIST && errno != EISDIR) + return -errno; +#else if (errno != EEXIST) return -errno; +#endif if (stat(d, &sb) == 0) { #if defined(_WIN32) if (sb.st_mode & S_IFDIR) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/libHX.map new/libHX-5.1/src/libHX.map --- old/libHX-4.28/src/libHX.map 2025-09-10 14:11:31.725296258 +0200 +++ new/libHX-5.1/src/libHX.map 2025-10-11 01:15:17.424089845 +0200 @@ -1,4 +1,4 @@ -LIBHX_3.25 { +LIBHX_5.0 { global: HX_basename; HX_basename_exact; @@ -15,7 +15,6 @@ HX_ffs; HX_fls; HX_getl; - HX_getopt; HX_getopt_help; HX_getopt_help_cb; HX_getopt_usage; @@ -36,7 +35,6 @@ HX_split; HX_split_fixed; HX_split_inplace; - HX_stpltrim; HX_strbchr; HX_strchr2; HX_strclone; @@ -54,7 +52,6 @@ HX_strrev; HX_strrtrim; HX_strsep2; - HX_strsep; HX_strupper; HX_time_compare; HX_timespec_add; @@ -123,76 +120,35 @@ HXproc_run_async; HXproc_run_sync; HXproc_wait; -local: - *; -}; - -LIBHX_3.27 { -global: HX_socket_from_env; HX_slurp_fd; HX_slurp_file; HXproc_switch_user; HXproc_top_fd; -} LIBHX_3.25; - -LIBHX_4.2 { -global: HX_strtod_unit; HX_strtoull_unit; HX_unit_size; HX_unit_size_cu; -} LIBHX_3.27; - -LIBHX_4.3 { -global: HX_sendfile; HX_unit_seconds; HX_strtoull_sec; -} LIBHX_4.2; - -LIBHX_4.9 { -global: - HXformat3_aprintf; - HXformat3_fprintf; - HXformat3_sprintf; + HXformat_aprintf; + HXformat_fprintf; + HXformat_sprintf; HX_ipaddr_is_local; HX_sockaddr_is_local; -} LIBHX_4.3; - -LIBHX_4.11 { -global: HX_addrport_split; HX_inet_connect; HX_inet_listen; HX_local_listen; -} LIBHX_4.9; - -LIBHX_4.15 { -global: HX_flpr; HX_flprf; -} LIBHX_4.11; - -LIBHX_4.16 { -global: HX_strtoull_nsec; -} LIBHX_4.15; - -LIBHX_4.18 { -global: - HX_getopt5; -} LIBHX_4.16; - -LIBHX_4.24 { -global: HX_getcwd; -} LIBHX_4.18; - -LIBHX_4.28 { -global: HX_strtoull8601p_sec; HX_getopt6; HX_getopt6_clean; HXdeque_to_vecx; -} LIBHX_4.24; +local: + *; +}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/map_int.h new/libHX-5.1/src/map_int.h --- old/libHX-4.28/src/map_int.h 2018-09-10 12:33:12.872989626 +0200 +++ new/libHX-5.1/src/map_int.h 2025-10-11 01:12:56.605087247 +0200 @@ -14,7 +14,8 @@ */ struct HXmap_private { /* from struct HXmap */ - unsigned int items, flags; + size_t items; + unsigned int flags; /* private: */ enum HXmap_type type; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/misc.c new/libHX-5.1/src/misc.c --- old/libHX-4.28/src/misc.c 2025-09-10 14:11:31.725296258 +0200 +++ new/libHX-5.1/src/misc.c 2025-09-18 14:46:49.089074791 +0200 @@ -51,24 +51,24 @@ fprintf(fp, "."); } -EXPORT_SYMBOL void HX_hexdump(FILE *fp, const void *vptr, unsigned int len) +EXPORT_SYMBOL void HX_hexdump(FILE *fp, const void *vptr, size_t len) { const unsigned char *ptr = vptr; - unsigned int i, j; + size_t i; bool tty = isatty(fileno(fp)); - fprintf(fp, "Dumping %u bytes\n", len); + fprintf(fp, "Dumping %zu bytes\n", len); for (i = 0; i < len / 16; ++i) { - fprintf(fp, "%04x | ", i * 16); - for (j = 0; j < 16; ++j) + fprintf(fp, "%04zx | ", i * 16); + for (unsigned int j = 0; j < 16; ++j) fprintf(fp, "%02x%c", *ptr++, (j == 7) ? '-' : ' '); ptr -= 16; fprintf(fp, "| "); - for (j = 0; j < 16; ++j) + for (unsigned int j = 0; j < 16; ++j) hexdump_ascii(fp, *ptr++, tty); fprintf(fp, "\n"); } - fprintf(fp, "%04x | ", i * 16); + fprintf(fp, "%04zx | ", i * 16); len -= i * 16; for (i = 0; i < len; ++i) fprintf(fp, "%02x%c", ptr[i], (i == 7) ? '-' : ' '); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/opt.c new/libHX-5.1/src/opt.c --- old/libHX-4.28/src/opt.c 2025-09-10 14:11:31.725296258 +0200 +++ new/libHX-5.1/src/opt.c 2025-10-07 18:39:07.426894306 +0200 @@ -221,6 +221,10 @@ if (opt->ptr != NULL) *static_cast(char **, opt->ptr) = HX_strdup(cbi->data); break; + case HXTYPE_STRP: + if (opt->ptr != nullptr) + *static_cast(const char **, opt->ptr) = cbi->data; + break; case HXTYPE_STRDQ: HXdeque_push(opt->ptr, HX_strdup(cbi->data)); break; @@ -686,8 +690,6 @@ if ((flags & (HXOPT_RQ_ORDER | HXOPT_ANY_ORDER)) == (HXOPT_RQ_ORDER | HXOPT_ANY_ORDER)) return -EINVAL; - if (flags & (HXOPT_PTHRU | HXOPT_KEEP_ARGV | HXOPT_DESTROY_OLD)) - return -EINVAL; if (result == nullptr && flags & (HXOPT_ITER_OPTS | HXOPT_ITER_ARGS | HXOPT_DUP_ARGS)) return -EINVAL; if (result != nullptr) @@ -752,14 +754,14 @@ } if (flags & HXOPT_ITER_OPTS) { - unsigned int nelem = 0; + size_t nelem = 0; result->desc = reinterpret_cast(const struct HXoption **, HXdeque_to_vec(ps.desc, &nelem)); result->oarg = reinterpret_cast(char **, HXdeque_to_vec(ps.oarg, &nelem)); if (result->desc == nullptr || result->oarg == nullptr) { ret = -errno; goto out; } - result->nopts = nelem; + result->nopts = nelem < INT_MAX ? nelem : INT_MAX; } if (flags & HXOPT_ITER_ARGS) { size_t nelem = 0; @@ -807,48 +809,6 @@ return ret; } -EXPORT_SYMBOL int HX_getopt5(const struct HXoption *table, char **orig_argv, - int *new_argc, char ***new_argv, unsigned int flags) -{ - struct HXopt6_result result; - if (new_argv != nullptr) - flags |= HXOPT_DUP_ARGS; - else - flags &= ~HXOPT_DUP_ARGS; - int ret = HX_getopt6(table, -1, orig_argv, &result, - flags | HXOPT_CONST_INPUT); - if (ret != 0) - return ret; - if (new_argc != nullptr) - *new_argc = result.dup_argc; - if (new_argv != nullptr) { - *new_argv = result.dup_argv; - result.dup_argv = nullptr; - } - HX_getopt6_clean(&result); - return ret; -} - -EXPORT_SYMBOL int HX_getopt(const struct HXoption *table, int *argc, - char ***argv, unsigned int flags) -{ - int new_argc = 0; - char **new_argv = nullptr; - int ret = HX_getopt5(table, *argv, &new_argc, - flags & HXOPT_KEEP_ARGV ? nullptr : &new_argv, flags & ~(HXOPT_KEEP_ARGV | HXOPT_DESTROY_OLD)); - if (ret != HXOPT_ERR_SUCCESS) - return ret; - if (flags & HXOPT_KEEP_ARGV) - // NO_CREATE_NEW / DESTROY_NEW - new_argv = *argv; - else if (flags & HXOPT_DESTROY_OLD) - HX_zvecfree(*argv); - if (argc != nullptr) - *argc = new_argc; - *argv = new_argv; - return ret; -} - EXPORT_SYMBOL void HX_getopt_help(const struct HXoptcb *cbi, FILE *nfp) { FILE *fp = (nfp == NULL) ? stderr : nfp; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/string.c new/libHX-5.1/src/string.c --- old/libHX-4.28/src/string.c 2025-09-10 14:11:34.903287712 +0200 +++ new/libHX-5.1/src/string.c 2025-09-30 20:33:59.669895723 +0200 @@ -237,13 +237,11 @@ ret[*cp] = NULL; { - char *seg, *wp = HX_strdup(str), *bg = wp; + char *wp = HX_strdup(str), *bg = wp; size_t i = 0; - while (--max > 0) { - seg = HX_strsep(&wp, delim); - ret[i++] = HX_strdup(seg); - } + while (--max > 0) + ret[i++] = HX_strdup(strtok_r(nullptr, delim, &wp)); ret[i++] = HX_strdup(wp); free(bg); @@ -394,13 +392,6 @@ return diff; } -EXPORT_SYMBOL char *HX_stpltrim(const char *p) -{ - while (HX_isspace(*p)) - ++p; - return const_cast1(char *, p); -} - /** * Helper for substr() function for dealing with negative off/len values * @z: total length of string @@ -462,14 +453,6 @@ return ret; } -EXPORT_SYMBOL size_t HX_strnlen(const char *src, size_t size) -{ - const char *ptr = src; - for (; *ptr != '\0' && size > 0; --size, ++ptr) - ; - return ptr - src; -} - EXPORT_SYMBOL size_t HX_strrcspn(const char *s, const char *rej) { size_t n = strlen(s); @@ -503,35 +486,6 @@ return s; } -EXPORT_SYMBOL char *HX_strsep(char **sp, const char *d) -{ - char *begin, *end; - - if (*sp == NULL || **sp == '\0') - return NULL; - begin = *sp; - - if (d[0] == '\0' || d[1] == '\0') { - if (*begin == *d) - end = begin; - else if (*begin == '\0') - end = NULL; - else - end = strchr(begin + 1, *d); - } else { - end = strpbrk(begin, d); - } - - if (end == NULL) { - *sp = NULL; - } else { - *end++ = '\0'; - *sp = end; - } - - return begin; -} - EXPORT_SYMBOL char *HX_strsep2(char **wp, const char *str) { char *ptr, *ret; @@ -554,8 +508,6 @@ [HXQUOTE_LDAPFLT] = {HXQUOTE_REJECT, "\n*()\\"}, [HXQUOTE_LDAPRDN] = {HXQUOTE_REJECT, "\n \"#+,;<=>\\"}, [HXQUOTE_URIENC] = {HXQUOTE_ACCEPT, "-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~"}, - [HXQUOTE_SQLSQUOTE] = {HXQUOTE_REJECT, "'"}, - [HXQUOTE_SQLBQUOTE] = {HXQUOTE_REJECT, "`"}, }; /** @@ -625,30 +577,6 @@ return ret; } -static char * -HX_quote_sqlbackslash(char *dest, const char *src, const char *trm) -{ - char *ret = dest; - size_t len; - - while (*src != '\0') { - len = strcspn(src, trm); - if (len > 0) { - memcpy(dest, src, len); - dest += len; - src += len; - if (*src == '\0') - break; - } - *dest++ = *trm; - *dest++ = *trm; - ++src; - } - - *dest = '\0'; - return ret; -} - /** * Encode @src into BASE-64 according to RFC 4648 and write result to @dest, * which must be of appropriate size, plus one for a trailing NUL. @@ -802,8 +730,6 @@ switch (type) { case HXQUOTE_SQUOTE: case HXQUOTE_DQUOTE: - case HXQUOTE_SQLSQUOTE: - case HXQUOTE_SQLBQUOTE: return HX_qsize_bsr(s, HX_quote_rules[type].chars, 1); case HXQUOTE_HTML: return HX_qsize_html(s); @@ -882,9 +808,6 @@ return HX_quote_base64(*free_me, src, '+', ','); case HXQUOTE_URIENC: return HX_quote_urlenc(*free_me, src); - case HXQUOTE_SQLSQUOTE: - case HXQUOTE_SQLBQUOTE: - return HX_quote_sqlbackslash(*free_me, src, rule->chars); } return NULL; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/tc-list.c new/libHX-5.1/src/tc-list.c --- old/libHX-4.28/src/tc-list.c 2025-09-10 14:11:31.726296255 +0200 +++ new/libHX-5.1/src/tc-list.c 2025-09-18 14:46:49.085074799 +0200 @@ -81,7 +81,7 @@ #endif } - printf("Remaining elements: %u\n", strings_ct.items); + printf("Remaining elements: %zu\n", strings_ct.items); } static void l_empty(void) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/tc-map.c new/libHX-5.1/src/tc-map.c --- old/libHX-4.28/src/tc-map.c 2023-11-01 14:00:02.611625171 +0100 +++ new/libHX-5.1/src/tc-map.c 2025-10-02 09:58:34.142248888 +0200 @@ -107,7 +107,7 @@ const struct HXmap_node *node; struct HXmap_trav *iter; - tmap_printf("Flushing %u elements (with traversal)\n", map->items); + tmap_printf("Flushing %zu elements (with traversal)\n", map->items); tmap_ipush(); while (map->items != 0) { /* May need to reload traverser due to deletion */ @@ -141,7 +141,7 @@ tmap_time(&stop); HX_timespec_sub(&delta, &stop, &start); } while (!(delta.tv_sec >= 1 || map->items >= 1000000)); - tmap_printf("%u elements in " HX_TIMESPEC_FMT + tmap_printf("%zu elements in " HX_TIMESPEC_FMT " (plus time measurement overhead)\n", map->items, HX_TIMESPEC_EXP(&delta)); threshold = map->items; @@ -151,7 +151,7 @@ tmap_add_rand(map, threshold); tmap_time(&stop); HX_timespec_sub(&delta, &stop, &start); - tmap_printf("%u elements in " HX_TIMESPEC_FMT " (w/o overhead)\n", + tmap_printf("%zu elements in " HX_TIMESPEC_FMT " (w/o overhead)\n", map->items, HX_TIMESPEC_EXP(&delta)); tmap_ipop(); } @@ -176,14 +176,14 @@ tmap_time(&stop); HX_timespec_sub(&delta, &stop, &start); HXmap_travfree(iter); - tmap_printf("Open traversal of %u nodes: " HX_TIMESPEC_FMT "s\n", + tmap_printf("Open traversal of %zu nodes: " HX_TIMESPEC_FMT "s\n", map->items, HX_TIMESPEC_EXP(&delta)); tmap_time(&start); HXmap_qfe(map, tmap_each_fn, NULL); tmap_time(&stop); HX_timespec_sub(&delta, &stop, &start); - tmap_printf("QFE traversal of %u nodes: " HX_TIMESPEC_FMT "s\n", + tmap_printf("QFE traversal of %zu nodes: " HX_TIMESPEC_FMT "s\n", map->items, HX_TIMESPEC_EXP(&delta)); tmap_ipop(); @@ -200,7 +200,7 @@ start = delta; stop = delta2; HX_timespec_sub(&delta, &stop, &start); - tmap_printf("Lookup of %u nodes: " HX_TIMESPEC_FMT "s\n", + tmap_printf("Lookup of %zu nodes: " HX_TIMESPEC_FMT "s\n", map->items, HX_TIMESPEC_EXP(&delta)); tmap_ipop(); } @@ -210,7 +210,7 @@ struct HXmap_node *nodes; unsigned int i; - tmap_printf("Retrieving flattened list of %u elements:\n", map->items); + tmap_printf("Retrieving flattened list of %zu elements:\n", map->items); tmap_ipush(); nodes = HXmap_keysvalues(map); if (nodes == NULL) { @@ -430,7 +430,7 @@ u.map = HXmap_init5(HXMAPT_HASH, HXMAP_SCKEY, &intstr_ops, 0, 0); tmap_new_perfect_tree(u.map, power, 2); - tmap_printf("%s, intstr, %u items/%u buckets, " + tmap_printf("%s, intstr, %zu items/%u buckets, " "agglomeration: %.2f%%\n", map_type, u.map->items, HXhash_primes[u.hmap->power], hmap_agg_index(u.hmap, false)); @@ -441,13 +441,13 @@ while (u.map->items < 1 << max_power) { /* Fill up just right up to the maximum load */ tmap_add_rand(u.map, u.hmap->max_load - u.map->items); - tmap_printf("%s, words, %u items/%u buckets, " + tmap_printf("%s, words, %zu items/%u buckets, " "agglomeration: %.2f%%\n", map_type, u.map->items, HXhash_primes[u.hmap->power], hmap_agg_index(u.hmap, false)); /* trigger resize */ tmap_add_rand(u.map, 1); - tmap_printf("%s, words, %u items/%u buckets, " + tmap_printf("%s, words, %zu items/%u buckets, " "agglomeration: %.2f%%\n", map_type, u.map->items, HXhash_primes[u.hmap->power], hmap_agg_index(u.hmap, false)); @@ -535,7 +535,7 @@ max = 2 * log(tree->super.items + 1) / log(2); avg = log((pow(2, min) + pow(2, max)) / 2) / log(2); tmap_ipush(); - tmap_printf("%u items; height %u; min/avg/max %.2f/%.2f/%.2f\n", + tmap_printf("%zu items; height %u; min/avg/max %.2f/%.2f/%.2f\n", tree->super.items, rbt_tree_height(tree->root), min, avg, max); tmap_ipop(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/tc-option.c new/libHX-5.1/src/tc-option.c --- old/libHX-4.28/src/tc-option.c 2025-09-10 14:11:34.903287712 +0200 +++ new/libHX-5.1/src/tc-option.c 2025-10-10 23:04:43.895730103 +0200 @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// SPDX-FileCopyrightText: 2022 Jan Engelhardt +// SPDX-FileCopyrightText: 2025 Jan Engelhardt /* * option parser test program */ @@ -14,17 +14,22 @@ #include "internal.h" static int opt_v = 0, opt_mask = 0; -static char *opt_kstr = NULL; +static char *opt_kstr, *opt_strp; static long opt_klong = 0; static double opt_kdbl = 0; static int opt_kflag = 0, opt_kint = 0; static int opt_dst = 0; static hxmc_t *opt_mcstr = NULL; +static inline const char *znul(const char *s) +{ + return s != nullptr ? s : "(null)"; +} + static void opt_cbf(const struct HXoptcb *cbi) { printf("cbf was called... with \"%s\"/'%c'\n", - cbi->current->ln, cbi->current->sh); + znul(cbi->current->ln), cbi->current->sh); } static const char *opt_eitheror[] = {"neither", "either", "or"}; @@ -59,60 +64,46 @@ .cb = opt_cbf, .help = "XOR mask test", .htyp = "value"}, {.sh = 'G', .type = HXTYPE_NONE, .help = "Just a flag", .cb = opt_cbf}, {.sh = 'H', .type = HXTYPE_NONE, .help = "Just a flag", .cb = opt_cbf}, - {.sh = 'I', .type = HXTYPE_NONE, .help = "Just a flag", .cb = opt_cbf}, + {.sh = 'I', .type = HXTYPE_NONE, .ptr = &opt_strp, .help = "Just a flag", .cb = opt_cbf}, HXOPT_AUTOHELP, {.sh = 'J', .type = HXTYPE_NONE, .help = "Just a flag", .cb = opt_cbf}, + {.sh = 'Z', .type = HXTYPE_STRP, .ptr = &opt_strp, .help = "String pointer", .cb = opt_cbf}, HXOPT_TABLEEND, }; static int t_empty_argv(void) { char *zero_argv[] = {nullptr}; - char **new_argv = nullptr; + struct HXopt6_result result; printf("...with argv={NULL}\n"); - if (HX_getopt5(table, zero_argv, nullptr, &new_argv, - HXOPT_USAGEONERR) != HXOPT_ERR_SUCCESS) + if (HX_getopt6(table, 0, zero_argv, &result, + HXOPT_USAGEONERR | HXOPT_ITER_OA | HXOPT_DUP_ARGS) != HXOPT_ERR_SUCCESS) return EXIT_FAILURE; - HX_zvecfree(new_argv); - return EXIT_SUCCESS; -} - -static int t_keep_argv(void) -{ - static const char *const one_argv[] = {"what", nullptr}; - const char **argv = const_cast2(const char **, one_argv); - if (HX_getopt(table, nullptr, &argv, HXOPT_KEEP_ARGV) != HXOPT_ERR_SUCCESS) + if (result.nopts != 0 || result.nargs != 0 || result.dup_argc != 0) { + HX_getopt6_clean(&result); return EXIT_FAILURE; - return argv == one_argv ? EXIT_SUCCESS : EXIT_FAILURE; + } + HX_getopt6_clean(&result); + return EXIT_SUCCESS; } static int runner(int argc, char **argv) { - printf("== HX_getopt5 ==\n"); - char **nargv = nullptr; - int ret = HX_getopt5(table, argv, &argc, &nargv, HXOPT_USAGEONERR); + printf("== HX_getopt6 ==\n"); + int ret = HX_getopt6(table, argc, argv, nullptr, HXOPT_USAGEONERR); printf("Return value of HX_getopt: %d\n", ret); printf("Either-or is: %s\n", opt_eitheror[opt_dst]); - printf("values: D=%lf I=%d L=%ld S=%s\n", - opt_kdbl, opt_kint, opt_klong, opt_kstr); + printf("values: D=%lf I=%d L=%ld S=%p/%s strp=%p/%s\n", + opt_kdbl, opt_kint, opt_klong, + opt_kstr, znul(opt_kstr), opt_strp, znul(opt_strp)); printf("Verbosity level: %d\n", opt_v); printf("Mask: 0x%08X\n", opt_mask); - printf("mcstr: >%s<\n", opt_mcstr); - printf("new_argv:\n"); - for (char **p = nargv; p != nullptr && *p != nullptr; ++p) - printf("\t%s\n", *p); - if (ret == EXIT_SUCCESS) - HX_zvecfree(nargv); + printf("mcstr: >%s<\n", znul(opt_mcstr)); - printf("\n== getopt other tests ==\n"); ret = t_empty_argv(); if (ret != EXIT_SUCCESS) return ret; - ret = t_keep_argv(); - if (ret != EXIT_SUCCESS) - return ret; - return EXIT_SUCCESS; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/tc-realpath.c new/libHX-5.1/src/tc-realpath.c --- old/libHX-4.28/src/tc-realpath.c 2025-09-10 00:27:16.522025777 +0200 +++ new/libHX-5.1/src/tc-realpath.c 2025-09-11 12:06:38.869011302 +0200 @@ -10,36 +10,14 @@ #include <libHX/string.h> #include "internal.h" -static unsigned int rp_flags; -static unsigned int rp_absolute; -static unsigned int rp_no_parent, rp_no_self; - static const struct HXoption rp_option_table[] = { - {.sh = 'a', .type = HXTYPE_NONE, .ptr = &rp_absolute, - .help = "Produce an absolute path"}, - {.sh = 'p', .type = HXTYPE_NONE, .ptr = &rp_no_parent, - .help = "Deactivate resolution of \"..\" entries"}, - {.sh = 's', .type = HXTYPE_NONE, .ptr = &rp_no_self, - .help = "Deactivate resolution of \".\" entries"}, + {.sh = 'a', .type = HXTYPE_NONE, .help = "Produce an absolute path"}, + {.sh = 'p', .type = HXTYPE_NONE, .help = "Deactivate resolution of \"..\" entries"}, + {.sh = 's', .type = HXTYPE_NONE, .help = "Deactivate resolution of \".\" entries"}, HXOPT_AUTOHELP, HXOPT_TABLEEND, }; -static bool rp_get_options(char **oargv, int *argc, char ***argv) -{ - if (HX_getopt5(rp_option_table, oargv, argc, argv, HXOPT_USAGEONERR) != - HXOPT_ERR_SUCCESS) - return false; - rp_flags = HX_REALPATH_DEFAULT; - if (rp_absolute) - rp_flags |= HX_REALPATH_ABSOLUTE; - if (rp_no_parent) - rp_flags &= ~HX_REALPATH_PARENT; - if (rp_no_self) - rp_flags &= ~HX_REALPATH_SELF; - return true; -} - static void t_1(void) { hxmc_t *tmp = HXmc_strinit(""); @@ -57,20 +35,28 @@ HXmc_free(tmp); } -int main(int argc, char **oargv) +int main(int argc, char **argv) { - char **argv = nullptr; hxmc_t *res; int ret; - - if (!rp_get_options(oargv, &argc, &argv)) - return EXIT_FAILURE; + struct HXopt6_result result; + if (HX_getopt6(rp_option_table, argc, argv, &result, + HXOPT_USAGEONERR | HXOPT_ITER_OA) != HXOPT_ERR_SUCCESS) + return false; + unsigned int rp_flags = HX_REALPATH_DEFAULT; + for (int i = 0; i < result.nopts; ++i) { + switch (result.desc[i]->sh) { + case 'a': rp_flags |= HX_REALPATH_ABSOLUTE; break; + case 'p': rp_flags &= ~HX_REALPATH_PARENT; break; + case 's': rp_flags &= ~HX_REALPATH_SELF; break; + } + } t_1(); t_2(); res = NULL; - for (int i = 1; i < argc; ++i) { - ret = HX_realpath(&res, argv[i], rp_flags); + for (int i = 0; i < result.nargs; ++i) { + ret = HX_realpath(&res, result.uarg[i], rp_flags); if (ret < 0) { perror("HX_realpath"); printf("\n"); @@ -78,6 +64,6 @@ printf("%s\n", res); } } - HX_zvecfree(argv); + HX_getopt6_clean(&result); return EXIT_SUCCESS; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/tc-string.c new/libHX-5.1/src/tc-string.c --- old/libHX-4.28/src/tc-string.c 2025-09-10 14:11:31.726296255 +0200 +++ new/libHX-5.1/src/tc-string.c 2025-10-02 10:28:20.320544597 +0200 @@ -108,23 +108,22 @@ printf("String: >%s<\n", data); } -static void t_strnlen(void) -{ - static const char s[] = "Hello world"; - printf("# strnlen: %" HX_SIZET_FMT "u %" HX_SIZET_FMT "u " - "%" HX_SIZET_FMT "u %" HX_SIZET_FMT "u %" HX_SIZET_FMT "u\n", - HX_strnlen(s, -1), HX_strnlen(s, 0), HX_strnlen(s, 1), - HX_strnlen(s, strlen(s)), HX_strnlen(s, 999)); -} - static void t_strsep(void) { - char b[] = "jengelh:x:1500:100:Jan Engelhardt:/home/jengelh:/bin/bash"; + char orig[] = "jengelh:x:1500:100:Jan Engelhardt:/home/jengelh:/bin/bash"; + char b[sizeof(orig)]; char *wp = b, *ret; printf("# strsep\n"); + memcpy(b, orig, sizeof(orig)); while ((ret = HX_strsep2(&wp, ":")) != NULL) printf("%s\n", ret); + + printf("# strtok_r\n"); + memcpy(b, orig, sizeof(orig)); + wp = b; + while ((ret = strtok_r(nullptr, ":", &wp)) != nullptr) + printf("%s\n", ret); } static void t_strtrim(void) @@ -132,11 +131,6 @@ char a[] = " a and b ", aexp[] = "a and b "; char b[] = " a and b ", bexp[] = " a and b"; char c[] = "a&b", cexp[] = "a&b"; - const char *r; - - r = HX_stpltrim(a); - printf("HX_stpltrim(\"%s\") = \"%s\"\n", a, r); - assert(strcmp(r, aexp) == 0); printf("HX_strltrim(\"%s\") = ", a); printf("\"%s\"\n", (HX_strltrim(a), a)); @@ -146,7 +140,6 @@ printf("\"%s\"\n", (HX_strrtrim(b), b)); assert(strcmp(b, bexp) == 0); - assert(strcmp(cexp, HX_stpltrim(c)) == 0); assert(strcmp(cexp, (HX_strltrim(c), c)) == 0); assert(strcmp(cexp, (HX_strrtrim(c), c)) == 0); } @@ -520,7 +513,6 @@ if (ret != EXIT_SUCCESS) return EXIT_FAILURE; t_strncat(); - t_strnlen(); t_strdup(); t_strsep(); t_strtrim(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/tc-strquote.c new/libHX-5.1/src/tc-strquote.c --- old/libHX-4.28/src/tc-strquote.c 2023-01-22 15:23:01.727705775 +0100 +++ new/libHX-5.1/src/tc-strquote.c 2025-10-02 10:28:20.320544597 +0200 @@ -10,7 +10,6 @@ static const char input1[] = "\"Good\" ol' \\'escaped\\' strings"; static const char output1a[] = "\"Good\" ol\\' \\\\\\'escaped\\\\\\' strings"; static const char output1b[] = "\\\"Good\\\" ol' \\\\'escaped\\\\' strings"; -static const char output1c[] = "\"Good\" ol'' \\''escaped\\'' strings"; static const char input2[] = "<p style=\"height: 1;\">Foo & \"bar\"</p>"; static const char output2[] = "<p style="height: 1;">Foo &amp; "bar"</p>"; @@ -20,8 +19,6 @@ static const char output3c[] = "ICNvPWZvbygqKSxiYVxyIA=="; static const char input4[] = "http://user:[email protected]/~path/file(msvc);stuff.php?query[phpindex]=value&another=one;stuff"; static const char output4[] = "http%3A%2F%2Fuser%3Apass%40host.de%2F~path%2Ffile%28msvc%29%3Bstuff.php%3Fquery%5Bphpindex%5D%3Dvalue%26another%3Done%3Bstuff"; -static const char input5[] = "echo hello `echo world`"; -static const char output5[] = "echo hello ``echo world``"; static const char input6[] = "\xfb\xef\xff"; static const char output6[] = "++//"; static const char input7[] = "\xfb\xef\xff"; @@ -58,13 +55,11 @@ return EXIT_FAILURE; tst(input1, HXQUOTE_SQUOTE, output1a); tst(input1, HXQUOTE_DQUOTE, output1b); - tst(input1, HXQUOTE_SQLSQUOTE, output1c); tst(input2, HXQUOTE_HTML, output2); tst(input3, HXQUOTE_LDAPFLT, output3a); tst(input3, HXQUOTE_LDAPRDN, output3b); tst(input3, HXQUOTE_BASE64, output3c); tst(input4, HXQUOTE_URIENC, output4); - tst(input5, HXQUOTE_SQLBQUOTE, output5); tst(input6, HXQUOTE_BASE64, output6); tst(input7, HXQUOTE_BASE64URL, output7); return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/tc-switchuser.c new/libHX-5.1/src/tc-switchuser.c --- old/libHX-4.28/src/tc-switchuser.c 2023-11-23 13:52:14.267690427 +0100 +++ new/libHX-5.1/src/tc-switchuser.c 2025-10-02 10:28:20.321544592 +0200 @@ -10,19 +10,28 @@ #include <libHX/defs.h> #include <libHX/option.h> #include <libHX/proc.h> +#include "internal.h" #if defined(HAVE_INITGROUPS) -static char *user_name, *group_name; static const struct HXoption options_table[] = { - {.sh = 'u', .type = HXTYPE_STRING, .ptr = &user_name}, - {.sh = 'g', .type = HXTYPE_STRING, .ptr= &group_name}, + {.sh = 'u', .type = HXTYPE_STRING}, + {.sh = 'g', .type = HXTYPE_STRING}, HXOPT_TABLEEND, }; static int runner(int argc, char **argv) { - if (HX_getopt(options_table, &argc, &argv, HXOPT_USAGEONERR) != HXOPT_ERR_SUCCESS) + char *user_name = nullptr, *group_name = nullptr; + struct HXopt6_result result; + + if (HX_getopt6(options_table, argc, argv, &result, + HXOPT_USAGEONERR | HXOPT_ITER_OPTS) != HXOPT_ERR_SUCCESS) return EXIT_FAILURE; + for (int i = 0; i < result.nopts; ++i) { + if (result.desc[i]->sh == 'u') user_name = result.oarg[i]; + if (result.desc[i]->sh == 'g') group_name = result.oarg[i]; + } + const char *user = user_name != NULL ? user_name : "-"; const char *group = group_name != NULL ? group_name : "-"; switch (HXproc_switch_user(user_name, group_name)) { @@ -63,7 +72,7 @@ break; } } - HX_zvecfree(argv); + HX_getopt6_clean(&result); return EXIT_SUCCESS; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/tc-time.c new/libHX-5.1/src/tc-time.c --- old/libHX-4.28/src/tc-time.c 2023-11-01 11:39:14.071936714 +0100 +++ new/libHX-5.1/src/tc-time.c 2025-10-02 18:00:57.902154095 +0200 @@ -5,6 +5,7 @@ #include <stdlib.h> #include <time.h> #include <unistd.h> +#include <sys/time.h> #include <libHX/defs.h> #include <libHX/init.h> #include <libHX/misc.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libHX-4.28/src/tx-option.cpp new/libHX-5.1/src/tx-option.cpp --- old/libHX-4.28/src/tx-option.cpp 2023-11-23 13:52:14.267690427 +0100 +++ new/libHX-5.1/src/tx-option.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,21 +0,0 @@ -#ifndef __cplusplus -# include <stdlib.h> -#else -# include <cstdlib> -#endif -#include <libHX/option.h> - -static unsigned int g_verbose; -static const struct HXoption t[] = { - {nullptr, 'v', HXTYPE_NONE | HXOPT_INC, &g_verbose}, - HXOPT_AUTOHELP, - HXOPT_TABLEEND, -}; - -int main(int argc, char **argv) -{ - if (HX_getopt(t, &argc, &argv, HXOPT_USAGEONERR) != HXOPT_ERR_SUCCESS) - return EXIT_FAILURE; - HX_zvecfree(argv); - return EXIT_SUCCESS; -}
