aboutsummaryrefslogtreecommitdiffstats
path: root/ext.c
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2014-04-13 14:30:56 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2014-04-13 14:30:56 -0400
commit94e3f93395de538d73826e128281a3ea9591a5a9 (patch)
tree45257e4b024537c5e0e5a3037a99ea9765583c99 /ext.c
parentc4300d657ba49db0b6d0f0884f41a29622edc58b (diff)
parenta4b59faf911743b30f2e6e979c4f9c1ea0669ac3 (diff)
downloadegawk-94e3f93395de538d73826e128281a3ea9591a5a9.tar.gz
egawk-94e3f93395de538d73826e128281a3ea9591a5a9.tar.bz2
egawk-94e3f93395de538d73826e128281a3ea9591a5a9.zip
Merge branch 'master' into select
Diffstat (limited to 'ext.c')
-rw-r--r--ext.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/ext.c b/ext.c
index 9e17761a..09e10164 100644
--- a/ext.c
+++ b/ext.c
@@ -7,7 +7,7 @@
*/
/*
- * Copyright (C) 1995 - 2001, 2003-2013 the Free Software Foundation, Inc.
+ * Copyright (C) 1995 - 2001, 2003-2014 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -174,9 +174,9 @@ load_old_ext(SRCFILE *s, const char *init_func, const char *fini_func, NODE *obj
fatal(_("`extension' is a gawk extension"));
if (lib_name == NULL)
- fatal(_("load_ext: received NULL lib_name"));
+ fatal(_("extension: received NULL lib_name"));
- if ((dl = dlopen(s->fullpath, flags)) == NULL)
+ if ((dl = dlopen(lib_name, flags)) == NULL)
fatal(_("extension: cannot open library `%s' (%s)"), lib_name,
dlerror());
@@ -221,13 +221,11 @@ make_builtin(const awk_ext_func_t *funcinfo)
fatal(_("make_builtin: missing function name"));
if (! is_letter(*sp))
- return false;
-
- sp++;
+ return awk_false;
- while ((c = *sp++) != '\0') {
+ for (sp++; (c = *sp++) != '\0';) {
if (! is_identifier_char(c))
- return false;
+ return awk_false;
}
f = lookup(name);
@@ -240,7 +238,7 @@ make_builtin(const awk_ext_func_t *funcinfo)
/* multiple extension() calls etc. */
if (do_lint)
lintwarn(_("make_builtin: function `%s' already defined"), name);
- return false;
+ return awk_false;
} else
/* variable name etc. */
fatal(_("make_builtin: function name `%s' previously defined"), name);
@@ -260,7 +258,7 @@ make_builtin(const awk_ext_func_t *funcinfo)
symbol = install_symbol(estrdup(name, strlen(name)), Node_ext_func);
symbol->code_ptr = b;
track_ext_func(name);
- return true;
+ return awk_true;
}
/* make_old_builtin --- register name to be called as func with a builtin body */
@@ -277,9 +275,11 @@ make_old_builtin(const char *name, NODE *(*func)(int), int count) /* temporary *
if (sp == NULL || *sp == '\0')
fatal(_("extension: missing function name"));
- while ((c = *sp++) != '\0') {
- if ((sp == & name[1] && c != '_' && ! isalpha((unsigned char) c))
- || (sp > &name[1] && ! is_identifier_char((unsigned char) c)))
+ if (! is_letter(*sp))
+ fatal(_("extension: illegal character `%c' in function name `%s'"), *sp, name);
+
+ for (sp++; (c = *sp++) != '\0';) {
+ if (! is_identifier_char(c))
fatal(_("extension: illegal character `%c' in function name `%s'"), c, name);
}
@@ -312,6 +312,7 @@ make_old_builtin(const char *name, NODE *(*func)(int), int count) /* temporary *
symbol = install_symbol(estrdup(name, strlen(name)), Node_old_ext_func);
symbol->code_ptr = b;
+ track_ext_func(name);
}