diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-08-02 20:42:20 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-08-02 20:42:20 +0300 |
commit | 8e90e97556b42669da322c731091d76db9334c58 (patch) | |
tree | 6f18abf2e800d0dfb6c063e72435bd7019493e96 /extension/revoutput.c | |
parent | f069368128520843542fae4e2ae1afe75516fc2f (diff) | |
parent | a90865d0db6d60847272d46020a14aad9901f304 (diff) | |
download | egawk-8e90e97556b42669da322c731091d76db9334c58.tar.gz egawk-8e90e97556b42669da322c731091d76db9334c58.tar.bz2 egawk-8e90e97556b42669da322c731091d76db9334c58.zip |
Merge branch 'master' into feature/cmake
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; |