From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from math.gatech.edu (euclid.skiles.gatech.edu [130.207.146.50]) by werple.net.au (8.7/8.7.1) with SMTP id CAA11125 for ; Tue, 5 Dec 1995 02:16:31 +1100 (EST) Received: by math.gatech.edu (5.x/SMI-SVR4) id AA11998; Mon, 4 Dec 1995 09:44:05 -0500 Resent-Date: Mon, 04 Dec 1995 15:31:24 +0100 Old-Return-Path: Message-Id: <9512041431.AA09898@hydra.ifh.de> To: zsh-list@sterling.com Subject: Re: zsh 2.5.03 suggestion In-Reply-To: "torek@sparc.bsdi.com"'s message of "Sun, 03 Dec 1995 15:21:33 MET." <199512032221.PAA03759@sparc.BSDI.COM> Date: Mon, 04 Dec 1995 15:31:24 +0100 From: Peter Stephenson Resent-Message-Id: <"OG2u32.0.Ox2.qammm"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/667 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > 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 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.