From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24721 invoked from network); 2 Sep 2003 00:56:26 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 2 Sep 2003 00:56:26 -0000 Received: (qmail 3329 invoked by alias); 2 Sep 2003 00:56:22 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18993 Received: (qmail 3315 invoked from network); 2 Sep 2003 00:56:22 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 2 Sep 2003 00:56:22 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [207.172.4.62] by sunsite.dk (MessageWall 1.0.8) with SMTP; 2 Sep 2003 0:56:21 -0000 Received: from 65-78-17-226.c3-0.nwt-ubr2.sbo-nwt.ma.cable.rcn.com ([65.78.17.226] helo=zion.rcn.com) by smtp03.mrf.mail.rcn.net with esmtp (Exim 3.35 #4) id 19tzT3-00020m-00; Mon, 01 Sep 2003 20:56:21 -0400 Received: by zion.rcn.com (Postfix, from userid 500) id 895E91E086; Mon, 1 Sep 2003 20:52:11 -0400 (EDT) To: Peter Stephenson Cc: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: zsh/system library References: <20030830180351.40D13850C@pwstephenson.fsnet.co.uk> From: Vin Shelton Organization: EtherSoft, Inc Date: Mon, 01 Sep 2003 20:52:11 -0400 In-Reply-To: <20030830180351.40D13850C@pwstephenson.fsnet.co.uk> (Peter Stephenson's message of "Sat, 30 Aug 2003 19:03:49 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Peter, Peter Stephenson writes: > An interface to system errors is also provided. The $errnos array > contains error macro names (EINTR, etc.) and is as I originally proposed > for zsh/params but by popular vote (1 to 0) it has been moved here. > There is also an interface to output (or write to an array) the full > error message. This is the command syserror; there are several reasons > this is a command rather than another array (1) the messages are much > longer than the names and so waste space in the shell (2) they can > change dynamically due to internationalization support (3) the standard > C interface is a function (4) unlike the ENAMES, you are unlikely to > need them internally in the code. > Index: zshconfig.ac > =================================================================== > RCS file: /cvsroot/zsh/zsh/zshconfig.ac,v > retrieving revision 1.37 > diff -u -r1.37 zshconfig.ac > --- zshconfig.ac 25 Apr 2003 11:18:51 -0000 1.37 > +++ zshconfig.ac 30 Aug 2003 17:43:10 -0000 > @@ -1117,6 +1117,39 @@ > SIGNAL_H=$zsh_cv_path_signal_h > AC_SUBST(SIGNAL_H)dnl > > +dnl Where are error names located? Needed as input for errnames1.awk > +AC_CACHE_CHECK(where error names are located, zsh_cv_path_errno_h, > +[dnl Look at the output from the preprocessor. > +dnl We should get lines of the form `# 1 "/usr/include/errno.h"' > +dnl The following assumes the real definitions are in a file which > +dnl contains the name `err'; we could relax this if necessary, > +dnl but then you can get a rather long list of files to test. > +dnl The backslash substitution is to persuade cygwin to cough up > +dnl slashes rather than doubled backslashes in the path. > +echo "#include " > nametmp.c > +errfile_list="`$CPP nametmp.c | > +sed -n 's/^#[ ].*\"\(.*\)\"/\1/p' | > +sed 's/\\\\\\\\/\//g' | > +$AWK '{ if (\$1 ~ \"err\") files[[\$1]] = \$1 } > + END { for (var in files) print var }'`" > +rm -f nametmp.c > +for ERRNO_H in $errfile_list /dev/null > +do > + dnl Try to make sure it doesn't get confused by files that don't > + dnl have real error definitions in. Count definitions to make sure. > + nerrs=`test -f $ERRNO_H && \ > + grep '#[ ]*define[ ][ ]*E[0-9A-Z]*[ ]*[0-9][0-9]*' $ERRNO_H | \ > + wc -l | sed 's/[ ]//g'` > + test "x$nerrs" != x && test "$nerrs" -ge 7 && break > +done > +if test $ERRNO_H = "/dev/null"; then > + AC_MSG_ERROR(ERROR MACROS NOT FOUND: please report to developers) > +fi > +zsh_cv_path_errno_h=$ERRNO_H > +]) > +ERRNO_H=$zsh_cv_path_errno_h > +AC_SUBST(ERRNO_H)dnl > + > dnl ----------------------------------------------------- > dnl Look for the file containing the RLIMIT_* definitions > dnl ----------------------------------------------------- Unfortunately, your CPP hackery does not work on the output of the Intel C Compiler. icc generates output like the following from nametmp.c: #line 1 "nametmp.c" #line 1 "/usr/include/errno.h" #line 1 "/usr/include/features.h" #line 105 "/usr/include/features.h" .... It's the rather "line" that gets in the way. Here's the regexp that works for both icc and gcc on my Linux system at home. When I get to work tomorrow, I will test this against the Solaris C compiler. --- zshconfig.ac~ 2003-09-01 00:03:24.000000000 -0400 +++ zshconfig.ac 2003-09-01 20:43:21.000000000 -0400 @@ -1128,7 +1128,7 @@ dnl slashes rather than doubled backslashes in the path. echo "#include " > nametmp.c errfile_list="`$CPP nametmp.c | -sed -n 's/^#[ ].*\"\(.*\)\"/\1/p' | +sed -n 's/^#\(line\)\?[ ].*\"\(.*\)\"/\2/p' | sed 's/\\\\\\\\/\//g' | $AWK '{ if (\$1 ~ \"err\") files[[\$1]] = \$1 } END { for (var in files) print var }'`" HTH, Vin