aboutsummaryrefslogtreecommitdiffstats
path: root/extension
diff options
context:
space:
mode:
Diffstat (limited to 'extension')
-rw-r--r--extension/.gitignore3
-rw-r--r--extension/ChangeLog59
-rw-r--r--extension/Makefile.am57
-rw-r--r--extension/Makefile.in689
-rw-r--r--extension/arrayparm.c12
-rw-r--r--extension/dl.c4
-rw-r--r--extension/filefuncs.c197
-rw-r--r--extension/fork.c44
-rw-r--r--extension/ordchr.c10
-rw-r--r--extension/readfile.c14
-rw-r--r--extension/rwarray.c18
-rw-r--r--extension/testarg.c16
12 files changed, 980 insertions, 143 deletions
diff --git a/extension/.gitignore b/extension/.gitignore
new file mode 100644
index 00000000..ee95901f
--- /dev/null
+++ b/extension/.gitignore
@@ -0,0 +1,3 @@
+# ignore files created by libtool
+*.l[oa]
+.libs
diff --git a/extension/ChangeLog b/extension/ChangeLog
index d684afe9..a38ce15c 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,62 @@
+2012-05-11 Arnold D. Robbins <arnold@skeeve.com>
+
+ Sweeping change: Use `bool', `true', and `false' everywhere.
+
+2012-04-11 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * filefuncs.c (array_set): New function to set an array element.
+ (do_set): Use new array_set function to reduce code duplication and
+ to make sure the memory management is handled properly.
+
+2012-04-07 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * filefuncs.c: Remove unnecessary #include <sys/sysmacros.h>.
+ (read_symlink): New function to read symbolic links more robustly.
+ (do_stat): Use read_symlink instead of readlink.
+ * fork.c (do_wait): new function.
+ (dlload): Call make_builtin to add "wait" function.
+
+2012-04-02 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * fork.c (do_fork): Test whether PROCINFO_node exists before updating
+ the pid values. And do so properly using make_number.
+ * readfile.c (do_readfile): Function should be static.
+
+2012-04-01 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * 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 <aschorr@telemetry-investments.com>
+
+ * Makefile.am: Major cleanup. Use libtool options -module and
+ -avoid-version to create the modules properly without my local hack
+ to override the default behavior.
+
+2012-03-25 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * .gitignore: New file to ignore files created by libtool (including
+ binaries and associated metadata).
+
+2012-03-21 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * Makefile.am (INCLUDES): Remove -I$(top_srcdir)/intl.
+
+2012-03-20 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * Makefile.am: New file to build and install shared libraries.
+ * arrayparm.c (do_mkarray): Get it to compile by removing 2nd arg
+ to assoc_clear.
+ * filefuncs.c (do_stat): Ditto.
+
+2011-08-31 John Haque <j.eh@mchsi.com>
+
+ * arrayparm.c, filefuncs.c, fork.c, ordchr.c, readfile.c,
+ rwarray.c, testarg.c: Updated.
+
2012-03-28 Arnold D. Robbins <arnold@skeeve.com>
* 4.0.1: Release tar ball made.
diff --git a/extension/Makefile.am b/extension/Makefile.am
new file mode 100644
index 00000000..a2f47229
--- /dev/null
+++ b/extension/Makefile.am
@@ -0,0 +1,57 @@
+#
+# extension/Makefile.am --- automake input file for gawk
+#
+# Copyright (C) 1995-2006 the Free Software Foundation, Inc.
+#
+# This file is part of GAWK, the GNU implementation of the
+# AWK Programming Language.
+#
+# GAWK is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# GAWK is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+
+## Process this file with automake to produce Makefile.in.
+
+INCLUDES = -I.. -I$(top_srcdir)
+
+# The arrayparm, zaxxon (dl), and testarg libraries do not do anything useful,
+# so do not build or install them.
+
+# Note: rwarray does not currently compile.
+
+pkgextension_LTLIBRARIES = \
+ filefuncs.la \
+ fork.la \
+ ordchr.la \
+ readfile.la
+
+MY_MODULE_FLAGS = -module -avoid-version
+
+filefuncs_la_SOURCES = filefuncs.c
+filefuncs_la_LDFLAGS = $(MY_MODULE_FLAGS)
+fork_la_SOURCES = fork.c
+fork_la_LDFLAGS = $(MY_MODULE_FLAGS)
+ordchr_la_SOURCES = ordchr.c
+ordchr_la_LDFLAGS = $(MY_MODULE_FLAGS)
+readfile_la_SOURCES = readfile.c
+readfile_la_LDFLAGS = $(MY_MODULE_FLAGS)
+#rwarray_la_SOURCES = rwarray.c
+#rwarray_la_LDFLAGS = $(MY_MODULE_FLAGS)
+
+EXTRA_DIST = \
+ ChangeLog \
+ ChangeLog.0 \
+ *.awk \
+ doit \
+ steps
diff --git a/extension/Makefile.in b/extension/Makefile.in
new file mode 100644
index 00000000..72c75b02
--- /dev/null
+++ b/extension/Makefile.in
@@ -0,0 +1,689 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#
+# extension/Makefile.am --- automake input file for gawk
+#
+# Copyright (C) 1995-2006 the Free Software Foundation, Inc.
+#
+# This file is part of GAWK, the GNU implementation of the
+# AWK Programming Language.
+#
+# GAWK is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# GAWK is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = extension
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs ChangeLog
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \
+ $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+ $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lcmessage.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libsigsegv.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/longlong.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/mpfr.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/noreturn.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/readline.m4 \
+ $(top_srcdir)/m4/socket.m4 $(top_srcdir)/m4/ulonglong.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(pkgextensiondir)"
+LTLIBRARIES = $(pkgextension_LTLIBRARIES)
+filefuncs_la_LIBADD =
+am_filefuncs_la_OBJECTS = filefuncs.lo
+filefuncs_la_OBJECTS = $(am_filefuncs_la_OBJECTS)
+filefuncs_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(filefuncs_la_LDFLAGS) $(LDFLAGS) -o $@
+fork_la_LIBADD =
+am_fork_la_OBJECTS = fork.lo
+fork_la_OBJECTS = $(am_fork_la_OBJECTS)
+fork_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(fork_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
+ordchr_la_LIBADD =
+am_ordchr_la_OBJECTS = ordchr.lo
+ordchr_la_OBJECTS = $(am_ordchr_la_OBJECTS)
+ordchr_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(ordchr_la_LDFLAGS) $(LDFLAGS) -o $@
+readfile_la_LIBADD =
+am_readfile_la_OBJECTS = readfile.lo
+readfile_la_OBJECTS = $(am_readfile_la_OBJECTS)
+readfile_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(readfile_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(filefuncs_la_SOURCES) $(fork_la_SOURCES) \
+ $(ordchr_la_SOURCES) $(readfile_la_SOURCES)
+DIST_SOURCES = $(filefuncs_la_SOURCES) $(fork_la_SOURCES) \
+ $(ordchr_la_SOURCES) $(readfile_la_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+HAVE_LIBSIGSEGV = @HAVE_LIBSIGSEGV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBMPFR = @LIBMPFR@
+LIBOBJS = @LIBOBJS@
+LIBREADLINE = @LIBREADLINE@
+LIBS = @LIBS@
+LIBSIGSEGV = @LIBSIGSEGV@
+LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+LTLIBSIGSEGV = @LTLIBSIGSEGV@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOCKET_LIBS = @SOCKET_LIBS@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acl_shlibext = @acl_shlibext@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgextensiondir = @pkgextensiondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = -I.. -I$(top_srcdir)
+
+# The arrayparm, zaxxon (dl), and testarg libraries do not do anything useful,
+# so do not build or install them.
+
+# Note: rwarray does not currently compile.
+pkgextension_LTLIBRARIES = \
+ filefuncs.la \
+ fork.la \
+ ordchr.la \
+ readfile.la
+
+MY_MODULE_FLAGS = -module -avoid-version
+filefuncs_la_SOURCES = filefuncs.c
+filefuncs_la_LDFLAGS = $(MY_MODULE_FLAGS)
+fork_la_SOURCES = fork.c
+fork_la_LDFLAGS = $(MY_MODULE_FLAGS)
+ordchr_la_SOURCES = ordchr.c
+ordchr_la_LDFLAGS = $(MY_MODULE_FLAGS)
+readfile_la_SOURCES = readfile.c
+readfile_la_LDFLAGS = $(MY_MODULE_FLAGS)
+#rwarray_la_SOURCES = rwarray.c
+#rwarray_la_LDFLAGS = $(MY_MODULE_FLAGS)
+EXTRA_DIST = \
+ ChangeLog \
+ ChangeLog.0 \
+ *.awk \
+ doit \
+ steps
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu extension/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu extension/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-pkgextensionLTLIBRARIES: $(pkgextension_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgextension_LTLIBRARIES)'; test -n "$(pkgextensiondir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgextensiondir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgextensiondir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgextensiondir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgextensiondir)"; \
+ }
+
+uninstall-pkgextensionLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgextension_LTLIBRARIES)'; test -n "$(pkgextensiondir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgextensiondir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgextensiondir)/$$f"; \
+ done
+
+clean-pkgextensionLTLIBRARIES:
+ -test -z "$(pkgextension_LTLIBRARIES)" || rm -f $(pkgextension_LTLIBRARIES)
+ @list='$(pkgextension_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+filefuncs.la: $(filefuncs_la_OBJECTS) $(filefuncs_la_DEPENDENCIES) $(EXTRA_filefuncs_la_DEPENDENCIES)
+ $(filefuncs_la_LINK) -rpath $(pkgextensiondir) $(filefuncs_la_OBJECTS) $(filefuncs_la_LIBADD) $(LIBS)
+fork.la: $(fork_la_OBJECTS) $(fork_la_DEPENDENCIES) $(EXTRA_fork_la_DEPENDENCIES)
+ $(fork_la_LINK) -rpath $(pkgextensiondir) $(fork_la_OBJECTS) $(fork_la_LIBADD) $(LIBS)
+ordchr.la: $(ordchr_la_OBJECTS) $(ordchr_la_DEPENDENCIES) $(EXTRA_ordchr_la_DEPENDENCIES)
+ $(ordchr_la_LINK) -rpath $(pkgextensiondir) $(ordchr_la_OBJECTS) $(ordchr_la_LIBADD) $(LIBS)
+readfile.la: $(readfile_la_OBJECTS) $(readfile_la_DEPENDENCIES) $(EXTRA_readfile_la_DEPENDENCIES)
+ $(readfile_la_LINK) -rpath $(pkgextensiondir) $(readfile_la_OBJECTS) $(readfile_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filefuncs.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fork.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ordchr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readfile.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(pkgextensiondir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-pkgextensionLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pkgextensionLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pkgextensionLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-pkgextensionLTLIBRARIES cscopelist ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-pkgextensionLTLIBRARIES install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-pkgextensionLTLIBRARIES
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/extension/arrayparm.c b/extension/arrayparm.c
index 8a550ace..02b8c2e4 100644
--- a/extension/arrayparm.c
+++ b/extension/arrayparm.c
@@ -43,18 +43,18 @@ int plugin_is_GPL_compatible;
*/
static NODE *
-do_mkarray(int args)
+do_mkarray(int nargs)
{
int ret = -1;
NODE *var, *sub, *val;
NODE **elemval;
- if (do_lint && get_curfunc_arg_count() > 3)
+ if (do_lint && nargs > 3)
lintwarn("mkarray: called with too many arguments");
- var = get_array_argument(0, FALSE);
- sub = get_scalar_argument(1, FALSE);
- val = get_scalar_argument(2, FALSE);
+ var = get_array_argument(0, false);
+ sub = get_scalar_argument(1, false);
+ val = get_scalar_argument(2, false);
printf("var->type = %s\n", nodetype2str(var->type));
printf("sub->type = %s\n", nodetype2str(sub->type));
@@ -62,7 +62,7 @@ do_mkarray(int args)
assoc_clear(var);
- elemval = assoc_lookup(var, sub, 0);
+ elemval = assoc_lookup(var, sub);
*elemval = dupnode(val);
ret = 0;
diff --git a/extension/dl.c b/extension/dl.c
index afc16af5..ee3b08fe 100644
--- a/extension/dl.c
+++ b/extension/dl.c
@@ -47,7 +47,7 @@ zaxxon(int nargs)
for (i = 0; i < nargs; i++) {
- obj = get_scalar_argument(i, TRUE);
+ obj = get_scalar_argument(i, true);
if (obj == NULL)
break;
@@ -63,7 +63,7 @@ zaxxon(int nargs)
/*
* Do something useful
*/
- obj = get_scalar_argument(0, FALSE);
+ obj = get_scalar_argument(0, false);
if (obj != NULL) {
force_string(obj);
diff --git a/extension/filefuncs.c b/extension/filefuncs.c
index ad7828f3..9758ba8e 100644
--- a/extension/filefuncs.c
+++ b/extension/filefuncs.c
@@ -29,8 +29,6 @@
#include "awk.h"
-#include <sys/sysmacros.h>
-
int plugin_is_GPL_compatible;
/* do_chdir --- provide dynamically loaded chdir() builtin for gawk */
@@ -41,14 +39,14 @@ do_chdir(int nargs)
NODE *newdir;
int ret = -1;
- if (do_lint && get_curfunc_arg_count() != 1)
+ if (do_lint && nargs != 1)
lintwarn("chdir: called with incorrect number of arguments");
- newdir = get_scalar_argument(0, FALSE);
+ newdir = get_scalar_argument(0, false);
(void) force_string(newdir);
ret = chdir(newdir->stptr);
if (ret < 0)
- update_ERRNO();
+ update_ERRNO_int(errno);
return make_number((AWKNUM) ret);
}
@@ -157,24 +155,92 @@ format_mode(unsigned long fmode)
return outbuf;
}
+/* read_symlink -- read a symbolic link into an allocated buffer.
+ This is based on xreadlink; the basic problem is that lstat cannot be relied
+ upon to return the proper size for a symbolic link. This happens,
+ for example, on linux in the /proc filesystem, where the symbolic link
+ sizes are often 0. */
+
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
+#ifndef SSIZE_MAX
+# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
+#endif
+
+#define MAXSIZE (SIZE_MAX < SSIZE_MAX ? SIZE_MAX : SSIZE_MAX)
+
+static char *
+read_symlink(const char *fname, size_t bufsize, ssize_t *linksize)
+{
+ if (bufsize)
+ bufsize += 2;
+ else
+ bufsize = BUFSIZ*2;
+ /* Make sure that bufsize >= 2 and within range */
+ if ((bufsize > MAXSIZE) || (bufsize < 2))
+ bufsize = MAXSIZE;
+ while (1) {
+ char *buf;
+
+ emalloc(buf, char *, bufsize, "read_symlink");
+ if ((*linksize = readlink(fname, buf, bufsize)) < 0) {
+ /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink
+ returns -1 with errno == ERANGE if the buffer is
+ too small. */
+ if (errno != ERANGE) {
+ free(buf);
+ return NULL;
+ }
+ }
+ /* N.B. This test is safe because bufsize must be >= 2 */
+ else if ((size_t)*linksize <= bufsize-2) {
+ buf[*linksize] = '\0';
+ return buf;
+ }
+ free(buf);
+ if (bufsize <= MAXSIZE/2)
+ bufsize *= 2;
+ else if (bufsize < MAXSIZE)
+ bufsize = MAXSIZE;
+ else
+ return NULL;
+ }
+ return NULL;
+}
+
+/* array_set --- set an array element */
+
+static void
+array_set(NODE *array, const char *sub, NODE *value)
+{
+ NODE *tmp;
+ NODE **aptr;
+
+ tmp = make_string(sub, strlen(sub));
+ aptr = assoc_lookup(array, tmp);
+ unref(tmp);
+ unref(*aptr);
+ *aptr = value;
+}
+
/* do_stat --- provide a stat() function for gawk */
static NODE *
do_stat(int nargs)
{
- NODE *file, *array, *tmp;
+ NODE *file, *array;
struct stat sbuf;
int ret;
- NODE **aptr;
char *pmode; /* printable mode */
char *type = "unknown";
- if (do_lint && get_curfunc_arg_count() > 2)
+ if (do_lint && nargs > 2)
lintwarn("stat: called with too many arguments");
/* file is first arg, array to hold results is second */
- file = get_scalar_argument(0, FALSE);
- array = get_array_argument(1, FALSE);
+ file = get_scalar_argument(0, false);
+ array = get_array_argument(1, false);
/* empty out the array */
assoc_clear(array);
@@ -183,104 +249,49 @@ 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);
}
/* fill in the array */
- aptr = assoc_lookup(array, tmp = make_string("name", 4), FALSE);
- *aptr = dupnode(file);
- unref(tmp);
-
- aptr = assoc_lookup(array, tmp = make_string("dev", 3), FALSE);
- *aptr = make_number((AWKNUM) sbuf.st_dev);
- unref(tmp);
-
- aptr = assoc_lookup(array, tmp = make_string("ino", 3), FALSE);
- *aptr = make_number((AWKNUM) sbuf.st_ino);
- unref(tmp);
-
- aptr = assoc_lookup(array, tmp = make_string("mode", 4), FALSE);
- *aptr = make_number((AWKNUM) sbuf.st_mode);
- unref(tmp);
-
- aptr = assoc_lookup(array, tmp = make_string("nlink", 5), FALSE);
- *aptr = make_number((AWKNUM) sbuf.st_nlink);
- unref(tmp);
-
- aptr = assoc_lookup(array, tmp = make_string("uid", 3), FALSE);
- *aptr = make_number((AWKNUM) sbuf.st_uid);
- unref(tmp);
-
- aptr = assoc_lookup(array, tmp = make_string("gid", 3), FALSE);
- *aptr = make_number((AWKNUM) sbuf.st_gid);
- unref(tmp);
-
- aptr = assoc_lookup(array, tmp = make_string("size", 4), FALSE);
- *aptr = make_number((AWKNUM) sbuf.st_size);
- unref(tmp);
-
- aptr = assoc_lookup(array, tmp = make_string("blocks", 6), FALSE);
- *aptr = make_number((AWKNUM) sbuf.st_blocks);
- unref(tmp);
-
- aptr = assoc_lookup(array, tmp = make_string("atime", 5), FALSE);
- *aptr = make_number((AWKNUM) sbuf.st_atime);
- unref(tmp);
-
- aptr = assoc_lookup(array, tmp = make_string("mtime", 5), FALSE);
- *aptr = make_number((AWKNUM) sbuf.st_mtime);
- unref(tmp);
-
- aptr = assoc_lookup(array, tmp = make_string("ctime", 5), FALSE);
- *aptr = make_number((AWKNUM) sbuf.st_ctime);
- unref(tmp);
+ array_set(array, "name", dupnode(file));
+ array_set(array, "dev", make_number((AWKNUM) sbuf.st_dev));
+ array_set(array, "ino", make_number((AWKNUM) sbuf.st_ino));
+ array_set(array, "mode", make_number((AWKNUM) sbuf.st_mode));
+ array_set(array, "nlink", make_number((AWKNUM) sbuf.st_nlink));
+ array_set(array, "uid", make_number((AWKNUM) sbuf.st_uid));
+ array_set(array, "gid", make_number((AWKNUM) sbuf.st_gid));
+ array_set(array, "size", make_number((AWKNUM) sbuf.st_size));
+ array_set(array, "blocks", make_number((AWKNUM) sbuf.st_blocks));
+ array_set(array, "atime", make_number((AWKNUM) sbuf.st_atime));
+ array_set(array, "mtime", make_number((AWKNUM) sbuf.st_mtime));
+ array_set(array, "ctime", make_number((AWKNUM) sbuf.st_ctime));
/* for block and character devices, add rdev, major and minor numbers */
if (S_ISBLK(sbuf.st_mode) || S_ISCHR(sbuf.st_mode)) {
- aptr = assoc_lookup(array, tmp = make_string("rdev", 4), FALSE);
- *aptr = make_number((AWKNUM) sbuf.st_rdev);
- unref(tmp);
-
- aptr = assoc_lookup(array, tmp = make_string("major", 5), FALSE);
- *aptr = make_number((AWKNUM) major(sbuf.st_rdev));
- unref(tmp);
-
- aptr = assoc_lookup(array, tmp = make_string("minor", 5), FALSE);
- *aptr = make_number((AWKNUM) minor(sbuf.st_rdev));
- unref(tmp);
+ array_set(array, "rdev", make_number((AWKNUM) sbuf.st_rdev));
+ array_set(array, "major", make_number((AWKNUM) major(sbuf.st_rdev)));
+ array_set(array, "minor", make_number((AWKNUM) minor(sbuf.st_rdev)));
}
#ifdef HAVE_ST_BLKSIZE
- aptr = assoc_lookup(array, tmp = make_string("blksize", 7), FALSE);
- *aptr = make_number((AWKNUM) sbuf.st_blksize);
- unref(tmp);
+ array_set(array, "blksize", make_number((AWKNUM) sbuf.st_blksize));
#endif /* HAVE_ST_BLKSIZE */
- aptr = assoc_lookup(array, tmp = make_string("pmode", 5), FALSE);
pmode = format_mode(sbuf.st_mode);
- *aptr = make_string(pmode, strlen(pmode));
- unref(tmp);
+ array_set(array, "pmode", make_string(pmode, strlen(pmode)));
/* for symbolic links, add a linkval field */
if (S_ISLNK(sbuf.st_mode)) {
char *buf;
- int linksize;
-
- emalloc(buf, char *, sbuf.st_size + 2, "do_stat");
- if (((linksize = readlink(file->stptr, buf,
- sbuf.st_size + 2)) >= 0) &&
- (linksize <= sbuf.st_size)) {
- /*
- * set the linkval field only if we are able to
- * retrieve the entire link value successfully.
- */
- buf[linksize] = '\0';
-
- aptr = assoc_lookup(array, tmp = make_string("linkval", 7), FALSE);
- *aptr = make_str_node(buf, linksize, ALREADY_MALLOCED);
- unref(tmp);
- }
+ ssize_t linksize;
+
+ if ((buf = read_symlink(file->stptr, sbuf.st_size,
+ &linksize)) != NULL)
+ array_set(array, "linkval", make_str_node(buf, linksize, ALREADY_MALLOCED));
+ else
+ warning(_("unable to read symbolic link `%s'"),
+ file->stptr);
}
/* add a type field */
@@ -319,9 +330,7 @@ do_stat(int nargs)
#endif
}
- aptr = assoc_lookup(array, tmp = make_string("type", 4), FALSE);
- *aptr = make_string(type, strlen(type));
- unref(tmp);
+ array_set(array, "type", make_string(type, strlen(type)));
return make_number((AWKNUM) ret);
}
diff --git a/extension/fork.c b/extension/fork.c
index aff9b568..3c288c04 100644
--- a/extension/fork.c
+++ b/extension/fork.c
@@ -38,22 +38,24 @@ do_fork(int nargs)
NODE **aptr;
NODE *tmp;
- if (do_lint && get_curfunc_arg_count() > 0)
+ if (do_lint && nargs > 0)
lintwarn("fork: called with too many arguments");
ret = fork();
if (ret < 0)
- update_ERRNO();
- else if (ret == 0) {
+ update_ERRNO_int(errno);
+ else if (ret == 0 && PROCINFO_node != NULL) {
/* update PROCINFO in the child */
- aptr = assoc_lookup(PROCINFO_node, tmp = make_string("pid", 3), FALSE);
- (*aptr)->numbr = (AWKNUM) getpid();
+ aptr = assoc_lookup(PROCINFO_node, tmp = make_string("pid", 3));
+ unref(*aptr);
+ *aptr = make_number((AWKNUM) getpid());
unref(tmp);
- aptr = assoc_lookup(PROCINFO_node, tmp = make_string("ppid", 4), FALSE);
- (*aptr)->numbr = (AWKNUM) getppid();
+ aptr = assoc_lookup(PROCINFO_node, tmp = make_string("ppid", 4));
+ unref(*aptr);
+ *aptr = make_number((AWKNUM) getppid());
unref(tmp);
}
@@ -73,17 +75,17 @@ do_waitpid(int nargs)
pid_t pid;
int options = 0;
- if (do_lint && get_curfunc_arg_count() > 1)
+ if (do_lint && nargs > 1)
lintwarn("waitpid: called with too many arguments");
- pidnode = get_scalar_argument(0, FALSE);
+ pidnode = get_scalar_argument(0, false);
if (pidnode != NULL) {
- pidval = force_number(pidnode);
+ pidval = get_number_d(pidnode);
pid = (int) pidval;
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");
@@ -91,6 +93,25 @@ do_waitpid(int nargs)
return make_number((AWKNUM) ret);
}
+
+/* do_wait --- provide dynamically loaded wait() builtin for gawk */
+
+static NODE *
+do_wait(int nargs)
+{
+ int ret;
+
+ if (do_lint && nargs > 0)
+ lintwarn("wait: called with too many arguments");
+
+ ret = wait(NULL);
+ if (ret < 0)
+ update_ERRNO_int(errno);
+
+ /* Set the return value */
+ return make_number((AWKNUM) ret);
+}
+
/* dlload --- load new builtins in this library */
NODE *
@@ -100,5 +121,6 @@ void *dl;
{
make_builtin("fork", do_fork, 0);
make_builtin("waitpid", do_waitpid, 1);
+ make_builtin("wait", do_wait, 0);
return make_number((AWKNUM) 0);
}
diff --git a/extension/ordchr.c b/extension/ordchr.c
index efbc6d56..6abda181 100644
--- a/extension/ordchr.c
+++ b/extension/ordchr.c
@@ -40,10 +40,10 @@ do_ord(int nargs)
NODE *str;
int ret = -1;
- if (do_lint && get_curfunc_arg_count() > 1)
+ if (do_lint && nargs > 1)
lintwarn("ord: called with too many arguments");
- str = get_scalar_argument(0, FALSE);
+ str = get_scalar_argument(0, false);
if (str != NULL) {
(void) force_string(str);
ret = str->stptr[0];
@@ -67,12 +67,12 @@ do_chr(int nargs)
str[0] = str[1] = '\0';
- if (do_lint && get_curfunc_arg_count() > 1)
+ if (do_lint && nargs > 1)
lintwarn("chr: called with too many arguments");
- num = get_scalar_argument(0, FALSE);
+ num = get_scalar_argument(0, false);
if (num != NULL) {
- val = force_number(num);
+ val = get_number_d(num);
ret = val; /* convert to int */
ret &= 0xff;
str[0] = ret;
diff --git a/extension/readfile.c b/extension/readfile.c
index e6ee0f22..17e70a6d 100644
--- a/extension/readfile.c
+++ b/extension/readfile.c
@@ -41,7 +41,7 @@ int plugin_is_GPL_compatible;
/* do_readfile --- read a file into memory */
-NODE *
+static NODE *
do_readfile(int nargs)
{
NODE *filename;
@@ -50,27 +50,27 @@ do_readfile(int nargs)
char *text;
int fd;
- if (do_lint && get_curfunc_arg_count() > 1)
+ if (do_lint && nargs > 1)
lintwarn("readfile: called with too many arguments");
- filename = get_scalar_argument(0, FALSE);
+ filename = get_scalar_argument(0, false);
if (filename != NULL) {
(void) force_string(filename);
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 3c629579..fed040fc 100644
--- a/extension/rwarray.c
+++ b/extension/rwarray.c
@@ -82,12 +82,12 @@ do_writea(int nargs)
uint32_t major = MAJOR;
uint32_t minor = MINOR;
- if (do_lint && get_curfunc_arg_count() > 2)
+ if (do_lint && nargs > 2)
lintwarn("writea: called with too many arguments");
/* directory is first arg, array to dump is second */
- file = get_scalar_argument(0, FALSE);
- array = get_array_argument(1, FALSE);
+ file = get_scalar_argument(0, false);
+ array = get_array_argument(1, false);
/* open the file, if error, set ERRNO and return */
(void) force_string(file);
@@ -115,7 +115,7 @@ do_writea(int nargs)
done1:
ret = -1;
- update_ERRNO();
+ update_ERRNO_int(errno);
unlink(file->stptr);
done0:
@@ -250,12 +250,12 @@ do_reada(int nargs)
uint32_t minor;
char magic_buf[30];
- if (do_lint && get_curfunc_arg_count() > 2)
+ if (do_lint && nargs > 2)
lintwarn("reada: called with too many arguments");
/* directory is first arg, array to dump is second */
- file = get_scalar_argument(0, FALSE);
- array = get_array_argument(1, FALSE);
+ file = get_scalar_argument(0, false);
+ array = get_array_argument(1, false);
(void) force_string(file);
fd = open(file->stptr, O_RDONLY);
@@ -289,7 +289,7 @@ do_reada(int nargs)
goto done1;
}
- assoc_clear(array);
+ assoc_clear(array, NULL);
ret = read_array(fd, array);
if (ret == 0)
@@ -297,7 +297,7 @@ do_reada(int nargs)
done1:
ret = -1;
- update_ERRNO();
+ update_ERRNO_int(errno);
done0:
close(fd);
diff --git a/extension/testarg.c b/extension/testarg.c
index ba4d56ff..32481b33 100644
--- a/extension/testarg.c
+++ b/extension/testarg.c
@@ -5,20 +5,18 @@ int plugin_is_GPL_compatible;
static NODE *
do_check_arg(int nargs)
{
- int ret = 0, argc;
+ int ret = 0;
NODE *arg1, *arg2, *arg3;
- argc = get_curfunc_arg_count();
- printf("arg count: defined = %d, supplied = %d\n",
- nargs, argc);
+ printf("arg count: defined = 3, supplied = %d\n", nargs);
- arg1 = get_scalar_argument(0, FALSE);
- arg2 = get_array_argument(1, FALSE);
- arg3 = get_scalar_argument(2, TRUE); /* optional */
- if (argc > 3) {
+ arg1 = get_scalar_argument(0, false);
+ arg2 = get_array_argument(1, false);
+ arg3 = get_scalar_argument(2, true); /* optional */
+ if (nargs > 3) {
/* try to use an extra arg */
NODE *arg4;
- arg4 = get_array_argument(3, TRUE);
+ arg4 = get_array_argument(3, true);
printf("Shouldn't see this line\n");
}
if (arg3 != NULL) {