Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: UTF-8 locales on BSDs do not support collation correctly



On Thu, 26 Jan 2017 17:57:17 +0000
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> (I will supply a patch that checks for setutxent etc., now I've noticed
> there aren't any yet, but that doesn't appear to be the problem here,
> modulo obscurities.)

Can't see any reason not to commit it anyway.

Are there systems that use utmpx but getutent, not getutxent (which I
think was the implication of the old code)?  If so, we need the
following; otherwise, we need the #ifdef higher up.

pws

diff --git a/Src/watch.c b/Src/watch.c
index 7a6b930..6103ef1 100644
--- a/Src/watch.c
+++ b/Src/watch.c
@@ -87,9 +87,12 @@
 
 #if !defined(WATCH_STRUCT_UTMP) && defined(HAVE_STRUCT_UTMPX) && defined(REAL_UTMPX_FILE)
 # define WATCH_STRUCT_UTMP struct utmpx
-# define setutent setutxent
-# define getutent getutxent
-# define endutent endutxent 
+# if defined(HAVE_SETUTXENT) && defined(HAVE_GETUTXENT) && defined(HAVE_ENDUTXENT)
+#  define setutent setutxent
+#  define getutent getutxent
+#  define endutent endutxent
+# endif
+
 /*
  * In utmpx, the ut_name field is replaced by ut_user.
  * Howver, on some systems ut_name may already be defined this
diff --git a/configure.ac b/configure.ac
index dda52bc..c6ece67 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1324,7 +1324,8 @@ AC_CHECK_FUNCS(strftime strptime mktime timelocal \
 	       symlink getcwd \
 	       cygwin_conv_path \
 	       nanosleep \
-	       srand_deterministic)
+	       srand_deterministic \
+	       setutxent getutxent endutxent)
 AC_FUNC_STRCOLL
 
 AH_TEMPLATE([REALPATH_ACCEPTS_NULL],



Messages sorted by: Reverse Date, Date, Thread, Author