libbsd: Branch 'main' - 5 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Apr 29 14:17:32 UTC 2023


 configure.ac         |   13 ++++++++++---
 include/bsd/stdlib.h |    2 ++
 include/bsd/wchar.h  |    2 ++
 man/Makefile.am      |   28 +++++++++++++++++++---------
 src/Makefile.am      |   14 +++++++-------
 src/progname.c       |    3 +++
 test/Makefile.am     |   10 +++++-----
 7 files changed, 48 insertions(+), 24 deletions(-)

New commits:
commit 73b25a8f871b3a20f6ff76679358540f95d7dbfd
Author: Guillem Jover <guillem at hadrons.org>
Date:   Sun Apr 23 02:04:47 2023 +0200

    build: Sort entries alphabetically

diff --git a/man/Makefile.am b/man/Makefile.am
index b89c3dd..14bea2b 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -174,9 +174,9 @@ dist_man_MANS = \
 	fgetln.3bsd \
 	fgetwln.3bsd \
 	flopen.3bsd \
-	freezero.3bsd \
 	fmtcheck.3bsd \
 	fparseln.3bsd \
+	freezero.3bsd \
 	getbsize.3bsd \
 	getmode.3bsd \
 	getpeereid.3bsd \
diff --git a/src/Makefile.am b/src/Makefile.am
index fd4bee9..9d22b00 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -81,11 +81,11 @@ libbsd_la_SOURCES = \
 	expand_number.c \
 	explicit_bzero.c \
 	fgetln.c \
-	freezero.c \
 	fgetwln.c \
 	flopen.c \
 	fmtcheck.c \
 	fparseln.c \
+	freezero.c \
 	getbsize.c \
 	getpeereid.c \
 	heapsort.c \
commit 5434ba169bddb985ca7d0b8f1635b105b0038643
Author: Guillem Jover <guillem at hadrons.org>
Date:   Sun Apr 23 02:05:04 2023 +0200

    build: Conditionalize wcslcpy() and wcslcat() functions on macOS
    
    These functions are provided by the system libc.

diff --git a/configure.ac b/configure.ac
index 9b2c277..aabe28e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -324,6 +324,7 @@ need_progname=yes
 need_md5=yes
 need_nlist=yes
 need_strl=yes
+need_wcsl=yes
 need_strmode=yes
 need_id_from_name=yes
 need_fpurge=yes
@@ -354,6 +355,7 @@ AS_CASE([$host_os],
     need_md5=no
     need_nlist=no
     need_strl=no
+    need_wcsl=no
     need_strmode=no
     need_id_from_name=no
     need_fpurge=no
@@ -371,6 +373,7 @@ AM_CONDITIONAL([NEED_TRANSPARENT_LIBMD], [test "x$need_transparent_libmd" = "xye
 AM_CONDITIONAL([NEED_MD5], [test "x$need_md5" = "xyes"])
 AM_CONDITIONAL([NEED_NLIST], [test "x$need_nlist" = "xyes"])
 AM_CONDITIONAL([NEED_STRL], [test "x$need_strl" = "xyes"])
+AM_CONDITIONAL([NEED_WCSL], [test "x$need_wcsl" = "xyes"])
 AM_CONDITIONAL([NEED_STRMODE], [test "x$need_strmode" = "xyes"])
 AM_CONDITIONAL([NEED_ID_FROM_NAME], [test "x$need_id_from_name" = "xyes"])
 AM_CONDITIONAL([NEED_FPURGE], [test "x$need_fpurge" = "xyes"])
diff --git a/include/bsd/wchar.h b/include/bsd/wchar.h
index 7216503..8edef23 100644
--- a/include/bsd/wchar.h
+++ b/include/bsd/wchar.h
@@ -50,8 +50,10 @@
 __BEGIN_DECLS
 wchar_t *fgetwln(FILE *stream, size_t *len);
 
+#if !defined(__APPLE__)
 size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size);
 size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size);
+#endif
 __END_DECLS
 
 #endif
diff --git a/man/Makefile.am b/man/Makefile.am
index 118ab2d..b89c3dd 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -238,8 +238,6 @@ dist_man_MANS = \
 	unvis.3bsd \
 	user_from_uid.3bsd \
 	vis.3bsd \
-	wcslcat.3bsd \
-	wcslcpy.3bsd \
 	# EOL
 
 if NEED_PROGNAME
@@ -268,6 +266,13 @@ dist_man_MANS += \
 	# EOL
 endif
 
+if NEED_WCSL
+dist_man_MANS += \
+	wcslcat.3bsd \
+	wcslcpy.3bsd \
+	# EOL
+endif
+
 if NEED_STRMODE
 dist_man_MANS += \
 	strmode.3bsd \
diff --git a/src/Makefile.am b/src/Makefile.am
index 0648b03..fd4bee9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -112,8 +112,6 @@ libbsd_la_SOURCES = \
 	timeconv.c \
 	unvis.c \
 	vis.c \
-	wcslcat.c \
-	wcslcpy.c \
 	# EOL
 
 if NEED_BSD_GETOPT
@@ -158,6 +156,13 @@ libbsd_la_SOURCES += \
 	# EOL
 endif
 
+if NEED_WCSL
+libbsd_la_SOURCES += \
+	wcslcat.c \
+	wcslcpy.c \
+	# EOL
+endif
+
 if NEED_STRMODE
 libbsd_la_SOURCES += \
 	strmode.c \
commit dc1bd1a2cbead8a75febae0514904674bbfbf1ed
Author: Guillem Jover <guillem at hadrons.org>
Date:   Sun Apr 23 02:00:10 2023 +0200

    build: Conditionalize only id-from-name functions not the entire pwcache
    
    On macOS the name-from-id functions are present, but not the
    id-from-name ones, so we want to provide those instead of suppressing
    the entire file.

diff --git a/configure.ac b/configure.ac
index 624494e..9b2c277 100644
--- a/configure.ac
+++ b/configure.ac
@@ -325,7 +325,7 @@ need_md5=yes
 need_nlist=yes
 need_strl=yes
 need_strmode=yes
-need_pwcache=yes
+need_id_from_name=yes
 need_fpurge=yes
 need_funopen=yes
 AS_CASE([$host_os],
@@ -355,7 +355,7 @@ AS_CASE([$host_os],
     need_nlist=no
     need_strl=no
     need_strmode=no
-    need_pwcache=no
+    need_id_from_name=no
     need_fpurge=no
     # On macOS we do not have fopencookie(), and cannot implement it.
     need_funopen=no
@@ -372,7 +372,7 @@ AM_CONDITIONAL([NEED_MD5], [test "x$need_md5" = "xyes"])
 AM_CONDITIONAL([NEED_NLIST], [test "x$need_nlist" = "xyes"])
 AM_CONDITIONAL([NEED_STRL], [test "x$need_strl" = "xyes"])
 AM_CONDITIONAL([NEED_STRMODE], [test "x$need_strmode" = "xyes"])
-AM_CONDITIONAL([NEED_PWCACHE], [test "x$need_pwcache" = "xyes"])
+AM_CONDITIONAL([NEED_ID_FROM_NAME], [test "x$need_id_from_name" = "xyes"])
 AM_CONDITIONAL([NEED_FPURGE], [test "x$need_fpurge" = "xyes"])
 AM_CONDITIONAL([NEED_FUNOPEN], [test "x$need_funopen" = "xyes"])
 AS_IF([test "x$need_funopen" = "xno" && \
diff --git a/man/Makefile.am b/man/Makefile.am
index 91499e1..118ab2d 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -180,6 +180,7 @@ dist_man_MANS = \
 	getbsize.3bsd \
 	getmode.3bsd \
 	getpeereid.3bsd \
+	group_from_gid.3bsd \
 	heapsort.3bsd \
 	humanize_number.3bsd \
 	le16dec.3bsd \
@@ -195,6 +196,7 @@ dist_man_MANS = \
 	pidfile_open.3bsd \
 	pidfile_remove.3bsd \
 	pidfile_write.3bsd \
+	pwcache.3bsd \
 	queue.3bsd \
 	radixsort.3bsd \
 	readpassphrase.3bsd \
@@ -234,6 +236,7 @@ dist_man_MANS = \
 	timeval.3bsd \
 	tree.3bsd \
 	unvis.3bsd \
+	user_from_uid.3bsd \
 	vis.3bsd \
 	wcslcat.3bsd \
 	wcslcpy.3bsd \
@@ -271,13 +274,10 @@ dist_man_MANS += \
 	# EOL
 endif
 
-if NEED_PWCACHE
+if NEED_ID_FROM_NAME
 dist_man_MANS += \
-	pwcache.3bsd \
 	uid_from_user.3bsd \
-	user_from_uid.3bsd \
 	gid_from_group.3bsd \
-	group_from_gid.3bsd \
 	# EOL
 endif
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 3e26159..0648b03 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -96,6 +96,7 @@ libbsd_la_SOURCES = \
 	merge.c \
 	pidfile.c \
 	progname.c \
+	pwcache.c \
 	radixsort.c \
 	readpassphrase.c \
 	reallocarray.c \
@@ -163,12 +164,6 @@ libbsd_la_SOURCES += \
 	# EOL
 endif
 
-if NEED_PWCACHE
-libbsd_la_SOURCES += \
-	pwcache.c \
-	# EOL
-endif
-
 if NEED_FPURGE
 libbsd_la_SOURCES += \
 	fpurge.c \
diff --git a/test/Makefile.am b/test/Makefile.am
index 13c2ae1..459012c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -41,6 +41,7 @@ check_PROGRAMS = \
 	fgetln \
 	fparseln \
 	proctitle-init \
+	pwcache \
 	setmode \
 	strnstr \
 	strtonum \
@@ -64,10 +65,6 @@ if NEED_STRMODE
 check_PROGRAMS += strmode
 endif
 
-if NEED_PWCACHE
-check_PROGRAMS += pwcache
-endif
-
 if NEED_FPURGE
 check_PROGRAMS += fpurge
 endif
commit edc746ea7b8725578e8533b094d40c2be5c04b8b
Author: Guillem Jover <guillem at hadrons.org>
Date:   Sat Apr 22 22:47:10 2023 +0200

    build: Conditionalize getprogname()/setprogname on macOS
    
    These functions are provided by the system libc, so there is no need for
    us to provide them.

diff --git a/configure.ac b/configure.ac
index f0762f6..624494e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -320,6 +320,7 @@ AC_CHECK_FUNCS([\
 
 need_arc4random=yes
 need_bsd_getopt=yes
+need_progname=yes
 need_md5=yes
 need_nlist=yes
 need_strl=yes
@@ -348,6 +349,7 @@ AS_CASE([$host_os],
     # there, so we can avoid providing these with no ABI breakage.
     need_arc4random=no
     need_bsd_getopt=no
+    need_progname=no
     need_transparent_libmd=no
     need_md5=no
     need_nlist=no
@@ -364,6 +366,7 @@ AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"])
 
 AM_CONDITIONAL([NEED_ARC4RANDOM], [test "x$need_arc4random" = "xyes"])
 AM_CONDITIONAL([NEED_BSD_GETOPT], [test "x$need_bsd_getopt" = "xyes"])
+AM_CONDITIONAL([NEED_PROGNAME], [test "x$need_progname" = "xyes"])
 AM_CONDITIONAL([NEED_TRANSPARENT_LIBMD], [test "x$need_transparent_libmd" = "xyes"])
 AM_CONDITIONAL([NEED_MD5], [test "x$need_md5" = "xyes"])
 AM_CONDITIONAL([NEED_NLIST], [test "x$need_nlist" = "xyes"])
diff --git a/include/bsd/stdlib.h b/include/bsd/stdlib.h
index bba13af..51c58e8 100644
--- a/include/bsd/stdlib.h
+++ b/include/bsd/stdlib.h
@@ -65,8 +65,10 @@ void arc4random_addrandom(unsigned char *dat, int datlen);
 
 int dehumanize_number(const char *str, int64_t *size);
 
+#if !defined(__APPLE__)
 const char *getprogname(void);
 void setprogname(const char *);
+#endif
 
 int heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
 int mergesort(void *base, size_t nmemb, size_t size,
diff --git a/man/Makefile.am b/man/Makefile.am
index bc30c87..91499e1 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -180,7 +180,6 @@ dist_man_MANS = \
 	getbsize.3bsd \
 	getmode.3bsd \
 	getpeereid.3bsd \
-	getprogname.3bsd \
 	heapsort.3bsd \
 	humanize_number.3bsd \
 	le16dec.3bsd \
@@ -205,7 +204,6 @@ dist_man_MANS = \
 	setmode.3bsd \
 	setproctitle.3bsd \
 	setproctitle_init.3bsd \
-	setprogname.3bsd \
 	sl_add.3bsd \
 	sl_delete.3bsd \
 	sl_find.3bsd \
@@ -241,6 +239,13 @@ dist_man_MANS = \
 	wcslcpy.3bsd \
 	# EOL
 
+if NEED_PROGNAME
+dist_man_MANS += \
+	getprogname.3bsd \
+	setprogname.3bsd \
+	# EOL
+endif
+
 if NEED_MD5
 dist_man_MANS += \
 	md5.3bsd \
diff --git a/test/Makefile.am b/test/Makefile.am
index 7d220f7..13c2ae1 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -41,7 +41,6 @@ check_PROGRAMS = \
 	fgetln \
 	fparseln \
 	proctitle-init \
-	progname \
 	setmode \
 	strnstr \
 	strtonum \
@@ -49,6 +48,10 @@ check_PROGRAMS = \
 	vis-openbsd \
 	# EOL
 
+if NEED_PROGNAME
+check_PROGRAMS += progname
+endif
+
 if NEED_NLIST
 check_PROGRAMS += nlist
 endif
commit 8f998d1d204c7a6218b49b021b74e6ac2e8fc642
Author: Guillem Jover <guillem at hadrons.org>
Date:   Sat Apr 22 20:23:08 2023 +0200

    progname: Include <procinfo.h> if available
    
    We need this header on AIX. Missed transplanting the code from the AIX
    porting system.
    
    Fixes: commit 9fa06763a1afe0946a3a20e5bbdba72885cbade5

diff --git a/configure.ac b/configure.ac
index db33043..f0762f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -179,6 +179,7 @@ AC_CHECK_HEADERS([\
   pwd.h \
   grp.h \
   stdio_ext.h \
+  procinfo.h \
 ])
 
 # Checks for typedefs, structures, and compiler characteristics.
diff --git a/src/progname.c b/src/progname.c
index 56d91ec..83e8652 100644
--- a/src/progname.c
+++ b/src/progname.c
@@ -35,6 +35,9 @@
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
+#ifdef HAVE_PROCINFO_H
+#include <procinfo.h>
+#endif
 #ifdef _WIN32
 #include <Windows.h>
 #include <shlwapi.h>


More information about the libbsd mailing list