gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, xgawk-build, updated. 920b87dfab2e0504c8


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, xgawk-build, updated. 920b87dfab2e0504c8a1eb26eb6f130bcb748218
Date: Sun, 01 Apr 2012 21:08:13 +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, xgawk-build has been updated
       via  920b87dfab2e0504c8a1eb26eb6f130bcb748218 (commit)
      from  ca6df261b71a738b4f0d0719f79cacee008a16c5 (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=920b87dfab2e0504c8a1eb26eb6f130bcb748218

commit 920b87dfab2e0504c8a1eb26eb6f130bcb748218
Author: Andrew J. Schorr <address@hidden>
Date:   Sun Apr 1 17:07:56 2012 -0400

    Update ERRNO API.

diff --git a/ChangeLog b/ChangeLog
index c9804d7..f9786df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,19 @@
-2012-03-27         Andrew J. Schorr     <address@hidden>
-
-       * .gitignore: Add libtool, since this is created by configure.
-       * libtool: Remove from repo.
+2012-04-01         Andrew J. Schorr     <address@hidden>
+
+       * TODO.xgawk: Move ERRNO item into "done" section.
+       * awk.h (update_ERRNO, update_ERRNO_saved): Remove declarations.
+       (update_ERRNO_int, enum errno_translate, update_ERRNO_string,
+       unset_ERRNO): Add new declarations.
+       * eval.c (update_ERRNO_saved): Renamed to update_ERRNO_int.
+       (update_ERRNO_string, unset_ERRNO): New functions.
+       * ext.c (do_ext): Use new update_ERRNO_string function.
+       * io.c (ERRNO_node): Remove redundant extern declaration (in awk.h).
+       (after_beginfile, nextfile): Replace update_ERRNO() with
+       update_ERRNO_int(errno).
+       (inrec): Replace update_ERRNO_saved with update_ERRNO_int.
+       (do_close): Use new function update_ERRNO_string.
+       (close_redir, do_getline_redir, do_getline): Replace update_ERRNO_saved
+       with update_ERRNO_int.
 
 2012-03-27         Andrew J. Schorr     <address@hidden>
 
diff --git a/TODO.xgawk b/TODO.xgawk
index 0198a45..56b13e1 100644
--- a/TODO.xgawk
+++ b/TODO.xgawk
@@ -13,6 +13,12 @@ Done:
 
 - Implement @load
 
+- Patch ERRNO handling to create a simple API for use by extensions:
+   extern void update_ERRNO_int(int)
+   enum errno_translate { TRANSLATE, DONT_TRANSLATE };
+   extern void update_ERRNO_string(const char *string, enum errno_translate);
+   extern void unset_ERRNO(void);
+
 
 To do (not necessarily in this order):
 
@@ -49,12 +55,6 @@ To do (not necessarily in this order):
 
 - Add tests for standard extensions.
 
-- Patch ERRNO handling to create a simple API for use by extensions:
-   extern void update_ERRNO_int(int)
-   enum errno_translate { TRANSLATE, DONT_TRANSLATE };
-   extern void update_ERRNO_string(const char *string, enum errno_translate);
-   extern void unset_ERRNO(void);
-
 - Develop a libgawk shared library for use by extensions.  In particular,
   a few existing extensions use a hash API for mapping string handles to
   structures.  In xgawk, we had this API inside array.c, but it probably
diff --git a/awk.h b/awk.h
index d670780..26c8717 100644
--- a/awk.h
+++ b/awk.h
@@ -1376,8 +1376,10 @@ extern void set_CONVFMT(void);
 extern void set_BINMODE(void);
 extern void set_LINT(void);
 extern void set_TEXTDOMAIN(void);
-extern void update_ERRNO(void);
-extern void update_ERRNO_saved(int);
+extern void update_ERRNO_int(int);
+enum errno_translate { TRANSLATE, DONT_TRANSLATE };
+extern void update_ERRNO_string(const char *string, enum errno_translate);
+extern void unset_ERRNO(void);
 extern void update_NR(void);
 extern void update_NF(void);
 extern void update_FNR(void);
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 815644c..568d7c7 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,10 @@
+2012-04-01         Andrew J. Schorr     <address@hidden>
+
+       * gawk.texi: Replace documentation of removed functions update_ERRNO and
+       update_ERRNO_saved with descriptions new functions update_ERRNO_int,
+       update_ERRNO_string and unset_ERRNO.  And fix a couple of examples
+       to use update_ERRNO_int instead of update_ERRNO.
+
 2012-03-26         Arnold D. Robbins     <address@hidden>
 
        * gawk.texi: Minor style edits.
diff --git a/doc/gawk.info b/doc/gawk.info
index 8e27f4a..75e1f48 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -22046,16 +22046,22 @@ when writing extensions.  The next minor node shows 
how they are used:
 `get_array_argument(i, opt)'
      This is a convenience macro that calls `get_actual_argument()'.
 
-`void update_ERRNO(void)'
-     This function is called from within a C extension function to set
-     the value of `gawk''s `ERRNO' variable, based on the current value
-     of the C `errno' global variable.  It is provided as a convenience.
-
-`void update_ERRNO_saved(int errno_saved)'
+`void update_ERRNO_int(int errno_saved)'
      This function is called from within a C extension function to set
      the value of `gawk''s `ERRNO' variable, based on the error value
      provided as the argument.  It is provided as a convenience.
 
+`void update_ERRNO_string(const char *string, enum errno_translate)'
+     This function is called from within a C extension function to set
+     the value of `gawk''s `ERRNO' variable to a given string.  The
+     second argument determines whether the string is translated before
+     being installed into `ERRNO'.  It is provided as a convenience.
+
+`void unset_ERRNO(void)'
+     This function is called from within a C extension function to set
+     the value of `gawk''s `ERRNO' variable to a null string.  It is
+     provided as a convenience.
+
 `void register_deferred_variable(const char *name, NODE *(*load_func)(void))'
      This function is called to register a function to be called when a
      reference to an undefined variable with the given name is
@@ -22361,7 +22367,7 @@ system call. If the `chdir()' fails, `ERRNO' is updated.
          (void) force_string(newdir);
          ret = chdir(newdir->stptr);
          if (ret < 0)
-             update_ERRNO();
+             update_ERRNO_int(errno);
 
    Finally, the function returns the return value to the `awk' level:
 
@@ -22414,7 +22420,7 @@ link.  If there's an error, it sets `ERRNO' and returns:
          (void) force_string(file);
          ret = lstat(file->stptr, & sbuf);
          if (ret < 0) {
-             update_ERRNO();
+             update_ERRNO_int(errno);
              return make_number((AWKNUM) ret);
          }
 
@@ -25519,7 +25525,7 @@ Index
 * close() function, two-way pipes and:   Two-way I/O.         (line  77)
 * Close, Diane <1>:                      Contributors.        (line  21)
 * Close, Diane:                          Manual History.      (line  41)
-* close_func() input method:             Internals.           (line 151)
+* close_func() input method:             Internals.           (line 157)
 * collating elements:                    Bracket Expressions. (line  69)
 * collating symbols:                     Bracket Expressions. (line  76)
 * Colombo, Antonio:                      Acknowledgments.     (line  60)
@@ -25936,7 +25942,7 @@ Index
 * endgrent() user-defined function:      Group Functions.     (line 218)
 * endpwent() function (C library):       Passwd Functions.    (line 210)
 * endpwent() user-defined function:      Passwd Functions.    (line 213)
-* ENVIRON array <1>:                     Internals.           (line 140)
+* ENVIRON array <1>:                     Internals.           (line 146)
 * ENVIRON array:                         Auto-set.            (line  60)
 * environment variables:                 Auto-set.            (line  60)
 * epoch, definition of:                  Glossary.            (line 239)
@@ -25994,7 +26000,7 @@ Index
                                                               (line   9)
 * expressions, selecting:                Conditional Exp.     (line   6)
 * Extended Regular Expressions (EREs):   Bracket Expressions. (line  24)
-* eXtensible Markup Language (XML):      Internals.           (line 151)
+* eXtensible Markup Language (XML):      Internals.           (line 157)
 * extension() function (gawk):           Using Internal File Ops.
                                                               (line  15)
 * extensions, Brian Kernighan's awk <1>: Other Versions.      (line  13)
@@ -26335,7 +26341,7 @@ Index
 * get_actual_argument() internal function: Internals.         (line 116)
 * get_argument() internal function:      Internals.           (line 111)
 * get_array_argument() internal macro:   Internals.           (line 127)
-* get_record() input method:             Internals.           (line 151)
+* get_record() input method:             Internals.           (line 157)
 * get_scalar_argument() internal macro:  Internals.           (line 124)
 * getaddrinfo() function (C library):    TCP/IP Networking.   (line  38)
 * getgrent() function (C library):       Group Functions.     (line   6)
@@ -26489,7 +26495,7 @@ Index
 * integers:                              Basic Data Typing.   (line  21)
 * integers, unsigned:                    Basic Data Typing.   (line  30)
 * interacting with other programs:       I/O Functions.       (line  63)
-* internal constant, INVALID_HANDLE:     Internals.           (line 151)
+* internal constant, INVALID_HANDLE:     Internals.           (line 157)
 * internal function, assoc_clear():      Internals.           (line  68)
 * internal function, assoc_lookup():     Internals.           (line  72)
 * internal function, dupnode():          Internals.           (line  87)
@@ -26498,18 +26504,19 @@ Index
 * internal function, force_wstring():    Internals.           (line  37)
 * internal function, get_actual_argument(): Internals.        (line 116)
 * internal function, get_argument():     Internals.           (line 111)
-* internal function, iop_alloc():        Internals.           (line 151)
+* internal function, iop_alloc():        Internals.           (line 157)
 * internal function, make_builtin():     Internals.           (line  97)
 * internal function, make_number():      Internals.           (line  82)
 * internal function, make_string():      Internals.           (line  77)
-* internal function, register_deferred_variable(): Internals. (line 140)
-* internal function, register_open_hook(): Internals.         (line 151)
+* internal function, register_deferred_variable(): Internals. (line 146)
+* internal function, register_open_hook(): Internals.         (line 157)
 * internal function, unref():            Internals.           (line  92)
-* internal function, update_ERRNO():     Internals.           (line 130)
-* internal function, update_ERRNO_saved(): Internals.         (line 135)
+* internal function, unset_ERRNO():      Internals.           (line 141)
+* internal function, update_ERRNO_int(): Internals.           (line 130)
+* internal function, update_ERRNO_string(): Internals.        (line 135)
 * internal macro, get_array_argument():  Internals.           (line 127)
 * internal macro, get_scalar_argument(): Internals.           (line 124)
-* internal structure, IOBUF:             Internals.           (line 151)
+* internal structure, IOBUF:             Internals.           (line 157)
 * internal type, AWKNUM:                 Internals.           (line  19)
 * internal type, NODE:                   Internals.           (line  23)
 * internal variable, nargs:              Internals.           (line  42)
@@ -26538,10 +26545,10 @@ Index
 * interpreted programs <1>:              Glossary.            (line 361)
 * interpreted programs:                  Basic High Level.    (line  14)
 * interval expressions:                  Regexp Operators.    (line 116)
-* INVALID_HANDLE internal constant:      Internals.           (line 151)
+* INVALID_HANDLE internal constant:      Internals.           (line 157)
 * inventory-shipped file:                Sample Data Files.   (line  32)
-* IOBUF internal structure:              Internals.           (line 151)
-* iop_alloc() internal function:         Internals.           (line 151)
+* IOBUF internal structure:              Internals.           (line 157)
+* iop_alloc() internal function:         Internals.           (line 157)
 * isarray() function (gawk):             Type Functions.      (line  11)
 * ISO:                                   Glossary.            (line 372)
 * ISO 8859-1:                            Glossary.            (line 141)
@@ -27036,7 +27043,7 @@ Index
 * private variables:                     Library Names.       (line  11)
 * processes, two-way communications with: Two-way I/O.        (line  23)
 * processing data:                       Basic High Level.    (line   6)
-* PROCINFO array <1>:                    Internals.           (line 140)
+* PROCINFO array <1>:                    Internals.           (line 146)
 * PROCINFO array <2>:                    Id Program.          (line  15)
 * PROCINFO array <3>:                    Group Functions.     (line   6)
 * PROCINFO array <4>:                    Passwd Functions.    (line   6)
@@ -27132,8 +27139,8 @@ Index
 * regexp constants, slashes vs. quotes:  Computed Regexps.    (line  28)
 * regexp constants, vs. string constants: Computed Regexps.   (line  38)
 * regexp, See regular expressions:       Regexp.              (line   6)
-* register_deferred_variable() internal function: Internals.  (line 140)
-* register_open_hook() internal function: Internals.          (line 151)
+* register_deferred_variable() internal function: Internals.  (line 146)
+* register_open_hook() internal function: Internals.          (line 157)
 * regular expressions:                   Regexp.              (line   6)
 * regular expressions as field separators: Field Separators.  (line  50)
 * regular expressions, anchors in:       Regexp Operators.    (line  22)
@@ -27531,14 +27538,15 @@ Index
 * Unix, awk scripts and:                 Executable Scripts.  (line   6)
 * UNIXROOT variable, on OS/2 systems:    PC Using.            (line  17)
 * unref() internal function:             Internals.           (line  92)
+* unset_ERRNO() internal function:       Internals.           (line 141)
 * unsigned integers:                     Basic Data Typing.   (line  30)
 * until debugger command:                Debugger Execution Control.
                                                               (line  83)
 * unwatch debugger command:              Viewing And Changing Data.
                                                               (line  84)
 * up debugger command:                   Execution Stack.     (line  33)
-* update_ERRNO() internal function:      Internals.           (line 130)
-* update_ERRNO_saved() internal function: Internals.          (line 135)
+* update_ERRNO_int() internal function:  Internals.           (line 130)
+* update_ERRNO_string() internal function: Internals.         (line 135)
 * user database, reading:                Passwd Functions.    (line   6)
 * user-defined, functions:               User-defined.        (line   6)
 * user-defined, functions, counts:       Profiling.           (line 129)
@@ -27627,7 +27635,7 @@ Index
 * wstptr internal variable:              Internals.           (line  54)
 * xgawk:                                 Other Versions.      (line 120)
 * xgettext utility:                      String Extraction.   (line  13)
-* XML (eXtensible Markup Language):      Internals.           (line 151)
+* XML (eXtensible Markup Language):      Internals.           (line 157)
 * XOR bitwise operation:                 Bitwise Functions.   (line   6)
 * xor() function (gawk):                 Bitwise Functions.   (line  54)
 * Yawitz, Efraim:                        Contributors.        (line 106)
@@ -28059,27 +28067,27 @@ Node: Adding Code868034
 Node: New Ports874001
 Node: Dynamic Extensions878114
 Node: Internals879554
-Node: Plugin License888073
-Node: Loading Extensions888711
-Node: Sample Library890550
-Node: Internal File Description891240
-Node: Internal File Ops894955
-Ref: Internal File Ops-Footnote-1899679
-Node: Using Internal File Ops899819
-Node: Future Extensions902196
-Node: Basic Concepts904700
-Node: Basic High Level905457
-Ref: Basic High Level-Footnote-1909492
-Node: Basic Data Typing909677
-Node: Floating Point Issues914202
-Node: String Conversion Precision915285
-Ref: String Conversion Precision-Footnote-1916985
-Node: Unexpected Results917094
-Node: POSIX Floating Point Problems918920
-Ref: POSIX Floating Point Problems-Footnote-1922625
-Node: Glossary922663
-Node: Copying947639
-Node: GNU Free Documentation License985196
-Node: Index1010333
+Node: Plugin License888376
+Node: Loading Extensions889014
+Node: Sample Library890853
+Node: Internal File Description891543
+Node: Internal File Ops895258
+Ref: Internal File Ops-Footnote-1900000
+Node: Using Internal File Ops900140
+Node: Future Extensions902517
+Node: Basic Concepts905021
+Node: Basic High Level905778
+Ref: Basic High Level-Footnote-1909813
+Node: Basic Data Typing909998
+Node: Floating Point Issues914523
+Node: String Conversion Precision915606
+Ref: String Conversion Precision-Footnote-1917306
+Node: Unexpected Results917415
+Node: POSIX Floating Point Problems919241
+Ref: POSIX Floating Point Problems-Footnote-1922946
+Node: Glossary922984
+Node: Copying947960
+Node: GNU Free Documentation License985517
+Node: Index1010654
 
 End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index eaad54d..7b46026 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -29460,21 +29460,29 @@ This is a convenience macro that calls 
@code{get_actual_argument()}.
 @cindex functions, return address@hidden setting
 
 @cindex @code{ERRNO} variable
address@hidden @code{update_ERRNO()} internal function
address@hidden internal function, @code{update_ERRNO()}
address@hidden void update_ERRNO(void)
address@hidden @code{update_ERRNO_int()} internal function
address@hidden internal function, @code{update_ERRNO_int()}
address@hidden void update_ERRNO_int(int errno_saved)
 This function is called from within a C extension function to set
-the value of @command{gawk}'s @code{ERRNO} variable, based on the current
-value of the C @code{errno} global variable.
+the value of @command{gawk}'s @code{ERRNO} variable, based on the error
+value provided as the argument.
 It is provided as a convenience.
 
 @cindex @code{ERRNO} variable
address@hidden @code{update_ERRNO_saved()} internal function
address@hidden internal function, @code{update_ERRNO_saved()}
address@hidden void update_ERRNO_saved(int errno_saved)
address@hidden @code{update_ERRNO_string()} internal function
address@hidden internal function, @code{update_ERRNO_string()}
address@hidden void update_ERRNO_string(const char *string, enum 
errno_translate)
 This function is called from within a C extension function to set
-the value of @command{gawk}'s @code{ERRNO} variable, based on the error
-value provided as the argument.
+the value of @command{gawk}'s @code{ERRNO} variable to a given string.
+The second argument determines whether the string is translated before being
+installed into @code{ERRNO}.  It is provided as a convenience.
+
address@hidden @code{ERRNO} variable
address@hidden @code{unset_ERRNO()} internal function
address@hidden internal function, @code{unset_ERRNO()}
address@hidden void unset_ERRNO(void)
+This function is called from within a C extension function to set
+the value of @command{gawk}'s @code{ERRNO} variable to a null string.
 It is provided as a convenience.
 
 @cindex @code{ENVIRON} array
@@ -29838,7 +29846,7 @@ is updated.
     (void) force_string(newdir);
     ret = chdir(newdir->stptr);
     if (ret < 0)
-        update_ERRNO();
+        update_ERRNO_int(errno);
 @end example
 
 Finally, the function returns the return value to the @command{awk} level:
@@ -29907,7 +29915,7 @@ If there's an error, it sets @code{ERRNO} and returns:
     (void) force_string(file);
     ret = lstat(file->stptr, & sbuf);
     if (ret < 0) @{
-        update_ERRNO();
+        update_ERRNO_int(errno);
         return make_number((AWKNUM) ret);
     @}
 @end example
diff --git a/eval.c b/eval.c
index 78598b2..82cca9e 100644
--- a/eval.c
+++ b/eval.c
@@ -988,10 +988,10 @@ set_TEXTDOMAIN()
         */
 }
 
-/* update_ERRNO_saved --- update the value of ERRNO based on argument */
+/* update_ERRNO_int --- update the value of ERRNO based on argument */
 
 void
-update_ERRNO_saved(int errcode)
+update_ERRNO_int(int errcode)
 {
        char *cp;
 
@@ -1004,12 +1004,24 @@ update_ERRNO_saved(int errcode)
        ERRNO_node->var_value = make_string(cp, strlen(cp));
 }
 
-/* update_ERRNO --- update the value of ERRNO based on errno */
+/* update_ERRNO_string --- update ERRNO with optionally translated string */
 
 void
-update_ERRNO()
+update_ERRNO_string(const char *string, enum errno_translate translate)
 {
-       update_ERRNO_saved(errno);
+       if (translate == TRANSLATE)
+               string = gettext(string);
+       unref(ERRNO_node->var_value);
+       ERRNO_node->var_value = make_string(string, strlen(string));
+}
+
+/* unset_ERRNO --- eliminate the value of ERRNO */
+
+void
+unset_ERRNO(void)
+{
+       unref(ERRNO_node->var_value);
+       ERRNO_node->var_value = Nnull_string;
 }
 
 /* update_NR --- update the value of NR */
diff --git a/ext.c b/ext.c
index 39e512f..3c30b1a 100644
--- a/ext.c
+++ b/ext.c
@@ -254,8 +254,7 @@ do_ext(int nargs)
 {
        const char *emsg = _("Operation Not Supported");
 
-       unref(ERRNO_node->var_value);
-       ERRNO_node->var_value = make_string(emsg, strlen(emsg));
+       update_ERRNO_string(emsg, DONT_TRANSLATE);
        return make_number((AWKNUM) -1);
 }
 
diff --git a/extension/ChangeLog b/extension/ChangeLog
index e0a6245..dc017d3 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,11 @@
+2012-04-01         Andrew J. Schorr     <address@hidden>
+
+       * filefuncs.c (do_chdir, do_stat): Replace update_ERRNO() with
+       update_ERRNO_int(errno).
+       * fork.c (do_fork, do_waitpid): Ditto.
+       * readfile.c (do_readfile): Ditto.
+       * rwarray.c (do_writea, do_reada): Ditto.
+
 2012-03-25         Andrew J. Schorr     <address@hidden>
 
        * Makefile.am: Major cleanup.  Use libtool options -module and
diff --git a/extension/filefuncs.c b/extension/filefuncs.c
index dd1b29a..63010c3 100644
--- a/extension/filefuncs.c
+++ b/extension/filefuncs.c
@@ -48,7 +48,7 @@ do_chdir(int nargs)
        (void) force_string(newdir);
        ret = chdir(newdir->stptr);
        if (ret < 0)
-               update_ERRNO();
+               update_ERRNO_int(errno);
 
        return make_number((AWKNUM) ret);
 }
@@ -183,7 +183,7 @@ do_stat(int nargs)
        (void) force_string(file);
        ret = lstat(file->stptr, & sbuf);
        if (ret < 0) {
-               update_ERRNO();
+               update_ERRNO_int(errno);
                return make_number((AWKNUM) ret);
        }
 
diff --git a/extension/fork.c b/extension/fork.c
index 8835387..8b8558e 100644
--- a/extension/fork.c
+++ b/extension/fork.c
@@ -44,7 +44,7 @@ do_fork(int nargs)
        ret = fork();
 
        if (ret < 0)
-               update_ERRNO();
+               update_ERRNO_int(errno);
        else if (ret == 0) {
                /* update PROCINFO in the child */
 
@@ -83,7 +83,7 @@ do_waitpid(int nargs)
                options = WNOHANG|WUNTRACED;
                ret = waitpid(pid, NULL, options);
                if (ret < 0)
-                       update_ERRNO();
+                       update_ERRNO_int(errno);
        } else if (do_lint)
                lintwarn("wait: called with no arguments");
 
diff --git a/extension/readfile.c b/extension/readfile.c
index c9b1efc..9c18601 100644
--- a/extension/readfile.c
+++ b/extension/readfile.c
@@ -59,18 +59,18 @@ do_readfile(int nargs)
 
                ret = stat(filename->stptr, & sbuf);
                if (ret < 0) {
-                       update_ERRNO();
+                       update_ERRNO_int(errno);
                        goto done;
                } else if ((sbuf.st_mode & S_IFMT) != S_IFREG) {
                        errno = EINVAL;
                        ret = -1;
-                       update_ERRNO();
+                       update_ERRNO_int(errno);
                        goto done;
                }
 
                if ((fd = open(filename->stptr, O_RDONLY|O_BINARY)) < 0) {
                        ret = -1;
-                       update_ERRNO();
+                       update_ERRNO_int(errno);
                        goto done;
                }
 
@@ -80,7 +80,7 @@ do_readfile(int nargs)
                if ((ret = read(fd, text, sbuf.st_size)) != sbuf.st_size) {
                        (void) close(fd);
                        ret = -1;
-                       update_ERRNO();
+                       update_ERRNO_int(errno);
                        goto done;
                }
 
diff --git a/extension/rwarray.c b/extension/rwarray.c
index 8175c7c..f4f8cd5 100644
--- a/extension/rwarray.c
+++ b/extension/rwarray.c
@@ -115,7 +115,7 @@ do_writea(int nargs)
 
 done1:
        ret = -1;
-       update_ERRNO();
+       update_ERRNO_int(errno);
        unlink(file->stptr);
 
 done0:
@@ -297,7 +297,7 @@ do_reada(int nargs)
 
 done1:
        ret = -1;
-       update_ERRNO();
+       update_ERRNO_int(errno);
 
 done0:
        close(fd);
diff --git a/io.c b/io.c
index e3327f1..b2d2982 100644
--- a/io.c
+++ b/io.c
@@ -230,7 +230,6 @@ extern int output_is_tty;
 extern NODE *ARGC_node;
 extern NODE *ARGV_node;
 extern NODE *ARGIND_node;
-extern NODE *ERRNO_node;
 extern NODE **fields_arr;
 
 
@@ -308,7 +307,7 @@ after_beginfile(IOBUF **curfile)
                errcode = iop->errcode; 
                iop->errcode = 0;
                errno = 0;
-               update_ERRNO();
+               update_ERRNO_int(errno);
                iop_close(iop);
                *curfile = NULL;
                if (errcode == EISDIR && ! do_traditional) {
@@ -382,7 +381,7 @@ nextfile(IOBUF **curfile, int skipping)
                        fd = devopen(fname, binmode("r"));
                        errcode = errno;
                        if (! do_traditional)
-                               update_ERRNO();
+                               update_ERRNO_int(errno);
 
                        /* This is a kludge.  */
                        unref(FILENAME_node->var_value);
@@ -404,7 +403,7 @@ nextfile(IOBUF **curfile, int skipping)
                /* FNR is init'ed to 0 */
                errno = 0;
                if (! do_traditional)
-                       update_ERRNO();
+                       update_ERRNO_int(errno);
                unref(FILENAME_node->var_value);
                FILENAME_node->var_value = make_string("-", 1);
                FILENAME_node->var_value->flags |= MAYBE_NUM; /* be pedantic */
@@ -415,7 +414,7 @@ nextfile(IOBUF **curfile, int skipping)
                if (iop->fd == INVALID_HANDLE) {
                        errcode = errno;
                        errno = 0;
-                       update_ERRNO();
+                       update_ERRNO_int(errno);
                        (void) iop_close(iop);
                        *curfile = NULL;
                        fatal(_("cannot open file `%s' for reading (%s)"),
@@ -462,7 +461,7 @@ inrec(IOBUF *iop, int *errcode)
        if (cnt == EOF) {
                retval = 1;
                if (*errcode > 0)
-                       update_ERRNO_saved(*errcode);
+                       update_ERRNO_int(*errcode);
        } else {
                NR += 1;
                FNR += 1;
@@ -990,8 +989,7 @@ do_close(int nargs)
                if (! do_traditional) {
                        /* update ERRNO manually, using errno = ENOENT is a 
stretch. */
                        cp = _("close of redirection that was never opened");
-                       unref(ERRNO_node->var_value);
-                       ERRNO_node->var_value = make_string(cp, strlen(cp));
+                       update_ERRNO_string(cp, DONT_TRANSLATE);
                }
 
                DEREF(tmp);
@@ -1111,7 +1109,7 @@ close_redir(struct redirect *rp, int exitwarn, 
two_way_close_type how)
 
                if (! do_traditional) {
                        /* set ERRNO too so that program can get at it */
-                       update_ERRNO_saved(save_errno);
+                       update_ERRNO_int(save_errno);
                }
        }
 
@@ -2228,7 +2226,7 @@ do_getline_redir(int intovar, int redirtype)
        if (rp == NULL) {
                if (redir_error) { /* failed redirect */
                        if (! do_traditional)
-                               update_ERRNO_saved(redir_error);
+                               update_ERRNO_int(redir_error);
                }
                return make_number((AWKNUM) -1.0);
        }
@@ -2240,7 +2238,7 @@ do_getline_redir(int intovar, int redirtype)
        cnt = get_a_record(&s, iop, &errcode);
        if (errcode != 0) {
                if (! do_traditional && (errcode != -1))
-                       update_ERRNO_saved(errcode);
+                       update_ERRNO_int(errcode);
                return make_number((AWKNUM) -1.0);
        }
 
@@ -2288,7 +2286,7 @@ do_getline(int intovar, IOBUF *iop)
        cnt = get_a_record(&s, iop, &errcode);
        if (errcode != 0) {
                if (! do_traditional && (errcode != -1))
-                       update_ERRNO_saved(errcode);
+                       update_ERRNO_int(errcode);
                if (intovar)
                        (void) POP_ADDRESS();
                return make_number((AWKNUM) -1.0); 

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

Summary of changes:
 ChangeLog             |   20 +++++++--
 TODO.xgawk            |   12 +++---
 awk.h                 |    6 ++-
 doc/ChangeLog         |    7 +++
 doc/gawk.info         |  108 ++++++++++++++++++++++++++----------------------
 doc/gawk.texi         |   32 +++++++++-----
 eval.c                |   22 ++++++++--
 ext.c                 |    3 +-
 extension/ChangeLog   |    8 ++++
 extension/filefuncs.c |    4 +-
 extension/fork.c      |    4 +-
 extension/readfile.c  |    8 ++--
 extension/rwarray.c   |    4 +-
 io.c                  |   22 +++++-----
 14 files changed, 157 insertions(+), 103 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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