gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, select, updated. gawk-4.1.0-56-g24a5702


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, select, updated. gawk-4.1.0-56-g24a5702
Date: Tue, 02 Jul 2013 01:20:51 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, select has been updated
       via  24a57029937207c4fa2ff4acb5a4e1ae1dc9e54b (commit)
      from  e3d803ece7400aeb61e9577346e3de93ae2afccb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=24a57029937207c4fa2ff4acb5a4e1ae1dc9e54b

commit 24a57029937207c4fa2ff4acb5a4e1ae1dc9e54b
Author: Andrew J. Schorr <address@hidden>
Date:   Mon Jul 1 21:19:30 2013 -0400

    Add PROCINFO["errno"] and errno extension to map between errno and strings.

diff --git a/ChangeLog b/ChangeLog
index aed9b6f..7802781 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-07-01         Andrew J. Schorr     <address@hidden>
+
+       * eval.c (update_ERRNO_int, unset_ERRNO): Update PROCINFO["errno"].
+
 2013-06-30         Andrew J. Schorr     <address@hidden>
        * awk.h (redirect_string): Declare new function that provides API access
        to the redirection mechanism.
diff --git a/eval.c b/eval.c
index cf2264b..c1253f5 100644
--- a/eval.c
+++ b/eval.c
@@ -997,6 +997,7 @@ update_ERRNO_int(int errcode)
 {
        char *cp;
 
+       update_PROCINFO_num("errno", errcode);
        if (errcode) {
                cp = strerror(errcode);
                cp = gettext(cp);
@@ -1020,6 +1021,7 @@ update_ERRNO_string(const char *string)
 void
 unset_ERRNO(void)
 {
+       update_PROCINFO_num("errno", 0);
        unref(ERRNO_node->var_value);
        ERRNO_node->var_value = dupnode(Nnull_string);
 }
diff --git a/extension/ChangeLog b/extension/ChangeLog
index e4dcf00..8b3e4bc 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,5 +1,17 @@
 2013-07-01         Andrew J. Schorr     <address@hidden>
 
+       * errlist.h: New file containing a list of all the errno values I could
+       find.
+       * errno.c: Implement a new errno extension providing strerror,
+       errno2name, and name2errno.
+       * Makefile.am (pkgextension_LTLIBRARIES): Add errno.la.
+       (errno_la_SOURCES, errno_la_LDFLAGS, errno_la_LIBADD): Build new errno
+       extension.
+       * select.c (ext_version): Fix version string.
+       * siglist.h: Update to newest glibc version.
+
+2013-07-01         Andrew J. Schorr     <address@hidden>
+
        * siglist.h: New file copied from glibc to provide a mapping between
        signal number and name.
        * select.c: Add a new "select_signal" function and provide support
diff --git a/extension/Makefile.am b/extension/Makefile.am
index 58fc3df..1d54522 100644
--- a/extension/Makefile.am
+++ b/extension/Makefile.am
@@ -32,6 +32,7 @@ ACLOCAL_AMFLAGS = -I m4
 # Note: rwarray does not currently compile.
 
 pkgextension_LTLIBRARIES =     \
+       errno.la        \
        filefuncs.la    \
        fnmatch.la      \
        fork.la         \
@@ -50,6 +51,10 @@ MY_MODULE_FLAGS = -module -avoid-version -no-undefined
 # on Cygwin, gettext requires that we link with -lintl 
 MY_LIBS = $(LTLIBINTL)
 
+errno_la_SOURCES     = errno.c
+errno_la_LDFLAGS     = $(MY_MODULE_FLAGS)
+errno_la_LIBADD      = $(MY_LIBS)
+
 filefuncs_la_SOURCES  = filefuncs.c stack.h stack.c gawkfts.h \
                        gawkfts.c gawkdirfd.h
 filefuncs_la_LDFLAGS  = $(MY_MODULE_FLAGS)
@@ -71,10 +76,6 @@ ordchr_la_SOURCES     = ordchr.c
 ordchr_la_LDFLAGS     = $(MY_MODULE_FLAGS)
 ordchr_la_LIBADD      = $(MY_LIBS)
 
-select_la_SOURCES     = select.c
-select_la_LDFLAGS     = $(MY_MODULE_FLAGS)
-select_la_LIBADD      = $(MY_LIBS)
-
 readdir_la_SOURCES    = readdir.c gawkdirfd.h
 readdir_la_LDFLAGS    = $(MY_MODULE_FLAGS)
 readdir_la_LIBADD     = $(MY_LIBS)
@@ -95,6 +96,10 @@ rwarray_la_SOURCES    = rwarray.c
 rwarray_la_LDFLAGS    = $(MY_MODULE_FLAGS)
 rwarray_la_LIBADD     = $(MY_LIBS)
 
+select_la_SOURCES     = select.c
+select_la_LDFLAGS     = $(MY_MODULE_FLAGS)
+select_la_LIBADD      = $(MY_LIBS)
+
 time_la_SOURCES       = time.c
 time_la_LDFLAGS       = $(MY_MODULE_FLAGS)
 time_la_LIBADD        = $(MY_LIBS)
diff --git a/extension/Makefile.in b/extension/Makefile.in
index 97ee41f..5c45b49 100644
--- a/extension/Makefile.in
+++ b/extension/Makefile.in
@@ -139,13 +139,19 @@ am__installdirs = "$(DESTDIR)$(pkgextensiondir)" \
 LTLIBRARIES = $(pkgextension_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
-filefuncs_la_DEPENDENCIES = $(am__DEPENDENCIES_2)
-am_filefuncs_la_OBJECTS = filefuncs.lo stack.lo gawkfts.lo
-filefuncs_la_OBJECTS = $(am_filefuncs_la_OBJECTS)
+errno_la_DEPENDENCIES = $(am__DEPENDENCIES_2)
+am_errno_la_OBJECTS = errno.lo
+errno_la_OBJECTS = $(am_errno_la_OBJECTS)
 AM_V_lt = $(address@hidden@)
 am__v_lt_ = $(address@hidden@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
+errno_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(errno_la_LDFLAGS) $(LDFLAGS) -o $@
+filefuncs_la_DEPENDENCIES = $(am__DEPENDENCIES_2)
+am_filefuncs_la_OBJECTS = filefuncs.lo stack.lo gawkfts.lo
+filefuncs_la_OBJECTS = $(am_filefuncs_la_OBJECTS)
 filefuncs_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
        $(filefuncs_la_LDFLAGS) $(LDFLAGS) -o $@
@@ -255,18 +261,18 @@ AM_V_CCLD = $(address@hidden@)
 am__v_CCLD_ = $(address@hidden@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(filefuncs_la_SOURCES) $(fnmatch_la_SOURCES) \
-       $(fork_la_SOURCES) $(inplace_la_SOURCES) $(ordchr_la_SOURCES) \
-       $(readdir_la_SOURCES) $(readfile_la_SOURCES) \
-       $(revoutput_la_SOURCES) $(revtwoway_la_SOURCES) \
-       $(rwarray_la_SOURCES) $(select_la_SOURCES) \
-       $(testext_la_SOURCES) $(time_la_SOURCES)
-DIST_SOURCES = $(filefuncs_la_SOURCES) $(fnmatch_la_SOURCES) \
-       $(fork_la_SOURCES) $(inplace_la_SOURCES) $(ordchr_la_SOURCES) \
-       $(readdir_la_SOURCES) $(readfile_la_SOURCES) \
-       $(revoutput_la_SOURCES) $(revtwoway_la_SOURCES) \
-       $(rwarray_la_SOURCES) $(select_la_SOURCES) \
-       $(testext_la_SOURCES) $(time_la_SOURCES)
+SOURCES = $(errno_la_SOURCES) $(filefuncs_la_SOURCES) \
+       $(fnmatch_la_SOURCES) $(fork_la_SOURCES) $(inplace_la_SOURCES) \
+       $(ordchr_la_SOURCES) $(readdir_la_SOURCES) \
+       $(readfile_la_SOURCES) $(revoutput_la_SOURCES) \
+       $(revtwoway_la_SOURCES) $(rwarray_la_SOURCES) \
+       $(select_la_SOURCES) $(testext_la_SOURCES) $(time_la_SOURCES)
+DIST_SOURCES = $(errno_la_SOURCES) $(filefuncs_la_SOURCES) \
+       $(fnmatch_la_SOURCES) $(fork_la_SOURCES) $(inplace_la_SOURCES) \
+       $(ordchr_la_SOURCES) $(readdir_la_SOURCES) \
+       $(readfile_la_SOURCES) $(revoutput_la_SOURCES) \
+       $(revtwoway_la_SOURCES) $(rwarray_la_SOURCES) \
+       $(select_la_SOURCES) $(testext_la_SOURCES) $(time_la_SOURCES)
 RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
        ctags-recursive dvi-recursive html-recursive info-recursive \
        install-data-recursive install-dvi-recursive \
@@ -495,6 +501,7 @@ ACLOCAL_AMFLAGS = -I m4
 
 # Note: rwarray does not currently compile.
 pkgextension_LTLIBRARIES = \
+       errno.la        \
        filefuncs.la    \
        fnmatch.la      \
        fork.la         \
@@ -512,6 +519,9 @@ pkgextension_LTLIBRARIES = \
 MY_MODULE_FLAGS = -module -avoid-version -no-undefined
 # on Cygwin, gettext requires that we link with -lintl 
 MY_LIBS = $(LTLIBINTL)
+errno_la_SOURCES = errno.c
+errno_la_LDFLAGS = $(MY_MODULE_FLAGS)
+errno_la_LIBADD = $(MY_LIBS)
 filefuncs_la_SOURCES = filefuncs.c stack.h stack.c gawkfts.h \
                        gawkfts.c gawkdirfd.h
 
@@ -529,9 +539,6 @@ inplace_la_LIBADD = $(MY_LIBS)
 ordchr_la_SOURCES = ordchr.c
 ordchr_la_LDFLAGS = $(MY_MODULE_FLAGS)
 ordchr_la_LIBADD = $(MY_LIBS)
-select_la_SOURCES = select.c
-select_la_LDFLAGS = $(MY_MODULE_FLAGS)
-select_la_LIBADD = $(MY_LIBS)
 readdir_la_SOURCES = readdir.c gawkdirfd.h
 readdir_la_LDFLAGS = $(MY_MODULE_FLAGS)
 readdir_la_LIBADD = $(MY_LIBS)
@@ -547,6 +554,9 @@ revtwoway_la_LIBADD = $(MY_LIBS)
 rwarray_la_SOURCES = rwarray.c
 rwarray_la_LDFLAGS = $(MY_MODULE_FLAGS)
 rwarray_la_LIBADD = $(MY_LIBS)
+select_la_SOURCES = select.c
+select_la_LDFLAGS = $(MY_MODULE_FLAGS)
+select_la_LIBADD = $(MY_LIBS)
 time_la_SOURCES = time.c
 time_la_LDFLAGS = $(MY_MODULE_FLAGS)
 time_la_LIBADD = $(MY_LIBS)
@@ -656,6 +666,8 @@ clean-pkgextensionLTLIBRARIES:
          echo rm -f $${locs}; \
          rm -f $${locs}; \
        }
+errno.la: $(errno_la_OBJECTS) $(errno_la_DEPENDENCIES) 
$(EXTRA_errno_la_DEPENDENCIES) 
+       $(AM_V_CCLD)$(errno_la_LINK) -rpath $(pkgextensiondir) 
$(errno_la_OBJECTS) $(errno_la_LIBADD) $(LIBS)
 filefuncs.la: $(filefuncs_la_OBJECTS) $(filefuncs_la_DEPENDENCIES) 
$(EXTRA_filefuncs_la_DEPENDENCIES) 
        $(AM_V_CCLD)$(filefuncs_la_LINK) -rpath $(pkgextensiondir) 
$(filefuncs_la_OBJECTS) $(filefuncs_la_LIBADD) $(LIBS)
 fnmatch.la: $(fnmatch_la_OBJECTS) $(fnmatch_la_DEPENDENCIES) 
$(EXTRA_fnmatch_la_DEPENDENCIES) 
@@ -689,6 +701,7 @@ mostlyclean-compile:
 distclean-compile:
        -rm -f *.tab.c
 
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
diff --git a/extension/errlist.h b/extension/errlist.h
new file mode 100644
index 0000000..caa6d63
--- /dev/null
+++ b/extension/errlist.h
@@ -0,0 +1,455 @@
+/*
+ * errlist.h - List of errno values.
+ */
+
+/*
+ * Copyright (C) 2013 the Free Software Foundation, Inc.
+ * 
+ * This file is part of GAWK, the GNU implementation of the
+ * AWK Programming Language.
+ * 
+ * GAWK is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * GAWK is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
+ */
+
+#ifdef E2BIG
+init_errno (E2BIG, "E2BIG")
+#endif
+#ifdef EACCES
+init_errno (EACCES, "EACCES")
+#endif
+#ifdef EADDRINUSE
+init_errno (EADDRINUSE, "EADDRINUSE")
+#endif
+#ifdef EADDRNOTAVAIL
+init_errno (EADDRNOTAVAIL, "EADDRNOTAVAIL")
+#endif
+#ifdef EADV
+init_errno (EADV, "EADV")
+#endif
+#ifdef EAFNOSUPPORT
+init_errno (EAFNOSUPPORT, "EAFNOSUPPORT")
+#endif
+#ifdef EAGAIN
+init_errno (EAGAIN, "EAGAIN")
+#endif
+#ifdef EALREADY
+init_errno (EALREADY, "EALREADY")
+#endif
+#ifdef EAUTH
+init_errno (EAUTH, "EAUTH")
+#endif
+#ifdef EBADE
+init_errno (EBADE, "EBADE")
+#endif
+#ifdef EBADF
+init_errno (EBADF, "EBADF")
+#endif
+#ifdef EBADFD
+init_errno (EBADFD, "EBADFD")
+#endif
+#ifdef EBADMSG
+init_errno (EBADMSG, "EBADMSG")
+#endif
+#ifdef EBADR
+init_errno (EBADR, "EBADR")
+#endif
+#ifdef EBADRPC
+init_errno (EBADRPC, "EBADRPC")
+#endif
+#ifdef EBADRQC
+init_errno (EBADRQC, "EBADRQC")
+#endif
+#ifdef EBADSLT
+init_errno (EBADSLT, "EBADSLT")
+#endif
+#ifdef EBFONT
+init_errno (EBFONT, "EBFONT")
+#endif
+#ifdef EBUSY
+init_errno (EBUSY, "EBUSY")
+#endif
+#ifdef ECANCELED
+init_errno (ECANCELED, "ECANCELED")
+#endif
+#ifdef ECHILD
+init_errno (ECHILD, "ECHILD")
+#endif
+#ifdef ECHRNG
+init_errno (ECHRNG, "ECHRNG")
+#endif
+#ifdef ECOMM
+init_errno (ECOMM, "ECOMM")
+#endif
+#ifdef ECONNABORTED
+init_errno (ECONNABORTED, "ECONNABORTED")
+#endif
+#ifdef ECONNREFUSED
+init_errno (ECONNREFUSED, "ECONNREFUSED")
+#endif
+#ifdef ECONNRESET
+init_errno (ECONNRESET, "ECONNRESET")
+#endif
+#ifdef EDEADLK
+init_errno (EDEADLK, "EDEADLK")
+#endif
+#ifdef EDEADLOCK
+#if !defined(EDEADLK) || (EDEADLK != EDEADLOCK)
+init_errno (EDEADLOCK, "EDEADLOCK")
+#endif
+#endif
+#ifdef EDESTADDRREQ
+init_errno (EDESTADDRREQ, "EDESTADDRREQ")
+#endif
+#ifdef EDOM
+init_errno (EDOM, "EDOM")
+#endif
+#ifdef EDOTDOT
+init_errno (EDOTDOT, "EDOTDOT")
+#endif
+#ifdef EDQUOT
+init_errno (EDQUOT, "EDQUOT")
+#endif
+#ifdef EEXIST
+init_errno (EEXIST, "EEXIST")
+#endif
+#ifdef EFAULT
+init_errno (EFAULT, "EFAULT")
+#endif
+#ifdef EFBIG
+init_errno (EFBIG, "EFBIG")
+#endif
+#ifdef EFTYPE
+init_errno (EFTYPE, "EFTYPE")
+#endif
+#ifdef EHOSTDOWN
+init_errno (EHOSTDOWN, "EHOSTDOWN")
+#endif
+#ifdef EHOSTUNREACH
+init_errno (EHOSTUNREACH, "EHOSTUNREACH")
+#endif
+#ifdef EIDRM
+init_errno (EIDRM, "EIDRM")
+#endif
+#ifdef EILSEQ
+init_errno (EILSEQ, "EILSEQ")
+#endif
+#ifdef EINPROGRESS
+init_errno (EINPROGRESS, "EINPROGRESS")
+#endif
+#ifdef EINTR
+init_errno (EINTR, "EINTR")
+#endif
+#ifdef EINVAL
+init_errno (EINVAL, "EINVAL")
+#endif
+#ifdef EIO
+init_errno (EIO, "EIO")
+#endif
+#ifdef EISCONN
+init_errno (EISCONN, "EISCONN")
+#endif
+#ifdef EISDIR
+init_errno (EISDIR, "EISDIR")
+#endif
+#ifdef EISNAM
+init_errno (EISNAM, "EISNAM")
+#endif
+#ifdef EKEYEXPIRED
+init_errno (EKEYEXPIRED, "EKEYEXPIRED")
+#endif
+#ifdef EKEYREJECTED
+init_errno (EKEYREJECTED, "EKEYREJECTED")
+#endif
+#ifdef EKEYREVOKED
+init_errno (EKEYREVOKED, "EKEYREVOKED")
+#endif
+#ifdef EL2HLT
+init_errno (EL2HLT, "EL2HLT")
+#endif
+#ifdef EL2NSYNC
+init_errno (EL2NSYNC, "EL2NSYNC")
+#endif
+#ifdef EL3HLT
+init_errno (EL3HLT, "EL3HLT")
+#endif
+#ifdef EL3RST
+init_errno (EL3RST, "EL3RST")
+#endif
+#ifdef ELAST
+init_errno (ELAST, "ELAST")
+#endif
+#ifdef ELIBACC
+init_errno (ELIBACC, "ELIBACC")
+#endif
+#ifdef ELIBBAD
+init_errno (ELIBBAD, "ELIBBAD")
+#endif
+#ifdef ELIBEXEC
+init_errno (ELIBEXEC, "ELIBEXEC")
+#endif
+#ifdef ELIBMAX
+init_errno (ELIBMAX, "ELIBMAX")
+#endif
+#ifdef ELIBSCN
+init_errno (ELIBSCN, "ELIBSCN")
+#endif
+#ifdef ELNRNG
+init_errno (ELNRNG, "ELNRNG")
+#endif
+#ifdef ELOOP
+init_errno (ELOOP, "ELOOP")
+#endif
+#ifdef EMEDIUMTYPE
+init_errno (EMEDIUMTYPE, "EMEDIUMTYPE")
+#endif
+#ifdef EMFILE
+init_errno (EMFILE, "EMFILE")
+#endif
+#ifdef EMLINK
+init_errno (EMLINK, "EMLINK")
+#endif
+#ifdef EMSGSIZE
+init_errno (EMSGSIZE, "EMSGSIZE")
+#endif
+#ifdef EMULTIHOP
+init_errno (EMULTIHOP, "EMULTIHOP")
+#endif
+#ifdef ENAMETOOLONG
+init_errno (ENAMETOOLONG, "ENAMETOOLONG")
+#endif
+#ifdef ENAVAIL
+init_errno (ENAVAIL, "ENAVAIL")
+#endif
+#ifdef ENEEDAUTH
+init_errno (ENEEDAUTH, "ENEEDAUTH")
+#endif
+#ifdef ENETDOWN
+init_errno (ENETDOWN, "ENETDOWN")
+#endif
+#ifdef ENETRESET
+init_errno (ENETRESET, "ENETRESET")
+#endif
+#ifdef ENETUNREACH
+init_errno (ENETUNREACH, "ENETUNREACH")
+#endif
+#ifdef ENFILE
+init_errno (ENFILE, "ENFILE")
+#endif
+#ifdef ENOANO
+init_errno (ENOANO, "ENOANO")
+#endif
+#ifdef ENOBUFS
+init_errno (ENOBUFS, "ENOBUFS")
+#endif
+#ifdef ENOCSI
+init_errno (ENOCSI, "ENOCSI")
+#endif
+#ifdef ENODATA
+init_errno (ENODATA, "ENODATA")
+#endif
+#ifdef ENODEV
+init_errno (ENODEV, "ENODEV")
+#endif
+#ifdef ENOENT
+init_errno (ENOENT, "ENOENT")
+#endif
+#ifdef ENOEXEC
+init_errno (ENOEXEC, "ENOEXEC")
+#endif
+#ifdef ENOKEY
+init_errno (ENOKEY, "ENOKEY")
+#endif
+#ifdef ENOLCK
+init_errno (ENOLCK, "ENOLCK")
+#endif
+#ifdef ENOLINK
+init_errno (ENOLINK, "ENOLINK")
+#endif
+#ifdef ENOMEDIUM
+init_errno (ENOMEDIUM, "ENOMEDIUM")
+#endif
+#ifdef ENOMEM
+init_errno (ENOMEM, "ENOMEM")
+#endif
+#ifdef ENOMSG
+init_errno (ENOMSG, "ENOMSG")
+#endif
+#ifdef ENONET
+init_errno (ENONET, "ENONET")
+#endif
+#ifdef ENOPKG
+init_errno (ENOPKG, "ENOPKG")
+#endif
+#ifdef ENOPROTOOPT
+init_errno (ENOPROTOOPT, "ENOPROTOOPT")
+#endif
+#ifdef ENOSPC
+init_errno (ENOSPC, "ENOSPC")
+#endif
+#ifdef ENOSR
+init_errno (ENOSR, "ENOSR")
+#endif
+#ifdef ENOSTR
+init_errno (ENOSTR, "ENOSTR")
+#endif
+#ifdef ENOSYS
+init_errno (ENOSYS, "ENOSYS")
+#endif
+#ifdef ENOTBLK
+init_errno (ENOTBLK, "ENOTBLK")
+#endif
+#ifdef ENOTCONN
+init_errno (ENOTCONN, "ENOTCONN")
+#endif
+#ifdef ENOTDIR
+init_errno (ENOTDIR, "ENOTDIR")
+#endif
+#ifdef ENOTEMPTY
+init_errno (ENOTEMPTY, "ENOTEMPTY")
+#endif
+#ifdef ENOTNAM
+init_errno (ENOTNAM, "ENOTNAM")
+#endif
+#ifdef ENOTRECOVERABLE
+init_errno (ENOTRECOVERABLE, "ENOTRECOVERABLE")
+#endif
+#ifdef ENOTSOCK
+init_errno (ENOTSOCK, "ENOTSOCK")
+#endif
+#ifdef ENOTTY
+init_errno (ENOTTY, "ENOTTY")
+#endif
+#ifdef ENOTUNIQ
+init_errno (ENOTUNIQ, "ENOTUNIQ")
+#endif
+#ifdef ENXIO
+init_errno (ENXIO, "ENXIO")
+#endif
+#ifdef EOPNOTSUPP
+init_errno (EOPNOTSUPP, "EOPNOTSUPP")
+#endif
+#ifdef EOVERFLOW
+init_errno (EOVERFLOW, "EOVERFLOW")
+#endif
+#ifdef EOWNERDEAD
+init_errno (EOWNERDEAD, "EOWNERDEAD")
+#endif
+#ifdef EPERM
+init_errno (EPERM, "EPERM")
+#endif
+#ifdef EPFNOSUPPORT
+init_errno (EPFNOSUPPORT, "EPFNOSUPPORT")
+#endif
+#ifdef EPIPE
+init_errno (EPIPE, "EPIPE")
+#endif
+#ifdef EPROCLIM
+init_errno (EPROCLIM, "EPROCLIM")
+#endif
+#ifdef EPROCUNAVAIL
+init_errno (EPROCUNAVAIL, "EPROCUNAVAIL")
+#endif
+#ifdef EPROGMISMATCH
+init_errno (EPROGMISMATCH, "EPROGMISMATCH")
+#endif
+#ifdef EPROGUNAVAIL
+init_errno (EPROGUNAVAIL, "EPROGUNAVAIL")
+#endif
+#ifdef EPROTO
+init_errno (EPROTO, "EPROTO")
+#endif
+#ifdef EPROTONOSUPPORT
+init_errno (EPROTONOSUPPORT, "EPROTONOSUPPORT")
+#endif
+#ifdef EPROTOTYPE
+init_errno (EPROTOTYPE, "EPROTOTYPE")
+#endif
+#ifdef ERANGE
+init_errno (ERANGE, "ERANGE")
+#endif
+#ifdef EREMCHG
+init_errno (EREMCHG, "EREMCHG")
+#endif
+#ifdef EREMOTE
+init_errno (EREMOTE, "EREMOTE")
+#endif
+#ifdef EREMOTEIO
+init_errno (EREMOTEIO, "EREMOTEIO")
+#endif
+#ifdef ERESTART
+init_errno (ERESTART, "ERESTART")
+#endif
+#ifdef ERFKILL
+init_errno (ERFKILL, "ERFKILL")
+#endif
+#ifdef EROFS
+init_errno (EROFS, "EROFS")
+#endif
+#ifdef ERPCMISMATCH
+init_errno (ERPCMISMATCH, "ERPCMISMATCH")
+#endif
+#ifdef ESHUTDOWN
+init_errno (ESHUTDOWN, "ESHUTDOWN")
+#endif
+#ifdef ESOCKTNOSUPPORT
+init_errno (ESOCKTNOSUPPORT, "ESOCKTNOSUPPORT")
+#endif
+#ifdef ESPIPE
+init_errno (ESPIPE, "ESPIPE")
+#endif
+#ifdef ESRCH
+init_errno (ESRCH, "ESRCH")
+#endif
+#ifdef ESRMNT
+init_errno (ESRMNT, "ESRMNT")
+#endif
+#ifdef ESTALE
+init_errno (ESTALE, "ESTALE")
+#endif
+#ifdef ESTRPIPE
+init_errno (ESTRPIPE, "ESTRPIPE")
+#endif
+#ifdef ETIME
+init_errno (ETIME, "ETIME")
+#endif
+#ifdef ETIMEDOUT
+init_errno (ETIMEDOUT, "ETIMEDOUT")
+#endif
+#ifdef ETOOMANYREFS
+init_errno (ETOOMANYREFS, "ETOOMANYREFS")
+#endif
+#ifdef ETXTBSY
+init_errno (ETXTBSY, "ETXTBSY")
+#endif
+#ifdef EUCLEAN
+init_errno (EUCLEAN, "EUCLEAN")
+#endif
+#ifdef EUNATCH
+init_errno (EUNATCH, "EUNATCH")
+#endif
+#ifdef EUSERS
+init_errno (EUSERS, "EUSERS")
+#endif
+#ifdef EWOULDBLOCK
+#if !defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)
+init_errno (EWOULDBLOCK, "EWOULDBLOCK")
+#endif
+#endif
+#ifdef EXDEV
+init_errno (EXDEV, "EXDEV")
+#endif
+#ifdef EXFULL
+init_errno (EXFULL, "EXFULL")
+#endif
diff --git a/extension/errno.c b/extension/errno.c
new file mode 100644
index 0000000..2eafa43
--- /dev/null
+++ b/extension/errno.c
@@ -0,0 +1,145 @@
+/*
+ * errno.c - Builtin functions to map errno values.
+ */
+
+/*
+ * Copyright (C) 2013 the Free Software Foundation, Inc.
+ * 
+ * This file is part of GAWK, the GNU implementation of the
+ * AWK Programming Language.
+ * 
+ * GAWK is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * GAWK is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "gawkapi.h"
+
+#include "gettext.h"
+#define _(msgid)  gettext(msgid)
+#define N_(msgid) msgid
+
+static const gawk_api_t *api;  /* for convenience macros to work */
+static awk_ext_id_t *ext_id;
+static const char *ext_version = "errno extension: version 1.0";
+static awk_bool_t (*init_func)(void) = NULL;
+
+int plugin_is_GPL_compatible;
+
+static const char *const errno2name[] = {
+#define init_errno(A, B) [A] = B,
+#include "errlist.h"
+#undef init_errno
+};
+#define NUMERR sizeof(errno2name)/sizeof(errno2name[0])
+
+/*  do_strerror --- call strerror */
+
+static awk_value_t *
+do_strerror(int nargs, awk_value_t *result)
+{
+       awk_value_t errnum;
+
+       if (do_lint && nargs > 1)
+               lintwarn(ext_id, _("strerror: called with too many arguments"));
+
+       if (get_argument(0, AWK_NUMBER, & errnum)) {
+               const char *str = gettext(strerror(errnum.num_value));
+               return make_const_string(str, strlen(str), result);
+       }
+       if (do_lint) {
+               if (nargs == 0)
+                       lintwarn(ext_id, _("strerror: called with no 
arguments"));
+               else
+                       lintwarn(ext_id, _("strerror: called with inappropriate 
argument(s)"));
+       }
+       return make_null_string(result);
+}
+
+/*  do_errno2name --- convert an integer errno value to it's symbolic name */
+
+static awk_value_t *
+do_errno2name(int nargs, awk_value_t *result)
+{
+       awk_value_t errnum;
+       const char *str;
+
+       if (do_lint && nargs > 1)
+               lintwarn(ext_id, _("errno2name: called with too many 
arguments"));
+
+       if (get_argument(0, AWK_NUMBER, & errnum)) {
+               int i = errnum.num_value;
+
+               if ((i == errnum.num_value) && (i >= 0) && ((size_t)i < NUMERR) 
&& errno2name[i])
+                       return make_const_string(errno2name[i], 
strlen(errno2name[i]), result);
+               warning(ext_id, _("errno2name: called with invalid argument"));
+       } else if (do_lint) {
+               if (nargs == 0)
+                       lintwarn(ext_id, _("errno2name: called with no 
arguments"));
+               else
+                       lintwarn(ext_id, _("errno2name: called with 
inappropriate argument(s)"));
+       }
+       return make_null_string(result);
+}
+
+/*  do_name2errno --- convert a symbolic errno name to an integer */
+
+static awk_value_t *
+do_name2errno(int nargs, awk_value_t *result)
+{
+       awk_value_t err;
+       const char *str;
+
+       if (do_lint && nargs > 1)
+               lintwarn(ext_id, _("name2errno: called with too many 
arguments"));
+
+       if (get_argument(0, AWK_STRING, & err)) {
+               size_t i;
+
+               for (i = 0; i < NUMERR; i++) {
+                       if (errno2name[i] && ! strcasecmp(err.str_value.str, 
errno2name[i]))
+                               return make_number(i, result);
+               }
+               warning(ext_id, _("name2errno: called with invalid argument"));
+       } else if (do_lint) {
+               if (nargs == 0)
+                       lintwarn(ext_id, _("name2errno: called with no 
arguments"));
+               else
+                       lintwarn(ext_id, _("name2errno: called with 
inappropriate argument(s)"));
+       }
+       return make_number(-1, result);
+}
+
+static awk_ext_func_t func_table[] = {
+       { "strerror", do_strerror, 1 },
+       { "errno2name", do_errno2name, 1 },
+       { "name2errno", do_name2errno, 1 },
+};
+
+/* define the dl_load function using the boilerplate macro */
+
+dl_load_func(func_table, errno, "")
diff --git a/extension/select.c b/extension/select.c
index 8729a59..6211635 100644
--- a/extension/select.c
+++ b/extension/select.c
@@ -45,7 +45,7 @@
 
 static const gawk_api_t *api;  /* for convenience macros to work */
 static awk_ext_id_t *ext_id;
-static const char *ext_version = "ordchr extension: version 1.0";
+static const char *ext_version = "select extension: version 1.0";
 static awk_bool_t (*init_func)(void) = NULL;
 
 int plugin_is_GPL_compatible;
diff --git a/extension/siglist.h b/extension/siglist.h
index dacd4a1..7ecb8ab 100644
--- a/extension/siglist.h
+++ b/extension/siglist.h
@@ -1,5 +1,5 @@
 /* Canonical list of all signal names.
-   Copyright (C) 1996,97,98,99 Free Software Foundation, Inc.
+   Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -13,9 +13,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 /* This file should be usable for any platform, since it just associates
    the SIG* macros with text names and descriptions.  The actual values
@@ -51,7 +50,6 @@
   init_sig (SIGXFSZ, "XFSZ", N_("File size limit exceeded"))
   init_sig (SIGVTALRM, "VTALRM", N_("Virtual timer expired"))
   init_sig (SIGPROF, "PROF", N_("Profiling timer expired"))
-  init_sig (SIGWINCH, "WINCH", N_("Window changed"))
   init_sig (SIGUSR1, "USR1", N_("User defined signal 1"))
   init_sig (SIGUSR2, "USR2", N_("User defined signal 2"))
 
@@ -73,3 +71,6 @@
 #ifdef SIGLOST
   init_sig (SIGLOST, "LOST", N_("Resource lost"))
 #endif
+#ifdef SIGWINCH
+  init_sig (SIGWINCH, "WINCH", N_("Window changed"))
+#endif

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog             |    4 +
 eval.c                |    2 +
 extension/ChangeLog   |   12 ++
 extension/Makefile.am |   13 +-
 extension/Makefile.in |   49 ++++--
 extension/errlist.h   |  455 +++++++++++++++++++++++++++++++++++++++++++++++++
 extension/errno.c     |  145 ++++++++++++++++
 extension/select.c    |    2 +-
 extension/siglist.h   |   11 +-
 9 files changed, 665 insertions(+), 28 deletions(-)
 create mode 100644 extension/errlist.h
 create mode 100644 extension/errno.c


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]