gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-79-g7d19cbd


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-79-g7d19cbd
Date: Mon, 19 Aug 2013 17:49:11 +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, master has been updated
       via  7d19cbd54ad60474aded4b9fe587c7f53a14d488 (commit)
      from  f106ce81c596748a0df5b5ccca61e2f989ad9e1d (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=7d19cbd54ad60474aded4b9fe587c7f53a14d488

commit 7d19cbd54ad60474aded4b9fe587c7f53a14d488
Author: Arnold D. Robbins <address@hidden>
Date:   Mon Aug 19 20:47:49 2013 +0300

    Changes to ENVIRON reflect into the environment.

diff --git a/ChangeLog b/ChangeLog
index 1ce515c..0097da9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2013-08-18         Arnold D. Robbins     <address@hidden>
+
+       Reflect updates to ENVIRON into the real environment.
+
+       * awk.h (init_env_array): Add declaration.
+       * main.c (load_environ): Call init_env_array.
+       * str_array.c (env_remove, env_store, env_clear, init_env_array):
+       New functions.
+       (env_array_func): New array vtable.
+
 2013-08-15         Arnold D. Robbins     <address@hidden>
 
        * debug.c (print_memory): Fix whitespace / indentation.
diff --git a/NEWS b/NEWS
index e0a4ffa..b6f97d5 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,13 @@
    are permitted in any medium without royalty provided the copyright
    notice and this notice are preserved.
 
+Changes from 4.1.1 to 4.2.0
+---------------------------
+
+1. If not in POSIX mode, changes to ENVIRON are reflected into
+   gawk's environment, affecting any programs run by system()
+   or for piped redirections.
+
 Changes from 4.1.0 to 4.1.1
 ---------------------------
 
diff --git a/TODO b/TODO
index f08d82d..e30a761 100644
--- a/TODO
+++ b/TODO
@@ -50,9 +50,6 @@ Minor New Features
 
        Add a readfile() function in awk from mail.
 
-       Make writes to ENVIRON / deletions affect the real environment
-       using setenv / unsetenv.
-
        Consider relaxing the strictness of --posix.
 
        ? Add an optional base to strtonum, allowing 2-36.
diff --git a/array.c b/array.c
index 92a1cb8..a0ddf58 100644
--- a/array.c
+++ b/array.c
@@ -113,21 +113,14 @@ null_array(NODE *symbol)
        symbol->table_size = symbol->array_size = 0;
        symbol->array_capacity = 0;
        symbol->flags = 0;
-       /*
-        * 5/2013: This used to be
-        *
-        *      assert(symbol->xarray == NULL);
-        *
-        * But that seems to cause problems for no good reason
-        * that I can see. I believe it to be an artifact of the
-        * union getting in the way.
-        */
-       symbol->xarray = NULL;
+
+       assert(symbol->xarray == NULL);
+
        /* vname, parent_array not (re)initialized */
 }
 
 
-/* null_lookup: assign type to an empty array. */
+/* null_lookup --- assign type to an empty array. */
 
 static NODE **
 null_lookup(NODE *symbol, NODE *subs)
@@ -349,6 +342,7 @@ force_array(NODE *symbol, bool canfatal)
 
        switch (symbol->type) {
        case Node_var_new:
+               symbol->xarray = NULL;  /* make sure union is as it should be */
                null_array(symbol);
                symbol->parent_array = NULL;    /* main array has no parent */
                /* fall through */
diff --git a/awk.h b/awk.h
index e01726d..5063198 100644
--- a/awk.h
+++ b/awk.h
@@ -1363,6 +1363,7 @@ extern NODE *do_aoption(int nargs);
 extern NODE *do_asort(int nargs);
 extern NODE *do_asorti(int nargs);
 extern unsigned long (*hash)(const char *s, size_t len, unsigned long hsize, 
size_t *code);
+extern void init_env_array(NODE *env_node);
 /* awkgram.c */
 extern NODE *variable(int location, char *name, NODETYPE type);
 extern int parse_program(INSTRUCTION **pcode);
diff --git a/doc/ChangeLog b/doc/ChangeLog
index c175416..488620a 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-15         Arnold D. Robbins     <address@hidden>
+
+       * gawk.1: Document that ENVIRON updates affect the environment.
+       * gawktexi.in: Ditto.
+
 2013-06-27         Arnold D. Robbins     <address@hidden>
 
        * texinfo.tex: Update from Karl, fixes a formating problem.
diff --git a/doc/gawk.1 b/doc/gawk.1
index 7f31c25..8d34302 100644
--- a/doc/gawk.1
+++ b/doc/gawk.1
@@ -13,7 +13,7 @@
 .              if \w'\(rq' .ds rq "\(rq
 .      \}
 .\}
-.TH GAWK 1 "May 09 2013" "Free Software Foundation" "Utility Commands"
+.TH GAWK 1 "Aug 15 2013" "Free Software Foundation" "Utility Commands"
 .SH NAME
 gawk \- pattern scanning and processing language
 .SH SYNOPSIS
@@ -917,11 +917,17 @@ An array containing the values of the current environment.
 The array is indexed by the environment variables, each element being
 the value of that variable (e.g., \fBENVIRON["HOME"]\fP might be
 \fB"/home/arnold"\fR).
-Changing this array does not affect the environment seen by programs which
+.sp
+In POSIX mode,
+changing this array does not affect the environment seen by programs which
 .I gawk
 spawns via redirection or the
 .B system()
 function.
+Otherwise,
+.I gawk
+updates its real environment so that programs it spawns see
+the changes.
 .TP
 .B ERRNO
 If a system error occurs either doing a redirection for
diff --git a/doc/gawk.info b/doc/gawk.info
index 9072bf0..12e0c43 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -9679,9 +9679,18 @@ with a pound sign (`#').
      An associative array containing the values of the environment.
      The array indices are the environment variable names; the elements
      are the values of the particular environment variables.  For
-     example, `ENVIRON["HOME"]' might be `/home/arnold'.  Changing this
-     array does not affect the environment passed on to any programs
-     that `awk' may spawn via redirection or the `system()' function.
+     example, `ENVIRON["HOME"]' might be `/home/arnold'.
+
+     For POSIX `awk', changing this array does not affect the
+     environment passed on to any programs that `awk' may spawn via
+     redirection or the `system()' function.
+
+     However, beginning with version 4.2, if not in POSIX compatibility
+     mode, `gawk' does update its own environment when `ENVIRON' is
+     changed, thus changing the environment seen by programs that it
+     creates.  You should therefore be especially careful if you modify
+     `ENVIRON["PATH"]"', which is the search path for finding
+     executable programs.
 
      Some operating systems may not have environment variables.  On
      such systems, the `ENVIRON' array is empty (except for
@@ -30070,9 +30079,9 @@ Index
 * dark corner, exit statement:           Exit Statement.      (line  30)
 * dark corner, field separators:         Field Splitting Summary.
                                                               (line  46)
-* dark corner, FILENAME variable <1>:    Auto-set.            (line  93)
+* dark corner, FILENAME variable <1>:    Auto-set.            (line 102)
 * dark corner, FILENAME variable:        Getline Notes.       (line  19)
-* dark corner, FNR/NR variables:         Auto-set.            (line 314)
+* dark corner, FNR/NR variables:         Auto-set.            (line 323)
 * dark corner, format-control characters: Control Letters.    (line  18)
 * dark corner, FS as null string:        Single Character Fields.
                                                               (line  20)
@@ -30241,12 +30250,12 @@ Index
                                                               (line  23)
 * differences in awk and gawk, close() function: Close Files And Pipes.
                                                               (line  81)
-* differences in awk and gawk, ERRNO variable: Auto-set.      (line  73)
+* differences in awk and gawk, ERRNO variable: Auto-set.      (line  82)
 * differences in awk and gawk, error messages: Special FD.    (line  16)
 * differences in awk and gawk, FIELDWIDTHS variable: User-modified.
                                                               (line  35)
 * differences in awk and gawk, FPAT variable: User-modified.  (line  45)
-* differences in awk and gawk, FUNCTAB variable: Auto-set.    (line 119)
+* differences in awk and gawk, FUNCTAB variable: Auto-set.    (line 128)
 * differences in awk and gawk, function arguments (gawk): Calling Built-in.
                                                               (line  16)
 * differences in awk and gawk, getline command: Getline.      (line  19)
@@ -30269,14 +30278,14 @@ Index
                                                               (line 261)
 * differences in awk and gawk, print/printf statements: Format Modifiers.
                                                               (line  13)
-* differences in awk and gawk, PROCINFO array: Auto-set.      (line 133)
+* differences in awk and gawk, PROCINFO array: Auto-set.      (line 142)
 * differences in awk and gawk, record separators: Records.    (line 117)
 * differences in awk and gawk, regexp constants: Using Constant Regexps.
                                                               (line  43)
 * differences in awk and gawk, regular expressions: Case-sensitivity.
                                                               (line  26)
 * differences in awk and gawk, RS/RT variables: Records.      (line 172)
-* differences in awk and gawk, RT variable: Auto-set.         (line 266)
+* differences in awk and gawk, RT variable: Auto-set.         (line 275)
 * differences in awk and gawk, single-character fields: Single Character 
Fields.
                                                               (line   6)
 * differences in awk and gawk, split() function: String Functions.
@@ -30285,7 +30294,7 @@ Index
 * differences in awk and gawk, strings, storing: Records.     (line 191)
 * differences in awk and gawk, strtonum() function (gawk): String Functions.
                                                               (line 406)
-* differences in awk and gawk, SYMTAB variable: Auto-set.     (line 274)
+* differences in awk and gawk, SYMTAB variable: Auto-set.     (line 283)
 * differences in awk and gawk, TEXTDOMAIN variable: User-modified.
                                                               (line 162)
 * differences in awk and gawk, trunc-mod operation: Arithmetic Ops.
@@ -30366,13 +30375,13 @@ Index
                                                               (line  11)
 * EREs (Extended Regular Expressions):   Bracket Expressions. (line  24)
 * ERRNO variable <1>:                    TCP/IP Networking.   (line  54)
-* ERRNO variable <2>:                    Auto-set.            (line  73)
+* ERRNO variable <2>:                    Auto-set.            (line  82)
 * ERRNO variable <3>:                    BEGINFILE/ENDFILE.   (line  26)
 * ERRNO variable <4>:                    Close Files And Pipes.
                                                               (line 138)
 * ERRNO variable:                        Getline.             (line  19)
 * error handling:                        Special FD.          (line  16)
-* error handling, ERRNO variable and:    Auto-set.            (line  73)
+* error handling, ERRNO variable and:    Auto-set.            (line  82)
 * error output:                          Special FD.          (line   6)
 * escape processing, gsub()/gensub()/sub() functions: Gory Details.
                                                               (line   6)
@@ -30484,7 +30493,7 @@ Index
 * file names, distinguishing:            Auto-set.            (line  52)
 * file names, in compatibility mode:     Special Caveats.     (line   9)
 * file names, standard streams in gawk:  Special FD.          (line  46)
-* FILENAME variable <1>:                 Auto-set.            (line  93)
+* FILENAME variable <1>:                 Auto-set.            (line 102)
 * FILENAME variable:                     Reading Files.       (line   6)
 * FILENAME variable, getline, setting with: Getline Notes.    (line  19)
 * filenames, assignments as:             Ignoring Assigns.    (line   6)
@@ -30551,9 +30560,9 @@ Index
 * floating-point, numbers:               General Arithmetic.  (line   6)
 * fnmatch extension function:            Extension Sample Fnmatch.
                                                               (line   6)
-* FNR variable <1>:                      Auto-set.            (line 103)
+* FNR variable <1>:                      Auto-set.            (line 112)
 * FNR variable:                          Records.             (line   6)
-* FNR variable, changing:                Auto-set.            (line 314)
+* FNR variable, changing:                Auto-set.            (line 323)
 * for statement:                         For Statement.       (line   6)
 * for statement, looping over arrays:    Scanning an Array.   (line  20)
 * fork extension function:               Extension Sample Fork.
@@ -30600,7 +30609,7 @@ Index
 * FSF (Free Software Foundation):        Manual History.      (line   6)
 * fts extension function:                Extension Sample File Functions.
                                                               (line  77)
-* FUNCTAB array:                         Auto-set.            (line 119)
+* FUNCTAB array:                         Auto-set.            (line 128)
 * function calls:                        Function Calls.      (line   6)
 * function calls, indirect:              Indirect Calls.      (line   6)
 * function pointers:                     Indirect Calls.      (line   6)
@@ -30669,7 +30678,7 @@ Index
 * gawk, distribution:                    Distribution contents.
                                                               (line   6)
 * gawk, ERRNO variable in <1>:           TCP/IP Networking.   (line  54)
-* gawk, ERRNO variable in <2>:           Auto-set.            (line  73)
+* gawk, ERRNO variable in <2>:           Auto-set.            (line  82)
 * gawk, ERRNO variable in <3>:           BEGINFILE/ENDFILE.   (line  26)
 * gawk, ERRNO variable in <4>:           Close Files And Pipes.
                                                               (line 138)
@@ -30686,7 +30695,7 @@ Index
 * gawk, FPAT variable in <1>:            User-modified.       (line  45)
 * gawk, FPAT variable in:                Splitting By Content.
                                                               (line  26)
-* gawk, FUNCTAB array in:                Auto-set.            (line 119)
+* gawk, FUNCTAB array in:                Auto-set.            (line 128)
 * gawk, function arguments and:          Calling Built-in.    (line  16)
 * gawk, hexadecimal numbers and:         Nondecimal-numbers.  (line  42)
 * gawk, IGNORECASE variable in <1>:      Array Sorting Functions.
@@ -30717,7 +30726,7 @@ Index
 * gawk, OS/2 version of:                 PC Using.            (line  11)
 * gawk, PROCINFO array in <1>:           Two-way I/O.         (line 116)
 * gawk, PROCINFO array in <2>:           Time Functions.      (line  47)
-* gawk, PROCINFO array in:               Auto-set.            (line 133)
+* gawk, PROCINFO array in:               Auto-set.            (line 142)
 * gawk, regexp constants and:            Using Constant Regexps.
                                                               (line  28)
 * gawk, regular expressions, case sensitivity: Case-sensitivity.
@@ -30725,7 +30734,7 @@ Index
 * gawk, regular expressions, operators:  GNU Regexp Operators.
                                                               (line   6)
 * gawk, regular expressions, precedence: Regexp Operators.    (line 161)
-* gawk, RT variable in <1>:              Auto-set.            (line 266)
+* gawk, RT variable in <1>:              Auto-set.            (line 275)
 * gawk, RT variable in <2>:              Getline/Variable/File.
                                                               (line  10)
 * gawk, RT variable in <3>:              Multiple Line.       (line 129)
@@ -30734,7 +30743,7 @@ Index
 * gawk, source code, obtaining:          Getting.             (line   6)
 * gawk, splitting fields and:            Constant Size.       (line  87)
 * gawk, string-translation functions:    I18N Functions.      (line   6)
-* gawk, SYMTAB array in:                 Auto-set.            (line 274)
+* gawk, SYMTAB array in:                 Auto-set.            (line 283)
 * gawk, TEXTDOMAIN variable in:          User-modified.       (line 162)
 * gawk, timestamps:                      Time Functions.      (line   6)
 * gawk, uses for:                        Preface.             (line  36)
@@ -31135,16 +31144,16 @@ Index
                                                               (line  47)
 * nexti debugger command:                Debugger Execution Control.
                                                               (line  49)
-* NF variable <1>:                       Auto-set.            (line 108)
+* NF variable <1>:                       Auto-set.            (line 117)
 * NF variable:                           Fields.              (line  33)
 * NF variable, decrementing:             Changing Fields.     (line 107)
 * ni debugger command (alias for nexti): Debugger Execution Control.
                                                               (line  49)
 * noassign.awk program:                  Ignoring Assigns.    (line  15)
 * not Boolean-logic operator:            Boolean Ops.         (line   6)
-* NR variable <1>:                       Auto-set.            (line 128)
+* NR variable <1>:                       Auto-set.            (line 137)
 * NR variable:                           Records.             (line   6)
-* NR variable, changing:                 Auto-set.            (line 314)
+* NR variable, changing:                 Auto-set.            (line 323)
 * null strings <1>:                      Basic Data Typing.   (line  26)
 * null strings <2>:                      Truth Values.        (line   6)
 * null strings <3>:                      Regexp Field Splitting.
@@ -31424,7 +31433,7 @@ Index
 * PROCINFO array <3>:                    Group Functions.     (line   6)
 * PROCINFO array <4>:                    Passwd Functions.    (line   6)
 * PROCINFO array <5>:                    Time Functions.      (line  47)
-* PROCINFO array <6>:                    Auto-set.            (line 133)
+* PROCINFO array <6>:                    Auto-set.            (line 142)
 * PROCINFO array:                        Obsolete.            (line  11)
 * profiling awk programs:                Profiling.           (line   6)
 * profiling awk programs, dynamically:   Profiling.           (line 172)
@@ -31577,7 +31586,7 @@ Index
 * right angle bracket (>), >> operator (I/O): Redirection.    (line  50)
 * right shift, bitwise:                  Bitwise Functions.   (line  32)
 * Ritchie, Dennis:                       Basic Data Typing.   (line  55)
-* RLENGTH variable:                      Auto-set.            (line 253)
+* RLENGTH variable:                      Auto-set.            (line 262)
 * RLENGTH variable, match() function and: String Functions.   (line 225)
 * Robbins, Arnold <1>:                   Future Extensions.   (line   6)
 * Robbins, Arnold <2>:                   Bugs.                (line  32)
@@ -31604,9 +31613,9 @@ Index
 * RS variable:                           Records.             (line  20)
 * RS variable, multiline records and:    Multiple Line.       (line  17)
 * rshift() function (gawk):              Bitwise Functions.   (line  52)
-* RSTART variable:                       Auto-set.            (line 259)
+* RSTART variable:                       Auto-set.            (line 268)
 * RSTART variable, match() function and: String Functions.    (line 225)
-* RT variable <1>:                       Auto-set.            (line 266)
+* RT variable <1>:                       Auto-set.            (line 275)
 * RT variable <2>:                       Getline/Variable/File.
                                                               (line  10)
 * RT variable <3>:                       Multiple Line.       (line 129)
@@ -31689,7 +31698,7 @@ Index
                                                               (line 110)
 * sidebar, Changing FS Does Not Affect the Fields: Field Splitting Summary.
                                                               (line  38)
-* sidebar, Changing NR and FNR:          Auto-set.            (line 312)
+* sidebar, Changing NR and FNR:          Auto-set.            (line 321)
 * sidebar, Controlling Output Buffering with system(): I/O Functions.
                                                               (line 135)
 * sidebar, Escape Sequences for Metacharacters: Escape Sequences.
@@ -31831,7 +31840,7 @@ Index
 * substr() function:                     String Functions.    (line 483)
 * Sumner, Andrew:                        Other Versions.      (line  64)
 * switch statement:                      Switch Statement.    (line   6)
-* SYMTAB array:                          Auto-set.            (line 274)
+* SYMTAB array:                          Auto-set.            (line 283)
 * syntactic ambiguity: /= operator vs. /=.../ regexp constant: Assignment Ops.
                                                               (line 147)
 * system() function:                     I/O Functions.       (line  72)
@@ -32272,335 +32281,335 @@ Node: Built-in Variables402949
 Node: User-modified404044
 Ref: User-modified-Footnote-1412404
 Node: Auto-set412466
-Ref: Auto-set-Footnote-1425544
-Ref: Auto-set-Footnote-2425749
-Node: ARGC and ARGV425805
-Node: Arrays429656
-Node: Array Basics431161
-Node: Array Intro431987
-Node: Reference to Elements436305
-Node: Assigning Elements438575
-Node: Array Example439066
-Node: Scanning an Array440798
-Node: Controlling Scanning443112
-Ref: Controlling Scanning-Footnote-1448035
-Node: Delete448351
-Ref: Delete-Footnote-1451116
-Node: Numeric Array Subscripts451173
-Node: Uninitialized Subscripts453356
-Node: Multi-dimensional454984
-Node: Multi-scanning458078
-Node: Arrays of Arrays459669
-Node: Functions464310
-Node: Built-in465129
-Node: Calling Built-in466207
-Node: Numeric Functions468195
-Ref: Numeric Functions-Footnote-1472027
-Ref: Numeric Functions-Footnote-2472384
-Ref: Numeric Functions-Footnote-3472432
-Node: String Functions472701
-Ref: String Functions-Footnote-1496259
-Ref: String Functions-Footnote-2496388
-Ref: String Functions-Footnote-3496636
-Node: Gory Details496723
-Ref: table-sub-escapes498402
-Ref: table-sub-posix-92499756
-Ref: table-sub-proposed501107
-Ref: table-posix-sub502461
-Ref: table-gensub-escapes504006
-Ref: Gory Details-Footnote-1505182
-Ref: Gory Details-Footnote-2505233
-Node: I/O Functions505384
-Ref: I/O Functions-Footnote-1512369
-Node: Time Functions512516
-Ref: Time Functions-Footnote-1523449
-Ref: Time Functions-Footnote-2523517
-Ref: Time Functions-Footnote-3523675
-Ref: Time Functions-Footnote-4523786
-Ref: Time Functions-Footnote-5523898
-Ref: Time Functions-Footnote-6524125
-Node: Bitwise Functions524391
-Ref: table-bitwise-ops524949
-Ref: Bitwise Functions-Footnote-1529170
-Node: Type Functions529354
-Node: I18N Functions530505
-Node: User-defined532132
-Node: Definition Syntax532936
-Ref: Definition Syntax-Footnote-1537846
-Node: Function Example537915
-Node: Function Caveats540509
-Node: Calling A Function540930
-Node: Variable Scope542045
-Node: Pass By Value/Reference545008
-Node: Return Statement548516
-Node: Dynamic Typing551497
-Node: Indirect Calls552428
-Node: Library Functions562113
-Ref: Library Functions-Footnote-1565626
-Ref: Library Functions-Footnote-2565769
-Node: Library Names565940
-Ref: Library Names-Footnote-1569411
-Ref: Library Names-Footnote-2569631
-Node: General Functions569717
-Node: Strtonum Function570670
-Node: Assert Function573600
-Node: Round Function576926
-Node: Cliff Random Function578469
-Node: Ordinal Functions579485
-Ref: Ordinal Functions-Footnote-1582555
-Ref: Ordinal Functions-Footnote-2582807
-Node: Join Function583016
-Ref: Join Function-Footnote-1584787
-Node: Getlocaltime Function584987
-Node: Data File Management588702
-Node: Filetrans Function589334
-Node: Rewind Function593403
-Node: File Checking594790
-Node: Empty Files595884
-Node: Ignoring Assigns598114
-Node: Getopt Function599667
-Ref: Getopt Function-Footnote-1610971
-Node: Passwd Functions611174
-Ref: Passwd Functions-Footnote-1620149
-Node: Group Functions620237
-Node: Walking Arrays628321
-Node: Sample Programs630458
-Node: Running Examples631132
-Node: Clones631860
-Node: Cut Program633084
-Node: Egrep Program642929
-Ref: Egrep Program-Footnote-1650702
-Node: Id Program650812
-Node: Split Program654428
-Ref: Split Program-Footnote-1657947
-Node: Tee Program658075
-Node: Uniq Program660878
-Node: Wc Program668307
-Ref: Wc Program-Footnote-1672573
-Ref: Wc Program-Footnote-2672773
-Node: Miscellaneous Programs672865
-Node: Dupword Program674053
-Node: Alarm Program676084
-Node: Translate Program680833
-Ref: Translate Program-Footnote-1685220
-Ref: Translate Program-Footnote-2685448
-Node: Labels Program685582
-Ref: Labels Program-Footnote-1688953
-Node: Word Sorting689037
-Node: History Sorting692921
-Node: Extract Program694760
-Ref: Extract Program-Footnote-1702261
-Node: Simple Sed702389
-Node: Igawk Program705451
-Ref: Igawk Program-Footnote-1720608
-Ref: Igawk Program-Footnote-2720809
-Node: Anagram Program720947
-Node: Signature Program724015
-Node: Advanced Features725115
-Node: Nondecimal Data726997
-Node: Array Sorting728580
-Node: Controlling Array Traversal729277
-Node: Array Sorting Functions737515
-Ref: Array Sorting Functions-Footnote-1741189
-Ref: Array Sorting Functions-Footnote-2741282
-Node: Two-way I/O741476
-Ref: Two-way I/O-Footnote-1746908
-Node: TCP/IP Networking746978
-Node: Profiling749822
-Node: Internationalization757319
-Node: I18N and L10N758744
-Node: Explaining gettext759430
-Ref: Explaining gettext-Footnote-1764498
-Ref: Explaining gettext-Footnote-2764682
-Node: Programmer i18n764847
-Node: Translator i18n769049
-Node: String Extraction769842
-Ref: String Extraction-Footnote-1770803
-Node: Printf Ordering770889
-Ref: Printf Ordering-Footnote-1773673
-Node: I18N Portability773737
-Ref: I18N Portability-Footnote-1776186
-Node: I18N Example776249
-Ref: I18N Example-Footnote-1778887
-Node: Gawk I18N778959
-Node: Debugger779580
-Node: Debugging780551
-Node: Debugging Concepts780984
-Node: Debugging Terms782840
-Node: Awk Debugging785437
-Node: Sample Debugging Session786329
-Node: Debugger Invocation786849
-Node: Finding The Bug788181
-Node: List of Debugger Commands794669
-Node: Breakpoint Control796003
-Node: Debugger Execution Control799667
-Node: Viewing And Changing Data803027
-Node: Execution Stack806383
-Node: Debugger Info807850
-Node: Miscellaneous Debugger Commands811832
-Node: Readline Support817008
-Node: Limitations817839
-Node: Arbitrary Precision Arithmetic820091
-Ref: Arbitrary Precision Arithmetic-Footnote-1821742
-Node: General Arithmetic821890
-Node: Floating Point Issues823610
-Node: String Conversion Precision824491
-Ref: String Conversion Precision-Footnote-1826197
-Node: Unexpected Results826306
-Node: POSIX Floating Point Problems828459
-Ref: POSIX Floating Point Problems-Footnote-1832284
-Node: Integer Programming832322
-Node: Floating-point Programming834061
-Ref: Floating-point Programming-Footnote-1840392
-Ref: Floating-point Programming-Footnote-2840662
-Node: Floating-point Representation840926
-Node: Floating-point Context842091
-Ref: table-ieee-formats842930
-Node: Rounding Mode844314
-Ref: table-rounding-modes844793
-Ref: Rounding Mode-Footnote-1847808
-Node: Gawk and MPFR847987
-Node: Arbitrary Precision Floats849242
-Ref: Arbitrary Precision Floats-Footnote-1851685
-Node: Setting Precision852001
-Ref: table-predefined-precision-strings852687
-Node: Setting Rounding Mode854832
-Ref: table-gawk-rounding-modes855236
-Node: Floating-point Constants856423
-Node: Changing Precision857852
-Ref: Changing Precision-Footnote-1859252
-Node: Exact Arithmetic859426
-Node: Arbitrary Precision Integers862564
-Ref: Arbitrary Precision Integers-Footnote-1865582
-Node: Dynamic Extensions865729
-Node: Extension Intro867187
-Node: Plugin License868452
-Node: Extension Mechanism Outline869137
-Ref: load-extension869554
-Ref: load-new-function871032
-Ref: call-new-function872027
-Node: Extension API Description874042
-Node: Extension API Functions Introduction875255
-Node: General Data Types880121
-Ref: General Data Types-Footnote-1885723
-Node: Requesting Values886022
-Ref: table-value-types-returned886753
-Node: Constructor Functions887707
-Node: Registration Functions890727
-Node: Extension Functions891412
-Node: Exit Callback Functions893637
-Node: Extension Version String894886
-Node: Input Parsers895536
-Node: Output Wrappers905293
-Node: Two-way processors909803
-Node: Printing Messages912011
-Ref: Printing Messages-Footnote-1913088
-Node: Updating `ERRNO'913240
-Node: Accessing Parameters913979
-Node: Symbol Table Access915209
-Node: Symbol table by name915721
-Node: Symbol table by cookie917468
-Ref: Symbol table by cookie-Footnote-1921598
-Node: Cached values921661
-Ref: Cached values-Footnote-1925110
-Node: Array Manipulation925201
-Ref: Array Manipulation-Footnote-1926299
-Node: Array Data Types926338
-Ref: Array Data Types-Footnote-1929041
-Node: Array Functions929133
-Node: Flattening Arrays932899
-Node: Creating Arrays939751
-Node: Extension API Variables944476
-Node: Extension Versioning945112
-Node: Extension API Informational Variables947013
-Node: Extension API Boilerplate948099
-Node: Finding Extensions951903
-Node: Extension Example952463
-Node: Internal File Description953194
-Node: Internal File Ops957285
-Ref: Internal File Ops-Footnote-1968793
-Node: Using Internal File Ops968933
-Ref: Using Internal File Ops-Footnote-1971286
-Node: Extension Samples971552
-Node: Extension Sample File Functions973076
-Node: Extension Sample Fnmatch981563
-Node: Extension Sample Fork983289
-Node: Extension Sample Inplace984507
-Node: Extension Sample Ord986285
-Node: Extension Sample Readdir987121
-Node: Extension Sample Revout988653
-Node: Extension Sample Rev2way989246
-Node: Extension Sample Read write array989936
-Node: Extension Sample Readfile991819
-Node: Extension Sample API Tests992637
-Node: Extension Sample Time993162
-Node: gawkextlib994526
-Node: Language History997286
-Node: V7/SVR3.1998808
-Node: SVR41001129
-Node: POSIX1002571
-Node: BTL1003957
-Node: POSIX/GNU1004691
-Node: Common Extensions1010226
-Node: Ranges and Locales1011532
-Ref: Ranges and Locales-Footnote-11016150
-Ref: Ranges and Locales-Footnote-21016177
-Ref: Ranges and Locales-Footnote-31016437
-Node: Contributors1016658
-Node: Installation1021537
-Node: Gawk Distribution1022431
-Node: Getting1022915
-Node: Extracting1023741
-Node: Distribution contents1025433
-Node: Unix Installation1030694
-Node: Quick Installation1031311
-Node: Additional Configuration Options1033755
-Node: Configuration Philosophy1035232
-Node: Non-Unix Installation1037586
-Node: PC Installation1038044
-Node: PC Binary Installation1039343
-Node: PC Compiling1041191
-Node: PC Testing1044135
-Node: PC Using1045311
-Node: Cygwin1049496
-Node: MSYS1050496
-Node: VMS Installation1051010
-Node: VMS Compilation1051613
-Ref: VMS Compilation-Footnote-11052620
-Node: VMS Installation Details1052678
-Node: VMS Running1054313
-Node: VMS Old Gawk1055920
-Node: Bugs1056394
-Node: Other Versions1060246
-Node: Notes1065847
-Node: Compatibility Mode1066647
-Node: Additions1067430
-Node: Accessing The Source1068357
-Node: Adding Code1069797
-Node: New Ports1075842
-Node: Derived Files1079977
-Ref: Derived Files-Footnote-11085298
-Ref: Derived Files-Footnote-21085332
-Ref: Derived Files-Footnote-31085932
-Node: Future Extensions1086030
-Node: Implementation Limitations1086611
-Node: Extension Design1087863
-Node: Old Extension Problems1089017
-Ref: Old Extension Problems-Footnote-11090525
-Node: Extension New Mechanism Goals1090582
-Ref: Extension New Mechanism Goals-Footnote-11093948
-Node: Extension Other Design Decisions1094134
-Node: Extension Future Growth1096240
-Node: Old Extension Mechanism1097076
-Node: Basic Concepts1098816
-Node: Basic High Level1099497
-Ref: figure-general-flow1099768
-Ref: figure-process-flow1100367
-Ref: Basic High Level-Footnote-11103596
-Node: Basic Data Typing1103781
-Node: Glossary1107136
-Node: Copying1132598
-Node: GNU Free Documentation License1170155
-Node: Index1195292
+Ref: Auto-set-Footnote-1425936
+Ref: Auto-set-Footnote-2426141
+Node: ARGC and ARGV426197
+Node: Arrays430048
+Node: Array Basics431553
+Node: Array Intro432379
+Node: Reference to Elements436697
+Node: Assigning Elements438967
+Node: Array Example439458
+Node: Scanning an Array441190
+Node: Controlling Scanning443504
+Ref: Controlling Scanning-Footnote-1448427
+Node: Delete448743
+Ref: Delete-Footnote-1451508
+Node: Numeric Array Subscripts451565
+Node: Uninitialized Subscripts453748
+Node: Multi-dimensional455376
+Node: Multi-scanning458470
+Node: Arrays of Arrays460061
+Node: Functions464702
+Node: Built-in465521
+Node: Calling Built-in466599
+Node: Numeric Functions468587
+Ref: Numeric Functions-Footnote-1472419
+Ref: Numeric Functions-Footnote-2472776
+Ref: Numeric Functions-Footnote-3472824
+Node: String Functions473093
+Ref: String Functions-Footnote-1496651
+Ref: String Functions-Footnote-2496780
+Ref: String Functions-Footnote-3497028
+Node: Gory Details497115
+Ref: table-sub-escapes498794
+Ref: table-sub-posix-92500148
+Ref: table-sub-proposed501499
+Ref: table-posix-sub502853
+Ref: table-gensub-escapes504398
+Ref: Gory Details-Footnote-1505574
+Ref: Gory Details-Footnote-2505625
+Node: I/O Functions505776
+Ref: I/O Functions-Footnote-1512761
+Node: Time Functions512908
+Ref: Time Functions-Footnote-1523841
+Ref: Time Functions-Footnote-2523909
+Ref: Time Functions-Footnote-3524067
+Ref: Time Functions-Footnote-4524178
+Ref: Time Functions-Footnote-5524290
+Ref: Time Functions-Footnote-6524517
+Node: Bitwise Functions524783
+Ref: table-bitwise-ops525341
+Ref: Bitwise Functions-Footnote-1529562
+Node: Type Functions529746
+Node: I18N Functions530897
+Node: User-defined532524
+Node: Definition Syntax533328
+Ref: Definition Syntax-Footnote-1538238
+Node: Function Example538307
+Node: Function Caveats540901
+Node: Calling A Function541322
+Node: Variable Scope542437
+Node: Pass By Value/Reference545400
+Node: Return Statement548908
+Node: Dynamic Typing551889
+Node: Indirect Calls552820
+Node: Library Functions562505
+Ref: Library Functions-Footnote-1566018
+Ref: Library Functions-Footnote-2566161
+Node: Library Names566332
+Ref: Library Names-Footnote-1569803
+Ref: Library Names-Footnote-2570023
+Node: General Functions570109
+Node: Strtonum Function571062
+Node: Assert Function573992
+Node: Round Function577318
+Node: Cliff Random Function578861
+Node: Ordinal Functions579877
+Ref: Ordinal Functions-Footnote-1582947
+Ref: Ordinal Functions-Footnote-2583199
+Node: Join Function583408
+Ref: Join Function-Footnote-1585179
+Node: Getlocaltime Function585379
+Node: Data File Management589094
+Node: Filetrans Function589726
+Node: Rewind Function593795
+Node: File Checking595182
+Node: Empty Files596276
+Node: Ignoring Assigns598506
+Node: Getopt Function600059
+Ref: Getopt Function-Footnote-1611363
+Node: Passwd Functions611566
+Ref: Passwd Functions-Footnote-1620541
+Node: Group Functions620629
+Node: Walking Arrays628713
+Node: Sample Programs630850
+Node: Running Examples631524
+Node: Clones632252
+Node: Cut Program633476
+Node: Egrep Program643321
+Ref: Egrep Program-Footnote-1651094
+Node: Id Program651204
+Node: Split Program654820
+Ref: Split Program-Footnote-1658339
+Node: Tee Program658467
+Node: Uniq Program661270
+Node: Wc Program668699
+Ref: Wc Program-Footnote-1672965
+Ref: Wc Program-Footnote-2673165
+Node: Miscellaneous Programs673257
+Node: Dupword Program674445
+Node: Alarm Program676476
+Node: Translate Program681225
+Ref: Translate Program-Footnote-1685612
+Ref: Translate Program-Footnote-2685840
+Node: Labels Program685974
+Ref: Labels Program-Footnote-1689345
+Node: Word Sorting689429
+Node: History Sorting693313
+Node: Extract Program695152
+Ref: Extract Program-Footnote-1702653
+Node: Simple Sed702781
+Node: Igawk Program705843
+Ref: Igawk Program-Footnote-1721000
+Ref: Igawk Program-Footnote-2721201
+Node: Anagram Program721339
+Node: Signature Program724407
+Node: Advanced Features725507
+Node: Nondecimal Data727389
+Node: Array Sorting728972
+Node: Controlling Array Traversal729669
+Node: Array Sorting Functions737907
+Ref: Array Sorting Functions-Footnote-1741581
+Ref: Array Sorting Functions-Footnote-2741674
+Node: Two-way I/O741868
+Ref: Two-way I/O-Footnote-1747300
+Node: TCP/IP Networking747370
+Node: Profiling750214
+Node: Internationalization757711
+Node: I18N and L10N759136
+Node: Explaining gettext759822
+Ref: Explaining gettext-Footnote-1764890
+Ref: Explaining gettext-Footnote-2765074
+Node: Programmer i18n765239
+Node: Translator i18n769441
+Node: String Extraction770234
+Ref: String Extraction-Footnote-1771195
+Node: Printf Ordering771281
+Ref: Printf Ordering-Footnote-1774065
+Node: I18N Portability774129
+Ref: I18N Portability-Footnote-1776578
+Node: I18N Example776641
+Ref: I18N Example-Footnote-1779279
+Node: Gawk I18N779351
+Node: Debugger779972
+Node: Debugging780943
+Node: Debugging Concepts781376
+Node: Debugging Terms783232
+Node: Awk Debugging785829
+Node: Sample Debugging Session786721
+Node: Debugger Invocation787241
+Node: Finding The Bug788573
+Node: List of Debugger Commands795061
+Node: Breakpoint Control796395
+Node: Debugger Execution Control800059
+Node: Viewing And Changing Data803419
+Node: Execution Stack806775
+Node: Debugger Info808242
+Node: Miscellaneous Debugger Commands812224
+Node: Readline Support817400
+Node: Limitations818231
+Node: Arbitrary Precision Arithmetic820483
+Ref: Arbitrary Precision Arithmetic-Footnote-1822134
+Node: General Arithmetic822282
+Node: Floating Point Issues824002
+Node: String Conversion Precision824883
+Ref: String Conversion Precision-Footnote-1826589
+Node: Unexpected Results826698
+Node: POSIX Floating Point Problems828851
+Ref: POSIX Floating Point Problems-Footnote-1832676
+Node: Integer Programming832714
+Node: Floating-point Programming834453
+Ref: Floating-point Programming-Footnote-1840784
+Ref: Floating-point Programming-Footnote-2841054
+Node: Floating-point Representation841318
+Node: Floating-point Context842483
+Ref: table-ieee-formats843322
+Node: Rounding Mode844706
+Ref: table-rounding-modes845185
+Ref: Rounding Mode-Footnote-1848200
+Node: Gawk and MPFR848379
+Node: Arbitrary Precision Floats849634
+Ref: Arbitrary Precision Floats-Footnote-1852077
+Node: Setting Precision852393
+Ref: table-predefined-precision-strings853079
+Node: Setting Rounding Mode855224
+Ref: table-gawk-rounding-modes855628
+Node: Floating-point Constants856815
+Node: Changing Precision858244
+Ref: Changing Precision-Footnote-1859644
+Node: Exact Arithmetic859818
+Node: Arbitrary Precision Integers862956
+Ref: Arbitrary Precision Integers-Footnote-1865974
+Node: Dynamic Extensions866121
+Node: Extension Intro867579
+Node: Plugin License868844
+Node: Extension Mechanism Outline869529
+Ref: load-extension869946
+Ref: load-new-function871424
+Ref: call-new-function872419
+Node: Extension API Description874434
+Node: Extension API Functions Introduction875647
+Node: General Data Types880513
+Ref: General Data Types-Footnote-1886115
+Node: Requesting Values886414
+Ref: table-value-types-returned887145
+Node: Constructor Functions888099
+Node: Registration Functions891119
+Node: Extension Functions891804
+Node: Exit Callback Functions894029
+Node: Extension Version String895278
+Node: Input Parsers895928
+Node: Output Wrappers905685
+Node: Two-way processors910195
+Node: Printing Messages912403
+Ref: Printing Messages-Footnote-1913480
+Node: Updating `ERRNO'913632
+Node: Accessing Parameters914371
+Node: Symbol Table Access915601
+Node: Symbol table by name916113
+Node: Symbol table by cookie917860
+Ref: Symbol table by cookie-Footnote-1921990
+Node: Cached values922053
+Ref: Cached values-Footnote-1925502
+Node: Array Manipulation925593
+Ref: Array Manipulation-Footnote-1926691
+Node: Array Data Types926730
+Ref: Array Data Types-Footnote-1929433
+Node: Array Functions929525
+Node: Flattening Arrays933291
+Node: Creating Arrays940143
+Node: Extension API Variables944868
+Node: Extension Versioning945504
+Node: Extension API Informational Variables947405
+Node: Extension API Boilerplate948491
+Node: Finding Extensions952295
+Node: Extension Example952855
+Node: Internal File Description953586
+Node: Internal File Ops957677
+Ref: Internal File Ops-Footnote-1969185
+Node: Using Internal File Ops969325
+Ref: Using Internal File Ops-Footnote-1971678
+Node: Extension Samples971944
+Node: Extension Sample File Functions973468
+Node: Extension Sample Fnmatch981955
+Node: Extension Sample Fork983681
+Node: Extension Sample Inplace984899
+Node: Extension Sample Ord986677
+Node: Extension Sample Readdir987513
+Node: Extension Sample Revout989045
+Node: Extension Sample Rev2way989638
+Node: Extension Sample Read write array990328
+Node: Extension Sample Readfile992211
+Node: Extension Sample API Tests993029
+Node: Extension Sample Time993554
+Node: gawkextlib994918
+Node: Language History997678
+Node: V7/SVR3.1999200
+Node: SVR41001521
+Node: POSIX1002963
+Node: BTL1004349
+Node: POSIX/GNU1005083
+Node: Common Extensions1010618
+Node: Ranges and Locales1011924
+Ref: Ranges and Locales-Footnote-11016542
+Ref: Ranges and Locales-Footnote-21016569
+Ref: Ranges and Locales-Footnote-31016829
+Node: Contributors1017050
+Node: Installation1021929
+Node: Gawk Distribution1022823
+Node: Getting1023307
+Node: Extracting1024133
+Node: Distribution contents1025825
+Node: Unix Installation1031086
+Node: Quick Installation1031703
+Node: Additional Configuration Options1034147
+Node: Configuration Philosophy1035624
+Node: Non-Unix Installation1037978
+Node: PC Installation1038436
+Node: PC Binary Installation1039735
+Node: PC Compiling1041583
+Node: PC Testing1044527
+Node: PC Using1045703
+Node: Cygwin1049888
+Node: MSYS1050888
+Node: VMS Installation1051402
+Node: VMS Compilation1052005
+Ref: VMS Compilation-Footnote-11053012
+Node: VMS Installation Details1053070
+Node: VMS Running1054705
+Node: VMS Old Gawk1056312
+Node: Bugs1056786
+Node: Other Versions1060638
+Node: Notes1066239
+Node: Compatibility Mode1067039
+Node: Additions1067822
+Node: Accessing The Source1068749
+Node: Adding Code1070189
+Node: New Ports1076234
+Node: Derived Files1080369
+Ref: Derived Files-Footnote-11085690
+Ref: Derived Files-Footnote-21085724
+Ref: Derived Files-Footnote-31086324
+Node: Future Extensions1086422
+Node: Implementation Limitations1087003
+Node: Extension Design1088255
+Node: Old Extension Problems1089409
+Ref: Old Extension Problems-Footnote-11090917
+Node: Extension New Mechanism Goals1090974
+Ref: Extension New Mechanism Goals-Footnote-11094340
+Node: Extension Other Design Decisions1094526
+Node: Extension Future Growth1096632
+Node: Old Extension Mechanism1097468
+Node: Basic Concepts1099208
+Node: Basic High Level1099889
+Ref: figure-general-flow1100160
+Ref: figure-process-flow1100759
+Ref: Basic High Level-Footnote-11103988
+Node: Basic Data Typing1104173
+Node: Glossary1107528
+Node: Copying1132990
+Node: GNU Free Documentation License1170547
+Node: Index1195684
 
 End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index fa3e587..10fffd0 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -13652,10 +13652,18 @@ it is not special.
 An associative array containing the values of the environment.  The array
 indices are the environment variable names; the elements are the values of
 the particular environment variables.  For example,
address@hidden"HOME"]} might be @file{/home/arnold}.  Changing this array
-does not affect the environment passed on to any programs that
address@hidden may spawn via redirection or the @code{system()} function.
address@hidden (In a future version of @command{gawk}, it may do so.)
address@hidden"HOME"]} might be @file{/home/arnold}.
+
+For POSIX @command{awk}, changing this array does not affect the
+environment passed on to any programs that @command{awk} may spawn via
+redirection or the @code{system()} function.
+
+However, beginning with @value{PVERSION} 4.2, if not in POSIX
+compatibility mode, @command{gawk} does update its own environment when
address@hidden is changed, thus changing the environment seen by programs
+that it creates.  You should therefore be especially careful if you
+modify @code{ENVIRON["PATH"]"}, which is the search path for finding
+executable programs.
 
 Some operating systems may not have environment variables.
 On such systems, the @code{ENVIRON} array is empty (except for
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 59ee1a6..1a696f9 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -13037,10 +13037,18 @@ it is not special.
 An associative array containing the values of the environment.  The array
 indices are the environment variable names; the elements are the values of
 the particular environment variables.  For example,
address@hidden"HOME"]} might be @file{/home/arnold}.  Changing this array
-does not affect the environment passed on to any programs that
address@hidden may spawn via redirection or the @code{system()} function.
address@hidden (In a future version of @command{gawk}, it may do so.)
address@hidden"HOME"]} might be @file{/home/arnold}.
+
+For POSIX @command{awk}, changing this array does not affect the
+environment passed on to any programs that @command{awk} may spawn via
+redirection or the @code{system()} function.
+
+However, beginning with @value{PVERSION} 4.2, if not in POSIX
+compatibility mode, @command{gawk} does update its own environment when
address@hidden is changed, thus changing the environment seen by programs
+that it creates.  You should therefore be especially careful if you
+modify @code{ENVIRON["PATH"]"}, which is the search path for finding
+executable programs.
 
 Some operating systems may not have environment variables.
 On such systems, the @code{ENVIRON} array is empty (except for
diff --git a/main.c b/main.c
index 7438ee3..76fd565 100644
--- a/main.c
+++ b/main.c
@@ -1096,6 +1096,10 @@ load_environ()
         */
        path_environ("AWKPATH", defpath);
        path_environ("AWKLIBPATH", deflibpath);
+
+       /* set up array functions */
+       init_env_array(ENVIRON_node);
+
        return ENVIRON_node;
 }
 
diff --git a/str_array.c b/str_array.c
index aa82d71..e4352a9 100644
--- a/str_array.c
+++ b/str_array.c
@@ -69,6 +69,25 @@ afunc_t str_array_func[] = {
        (afunc_t) 0,
 };
 
+static NODE **env_remove(NODE *symbol, NODE *subs);
+static NODE **env_store(NODE *symbol, NODE *subs);
+static NODE **env_clear(NODE *symbol, NODE *subs);
+
+/* special case for ENVIRON */
+afunc_t env_array_func[] = {
+       str_array_init,
+       (afunc_t) 0,
+       null_length,
+       str_lookup,
+       str_exists,
+       env_clear,
+       env_remove,
+       str_list,
+       str_copy,
+       str_dump,
+       env_store,
+};
+
 static inline NODE **str_find(NODE *symbol, NODE *s1, size_t code1, unsigned 
long hash1);
 static void grow_table(NODE *symbol);
 
@@ -737,3 +756,58 @@ scramble(unsigned long x)
 
        return x;
 }
+
+/* env_remove --- for ENVIRON, remove value from real environment */
+
+static NODE **
+env_remove(NODE *symbol, NODE *subs)
+{
+       NODE **val = str_remove(symbol, subs);
+
+       if (val != NULL)
+               (void) unsetenv(subs->stptr);
+
+       return val;
+}
+
+/* env_clear --- clear out the environment when ENVIRON is deleted */
+
+static NODE **
+env_clear(NODE *symbol, NODE *subs)
+{
+       extern char **environ;
+       NODE **val = str_clear(symbol, subs);
+
+       environ = NULL; /* ZAP! */
+
+       /* str_clear zaps the vtable, reset it */
+       symbol->array_funcs = env_array_func;
+
+       return val;
+}
+
+/* env_store --- post assign function for ENVIRON, put new value into env */
+
+static NODE **
+env_store(NODE *symbol, NODE *subs)
+{
+       NODE **val = str_exists(symbol, subs);
+
+       assert(val != NULL);
+
+       (void) setenv(subs->stptr, (*val)->stptr, 1);
+
+       return val;
+}
+
+/* init_env_array --- set up the pointers for ENVIRON. A bit hacky. */
+
+void
+init_env_array(NODE *env_node)
+{
+       /* If POSIX simply don't reset the vtable and things work as before */
+       if (do_posix)
+               return;
+
+       env_node->array_funcs = env_array_func;
+}

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

Summary of changes:
 ChangeLog       |   10 +
 NEWS            |    7 +
 TODO            |    3 -
 array.c         |   16 +-
 awk.h           |    1 +
 doc/ChangeLog   |    5 +
 doc/gawk.1      |   10 +-
 doc/gawk.info   |  729 ++++++++++++++++++++++++++++---------------------------
 doc/gawk.texi   |   16 +-
 doc/gawktexi.in |   16 +-
 main.c          |    4 +
 str_array.c     |   74 ++++++
 12 files changed, 507 insertions(+), 384 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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