Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: zsh/system library
- X-seq: zsh-workers 18993
- From: Vin Shelton <acs@xxxxxxxxxxxxxxxxxxxx>
- To: Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
- Subject: Re: PATCH: zsh/system library
- Date: Mon, 01 Sep 2003 20:52:11 -0400
- Cc: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- In-reply-to: <20030830180351.40D13850C@xxxxxxxxxxxxxxxxxxxxxxxx> (Peter Stephenson's message of "Sat, 30 Aug 2003 19:03:49 +0100")
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: EtherSoft, Inc
- References: <20030830180351.40D13850C@xxxxxxxxxxxxxxxxxxxxxxxx>
Peter,
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx> 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 <errno.h>" > 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 <errno.h>" > 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author