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

Re: zsh for root



Tatsuo Furukawa wrote:
>I am using HP-UX 10.20.  I want to make "zsh for root".  To do this, I
>must make zsh with static link.  But HP-UX's setlocale() depends
>/usr/lib/libdld.sl, so I can't.

This calls for a configure test.  Actually, two.

If setlocale() is actually unavailable when linking statically, that needs
to be detected by configure, and disable the locale stuff.  If it's just a
case of setlocale() doing stuff that you don't want a root zsh doing, that
needs to be manually configurable.  This patch does both of these things.

-zefram

diff -cr ../zsh-3.1.6-bart-7.old/Src/main.c ./Src/main.c
*** ../zsh-3.1.6-bart-7.old/Src/main.c	Fri Oct 22 09:22:03 1999
--- ./Src/main.c	Fri Oct 22 09:44:59 1999
***************
*** 35,41 ****
  main(int argc, char **argv)
  {
      char **t;
! #ifdef LC_ALL
      setlocale(LC_ALL, "");
  #endif
  
--- 35,41 ----
  main(int argc, char **argv)
  {
      char **t;
! #ifdef USE_LOCALE
      setlocale(LC_ALL, "");
  #endif
  
diff -cr ../zsh-3.1.6-bart-7.old/Src/params.c ./Src/params.c
*** ../zsh-3.1.6-bart-7.old/Src/params.c	Fri Oct 22 09:22:03 1999
--- ./Src/params.c	Fri Oct 22 09:45:40 1999
***************
*** 146,152 ****
  IPDEF2("IFS", ifsgetfn, ifssetfn, PM_DONTIMPORT),
  IPDEF2("_", underscoregetfn, nullsetfn, PM_READONLY),
  
! #ifdef LC_ALL
  # define LCIPDEF(name) IPDEF2(name, strgetfn, lcsetfn, PM_UNSET)
  IPDEF2("LANG", strgetfn, langsetfn, PM_UNSET),
  IPDEF2("LC_ALL", strgetfn, lc_allsetfn, PM_UNSET),
--- 146,152 ----
  IPDEF2("IFS", ifsgetfn, ifssetfn, PM_DONTIMPORT),
  IPDEF2("_", underscoregetfn, nullsetfn, PM_READONLY),
  
! #ifdef USE_LOCALE
  # define LCIPDEF(name) IPDEF2(name, strgetfn, lcsetfn, PM_UNSET)
  IPDEF2("LANG", strgetfn, langsetfn, PM_UNSET),
  IPDEF2("LC_ALL", strgetfn, lc_allsetfn, PM_UNSET),
***************
*** 162,168 ****
  # ifdef LC_TIME
  LCIPDEF("LC_TIME"),
  # endif
! #endif
  
  #define IPDEF4(A,B) {NULL,A,PM_INTEGER|PM_READONLY|PM_SPECIAL,BR((void *)B),SFN(nullsetfn),GFN(intvargetfn),stdunsetfn,10,NULL,NULL,NULL,0}
  IPDEF4("!", &lastpid),
--- 162,168 ----
  # ifdef LC_TIME
  LCIPDEF("LC_TIME"),
  # endif
! #endif /* USE_LOCALE */
  
  #define IPDEF4(A,B) {NULL,A,PM_INTEGER|PM_READONLY|PM_SPECIAL,BR((void *)B),SFN(nullsetfn),GFN(intvargetfn),stdunsetfn,10,NULL,NULL,NULL,0}
  IPDEF4("!", &lastpid),
***************
*** 2444,2450 ****
  
  /* Functions to set value of special parameters `LANG' and `LC_*' */
  
! #ifdef LC_ALL
  static struct localename {
      char *name;
      int category;
--- 2444,2450 ----
  
  /* Functions to set value of special parameters `LANG' and `LC_*' */
  
! #ifdef USE_LOCALE
  static struct localename {
      char *name;
      int category;
***************
*** 2511,2517 ****
  	if (!strcmp(ln->name, pm->nam))
  	    setlocale(ln->category, x ? x : "");
  }
! #endif
  
  /* Function to get value for special parameter `HISTSIZE' */
  
--- 2511,2517 ----
  	if (!strcmp(ln->name, pm->nam))
  	    setlocale(ln->category, x ? x : "");
  }
! #endif /* USE_LOCALE */
  
  /* Function to get value for special parameter `HISTSIZE' */
  
diff -cr ../zsh-3.1.6-bart-7.old/Src/system.h ./Src/system.h
*** ../zsh-3.1.6-bart-7.old/Src/system.h	Fri Oct 22 09:22:03 1999
--- ./Src/system.h	Fri Oct 22 09:44:42 1999
***************
*** 632,634 ****
--- 632,640 ----
  #undef ESRCH
  #define ESRCH EINVAL
  #endif /* BROKEN_KILL_ESRCH */
+ 
+ /* Can we do locale stuff? */
+ #undef USE_LOCALE
+ #if defined(CONFIG_LOCALE) && defined(HAVE_SETLOCALE) && defined(LC_ALL)
+ # define USE_LOCALE 1
+ #endif /* CONFIG_LOCALE && HAVE_SETLOCALE && LC_ALL */
diff -cr ../zsh-3.1.6-bart-7.old/acconfig.h ./acconfig.h
*** ../zsh-3.1.6-bart-7.old/acconfig.h	Fri Oct 22 09:21:58 1999
--- ./acconfig.h	Fri Oct 22 09:38:37 1999
***************
*** 163,168 ****
--- 163,171 ----
   * By default this is defined.                               */
  #undef RESTRICTED_R
  
+ /* Define if you want locale features.  By default this is defined. */
+ #undef CONFIG_LOCALE
+ 
  /* Define to 1 if your termcap library has the ospeed variable */
  #undef HAVE_OSPEED
  /* Define to 1 if you have ospeed, but it is not defined in termcap.h */
diff -cr ../zsh-3.1.6-bart-7.old/configure.in ./configure.in
*** ../zsh-3.1.6-bart-7.old/configure.in	Fri Oct 22 09:21:58 1999
--- ./configure.in	Fri Oct 22 09:40:23 1999
***************
*** 201,206 ****
--- 201,215 ----
  AC_DEFINE(RESTRICTED_R)
  )
  
+ dnl Do you want to disable use of locale functions
+ AC_ARG_ENABLE([locale],
+ [  --disable-locale           turn off locale features],
+ [if test x$enableval = xyes; then
+   AC_DEFINE(CONFIG_LOCALE)
+ fi],
+ AC_DEFINE(CONFIG_LOCALE)
+ )
+ 
  undefine([fndir])dnl
  AC_ARG_ENABLE(fndir,
  [  --enable-fndir=DIR        where functions go (default DATADIR/zsh/functions)],
***************
*** 766,772 ****
                sigprocmask setuid seteuid setreuid setresuid setsid strerror \
                nis_list initgroups fchdir cap_get_proc readlink nice \
  	      getgrgid getgrnam getpwent getpwnam getpwuid setpgrp \
! 	      fseeko ftello mmap munmap msync ftruncate)
  
  dnl ---------------
  dnl CHECK FUNCTIONS
--- 775,781 ----
                sigprocmask setuid seteuid setreuid setresuid setsid strerror \
                nis_list initgroups fchdir cap_get_proc readlink nice \
  	      getgrgid getgrnam getpwent getpwnam getpwuid setpgrp \
! 	      fseeko ftello mmap munmap msync ftruncate setlocale)
  
  dnl ---------------
  dnl CHECK FUNCTIONS
*** ../zsh-3.1.6-bart-7.old/INSTALL	Fri Oct 22 09:21:58 1999
--- ./INSTALL	Fri Oct 22 10:06:34 1999
***************
*** 358,360 ****
--- 358,361 ----
       function-subdirs    # if functions will be installed into subdirectories
       dynamic             # allow dynamically loaded binary modules
       lfs                 # allow configure check for large files
+      locale              # allow use of locale library
END



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