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

Re: zsh 2.5.03 suggestion



> We have been trying to change sys_errlist from `const char *const[]'
> back to `char *[]', or, better yet, get people to stop using it
> entirely.  Towards the latter, it would be nice if zsh's utils.c
> would use strerror() rather than sys_errlist, with a `backup'
> implementation that uses sys_errlist[argument] for systems that
> lack strerror (perhaps even providing this backup in the form of
> a strerror() implementation).

Well, here's the simplest possibility (which requires re-running
autoconf).

I don't quite understand what's going on if HAVE_SYS_ERRLIST isn't
defined.  It's behaving as if there's one being supplied, but I don't
know where it's coming from.

*** Src/signals.h.se	Mon Dec  4 13:42:37 1995
--- Src/signals.h	Mon Dec  4 13:49:57 1995
***************
*** 31,37 ****
  
  #include "signames.h"
  
! #ifndef HAVE_SYS_ERRLIST
  extern char *sys_errlist[];
  #endif
  
--- 31,37 ----
  
  #include "signames.h"
  
! #if !defined(HAVE_SYS_ERRLIST) && !defined(HAVE_STRERROR)
  extern char *sys_errlist[];
  #endif
  
*** Src/utils.c.se	Mon Dec  4 13:42:43 1995
--- Src/utils.c	Mon Dec  4 14:00:23 1995
***************
*** 97,108 ****
--- 97,118 ----
  		    errflag = 1;
  		    return;
  		}
+ #ifdef HAVE_STRERROR
  		if (num == EIO)
+ 		    fputs(strerror(num), stderr);
+ 		else {
+ 		    char *errmsg = strerror(num);
+ 		    fputc(tulower(errmsg[0]), stderr);
+ 		    fputs(errmsg + 1, stderr);
+ 		}
+ #else
+ 		if (num == EIO)
  		    fputs(sys_errlist[num], stderr);
  		else {
  		    fputc(tulower(sys_errlist[num][0]), stderr);
  		    fputs(sys_errlist[num] + 1, stderr);
  		}
+ #endif
  		break;
  	    }
  	} else
*** config.h.in.se	Tue Nov 21 06:38:48 1995
--- config.h.in	Mon Dec  4 14:06:09 1995
***************
*** 248,253 ****
--- 248,256 ----
  /* Define if you have the sigsetmask function.  */
  #undef HAVE_SIGSETMASK
  
+ /* Define if you have the strerror function.  */
+ #undef HAVE_STRERROR
+ 
  /* Define if you have the strftime function.  */
  #undef HAVE_STRFTIME
  
*** configure.in.se	Mon Dec  4 13:52:35 1995
--- configure.in	Mon Dec  4 13:54:10 1995
***************
*** 309,315 ****
  AC_CHECK_FUNCS(strftime waitpid select tcsetpgrp tcgetattr strstr lstat \
                getlogin setpgid gettimeofday gethostname mkfifo wait3 difftime  \
                sigblock sigsetmask sigrelse sighold killpg sigaction getrlimit  \
!               sigprocmask setuid seteuid setreuid setresuid)
  
  dnl -------------
  dnl CHECK SIGNALS
--- 309,315 ----
  AC_CHECK_FUNCS(strftime waitpid select tcsetpgrp tcgetattr strstr lstat \
                getlogin setpgid gettimeofday gethostname mkfifo wait3 difftime  \
                sigblock sigsetmask sigrelse sighold killpg sigaction getrlimit  \
!               sigprocmask setuid seteuid setreuid setresuid strerror)
  
  dnl -------------
  dnl CHECK SIGNALS

-- 
Peter Stephenson <pws@xxxxxx>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.



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