diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-08-02 20:40:50 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-08-02 20:40:50 +0300 |
commit | c5137ae530c49765049adb53777c79ebb7607ebe (patch) | |
tree | e168aec9e1c771058688df892368fbdba5de40e3 /extension/revoutput.c | |
parent | fa460b53f8173ebee36dbe672a9d95d3d69c9a9c (diff) | |
download | egawk-c5137ae530c49765049adb53777c79ebb7607ebe.tar.gz egawk-c5137ae530c49765049adb53777c79ebb7607ebe.tar.bz2 egawk-c5137ae530c49765049adb53777c79ebb7607ebe.zip |
Bug fix in revoutput extension.
Diffstat (limited to 'extension/revoutput.c')
-rw-r--r-- | extension/revoutput.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/extension/revoutput.c b/extension/revoutput.c index ae4b444a..69257167 100644 --- a/extension/revoutput.c +++ b/extension/revoutput.c @@ -7,7 +7,7 @@ */ /* - * Copyright (C) 2012, 2013 the Free Software Foundation, Inc. + * Copyright (C) 2012, 2013, 2015 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -47,7 +47,7 @@ static const gawk_api_t *api; /* for convenience macros to work */ static awk_ext_id_t *ext_id; -static const char *ext_version = "revoutput extension: version 1.0"; +static const char *ext_version = "revoutput extension: version 1.1"; static awk_bool_t init_revoutput(void); static awk_bool_t (*init_func)(void) = init_revoutput; @@ -120,11 +120,14 @@ init_revoutput() register_output_wrapper(& output_wrapper); - make_number(0.0, & value); /* init to false */ - if (! sym_update("REVOUT", & value)) { - warning(ext_id, _("revoutput: could not initialize REVOUT variable")); + if (! sym_lookup("REVOUT", AWK_SCALAR, & value)) { + /* only install it if not there, e.g. -v REVOUT=1 */ + make_number(0.0, & value); /* init to false */ + if (! sym_update("REVOUT", & value)) { + warning(ext_id, _("revoutput: could not initialize REVOUT variable")); - return awk_false; + return awk_false; + } } return awk_true; |