diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2021-11-07 20:40:12 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2021-11-07 20:40:12 +0200 |
commit | 6eb946af4f5e07e400844dbab6ac38996946647a (patch) | |
tree | 707813b6ae0397d7f6629d9d5d5140ae55395d3c | |
parent | 55e7531df0431b64d3554125190efaeea566885a (diff) | |
download | egawk-6eb946af4f5e07e400844dbab6ac38996946647a.tar.gz egawk-6eb946af4f5e07e400844dbab6ac38996946647a.tar.bz2 egawk-6eb946af4f5e07e400844dbab6ac38996946647a.zip |
Remove some unused files.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | extension/ChangeLog | 5 | ||||
-rw-r--r-- | extension/Makefile.am | 5 | ||||
-rw-r--r-- | extension/Makefile.in | 5 | ||||
-rw-r--r-- | extension/rwarray0.c | 470 | ||||
-rwxr-xr-x | mkinstalldirs | 162 | ||||
-rw-r--r-- | po/ChangeLog | 4 | ||||
-rw-r--r-- | po/POTFILES.in | 1 |
9 files changed, 17 insertions, 642 deletions
@@ -1,3 +1,8 @@ +2021-11-07 Arnold D. Robbins <arnold@skeeve.com> + + * mkinstalldirs: Removed, it wasn't used. + * Makefile.in: Regenerated. + 2021-11-03 Sam James <sam@gentoo.org> * configure.ac: Fix AR_FLAGS assignment typo. diff --git a/Makefile.in b/Makefile.in index 7c16c394..40f2b043 100644 --- a/Makefile.in +++ b/Makefile.in @@ -288,7 +288,7 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/configh.in \ build-aux/compile build-aux/config.guess \ build-aux/config.rpath build-aux/config.sub build-aux/depcomp \ build-aux/install-sh build-aux/ltmain.sh build-aux/missing \ - build-aux/texinfo.tex build-aux/ylwrap command.c mkinstalldirs + build-aux/texinfo.tex build-aux/ylwrap command.c DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) diff --git a/extension/ChangeLog b/extension/ChangeLog index 8ee151ff..91cdf48e 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,8 @@ +2021-11-07 Arnold D. Robbins <arnold@skeeve.com> + + * rwarray0.c: Removed, it wasn't used. + * Makefile.am: Updated. + 2021-10-27 Arnold D. Robbins <arnold@skeeve.com> * 5.1.1: Release tar ball made. diff --git a/extension/Makefile.am b/extension/Makefile.am index dbd68797..ce290857 100644 --- a/extension/Makefile.am +++ b/extension/Makefile.am @@ -33,8 +33,6 @@ ACLOCAL_AMFLAGS = -I ../m4 # For some make's, e.g. OpenBSD, that don't define this RM = rm -f -# Note: rwarray does not currently compile. - pkgextension_LTLIBRARIES = \ filefuncs.la \ fnmatch.la \ @@ -142,8 +140,7 @@ EXTRA_DIST = \ ChangeLog.1 \ ext_custom.h \ fts.3 \ - README.fts \ - rwarray0.c + README.fts dist_man_MANS = \ filefuncs.3am fnmatch.3am fork.3am inplace.3am \ diff --git a/extension/Makefile.in b/extension/Makefile.in index 737d7fa7..987f48c6 100644 --- a/extension/Makefile.in +++ b/extension/Makefile.in @@ -568,8 +568,6 @@ ACLOCAL_AMFLAGS = -I ../m4 # For some make's, e.g. OpenBSD, that don't define this RM = rm -f - -# Note: rwarray does not currently compile. pkgextension_LTLIBRARIES = \ filefuncs.la \ fnmatch.la \ @@ -652,8 +650,7 @@ EXTRA_DIST = \ ChangeLog.1 \ ext_custom.h \ fts.3 \ - README.fts \ - rwarray0.c + README.fts dist_man_MANS = \ filefuncs.3am fnmatch.3am fork.3am inplace.3am \ diff --git a/extension/rwarray0.c b/extension/rwarray0.c deleted file mode 100644 index 5ff61c80..00000000 --- a/extension/rwarray0.c +++ /dev/null @@ -1,470 +0,0 @@ -/* - * rwarray.c - Builtin functions to binary read / write arrays to a file. - * - * Arnold Robbins - * May 2009 - * Redone June 2012 - */ - -/* - * Copyright (C) 2009, 2010, 2011, 2012, 2013, 2018, 2020, 2021, - * 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 - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <assert.h> -#include <errno.h> -#include <fcntl.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include <arpa/inet.h> -#include <sys/types.h> -#include <sys/stat.h> - -#include "gawkapi.h" - -#include "gettext.h" -#define _(msgid) gettext(msgid) -#define N_(msgid) msgid - -#define MAGIC "awkrulz\n" -#define MAJOR 3 -#define MINOR 0 - -static const gawk_api_t *api; /* for convenience macros to work */ -static awk_ext_id_t ext_id; -static const char *ext_version = "rwarray0 extension: version 1.0"; -static awk_bool_t (*init_func)(void) = NULL; - -int plugin_is_GPL_compatible; - -static awk_bool_t write_array(int fd, awk_array_t array); -static awk_bool_t write_elem(int fd, awk_element_t *element); -static awk_bool_t write_value(int fd, awk_value_t *val); - -static awk_bool_t read_array(int fd, awk_array_t array); -static awk_bool_t read_elem(int fd, awk_element_t *element); -static awk_bool_t read_value(int fd, awk_value_t *value); - -/* - * Format of array info: - * - * MAGIC 8 bytes - * Major version 4 bytes - network order - * Minor version 4 bytes - network order - * Element count 4 bytes - network order - * Elements - * - * For each element: - * Length of index val: 4 bytes - network order - * Index val as characters (N bytes) - * Value type 4 bytes (0 = string, 1 = number, 2 = array) - * IF string: - * Length of value 4 bytes - * Value as characters (N bytes) - * ELSE IF number: - * 8 bytes as native double - * ELSE - * Element count - * Elements - * END IF - */ - -/* do_writea --- write an array */ - -static awk_value_t * -do_writea(int nargs, awk_value_t *result, struct awk_ext_func *unused) -{ - awk_value_t filename, array; - int fd = -1; - uint32_t major = MAJOR; - uint32_t minor = MINOR; - - assert(result != NULL); - make_number(0.0, result); - - if (nargs < 2) - goto out; - - /* directory is first arg, array to dump is second */ - if (! get_argument(0, AWK_STRING, & filename)) { - warning(ext_id, _("do_writea: argument 0 is not a string")); - errno = EINVAL; - goto done1; - } - - if (! get_argument(1, AWK_ARRAY, & array)) { - warning(ext_id, _("do_writea: argument 1 is not an array")); - errno = EINVAL; - goto done1; - } - - /* open the file, if error, set ERRNO and return */ - fd = creat(filename.str_value.str, 0600); - if (fd < 0) - goto done1; - - if (write(fd, MAGIC, strlen(MAGIC)) != strlen(MAGIC)) - goto done1; - - major = htonl(major); - if (write(fd, & major, sizeof(major)) != sizeof(major)) - goto done1; - - minor = htonl(minor); - if (write(fd, & minor, sizeof(minor)) != sizeof(minor)) - goto done1; - - if (write_array(fd, array.array_cookie)) { - make_number(1.0, result); - goto done0; - } - -done1: - update_ERRNO_int(errno); - unlink(filename.str_value.str); - -done0: - close(fd); -out: - return result; -} - - -/* write_array --- write out an array or a sub-array */ - -static awk_bool_t -write_array(int fd, awk_array_t array) -{ - uint32_t i; - uint32_t count; - awk_flat_array_t *flat_array; - - if (! flatten_array(array, & flat_array)) { - warning(ext_id, _("write_array: could not flatten array")); - return awk_false; - } - - count = htonl(flat_array->count); - if (write(fd, & count, sizeof(count)) != sizeof(count)) - return awk_false; - - for (i = 0; i < flat_array->count; i++) { - if (! write_elem(fd, & flat_array->elements[i])) - return awk_false; - } - - if (! release_flattened_array(array, flat_array)) { - warning(ext_id, _("write_array: could not release flattened array")); - return awk_false; - } - - return awk_true; -} - -/* write_elem --- write out a single element */ - -static awk_bool_t -write_elem(int fd, awk_element_t *element) -{ - uint32_t indexval_len; - ssize_t write_count; - - indexval_len = htonl(element->index.str_value.len); - if (write(fd, & indexval_len, sizeof(indexval_len)) != sizeof(indexval_len)) - return awk_false; - - if (element->index.str_value.len > 0) { - write_count = write(fd, element->index.str_value.str, - element->index.str_value.len); - if (write_count != (ssize_t) element->index.str_value.len) - return awk_false; - } - - return write_value(fd, & element->value); -} - -/* write_value --- write a number or a string or a array */ - -static awk_bool_t -write_value(int fd, awk_value_t *val) -{ - uint32_t code, len; - - if (val->val_type == AWK_ARRAY) { - code = htonl(2); - if (write(fd, & code, sizeof(code)) != sizeof(code)) - return awk_false; - return write_array(fd, val->array_cookie); - } - - if (val->val_type == AWK_NUMBER) { - code = htonl(1); - if (write(fd, & code, sizeof(code)) != sizeof(code)) - return awk_false; - - if (write(fd, & val->num_value, sizeof(val->num_value)) != sizeof(val->num_value)) - return awk_false; - } else { - code = 0; - if (write(fd, & code, sizeof(code)) != sizeof(code)) - return awk_false; - - len = htonl(val->str_value.len); - if (write(fd, & len, sizeof(len)) != sizeof(len)) - return awk_false; - - if (write(fd, val->str_value.str, val->str_value.len) - != (ssize_t) val->str_value.len) - return awk_false; - } - - return awk_true; -} - -/* do_reada --- read an array */ - -static awk_value_t * -do_reada(int nargs, awk_value_t *result, struct awk_ext_func *unused) -{ - awk_value_t filename, array; - int fd = -1; - uint32_t major; - uint32_t minor; - char magic_buf[30]; - - assert(result != NULL); - make_number(0.0, result); - - if (nargs < 2) - goto out; - - /* directory is first arg, array to read is second */ - if (! get_argument(0, AWK_STRING, & filename)) { - warning(ext_id, _("do_reada: argument 0 is not a string")); - errno = EINVAL; - goto done1; - } - - if (! get_argument(1, AWK_ARRAY, & array)) { - warning(ext_id, _("do_reada: argument 1 is not an array")); - errno = EINVAL; - goto done1; - } - - fd = open(filename.str_value.str, O_RDONLY); - if (fd < 0) - goto done1; - - memset(magic_buf, '\0', sizeof(magic_buf)); - if (read(fd, magic_buf, strlen(MAGIC)) != strlen(MAGIC)) { - errno = EBADF; - goto done1; - } - - if (strcmp(magic_buf, MAGIC) != 0) { - errno = EBADF; - goto done1; - } - - if (read(fd, & major, sizeof(major)) != sizeof(major)) { - errno = EBADF; - goto done1; - } - major = ntohl(major); - - if (major != MAJOR) { - errno = EBADF; - goto done1; - } - - if (read(fd, & minor, sizeof(minor)) != sizeof(minor)) { - /* read() sets errno */ - goto done1; - } - - minor = ntohl(minor); - if (minor != MINOR) { - errno = EBADF; - goto done1; - } - - if (! clear_array(array.array_cookie)) { - errno = ENOMEM; - warning(ext_id, _("do_reada: clear_array failed")); - goto done1; - } - - if (read_array(fd, array.array_cookie)) { - make_number(1.0, result); - goto done0; - } - -done1: - update_ERRNO_int(errno); -done0: - close(fd); -out: - return result; -} - - -/* read_array --- read in an array or sub-array */ - -static awk_bool_t -read_array(int fd, awk_array_t array) -{ - uint32_t i; - uint32_t count; - awk_element_t new_elem; - - if (read(fd, & count, sizeof(count)) != sizeof(count)) { - return awk_false; - } - count = ntohl(count); - - for (i = 0; i < count; i++) { - if (read_elem(fd, & new_elem)) { - /* add to array */ - if (! set_array_element_by_elem(array, & new_elem)) { - warning(ext_id, _("read_array: set_array_element failed")); - return awk_false; - } - } else - break; - } - - if (i != count) - return awk_false; - - return awk_true; -} - -/* read_elem --- read in a single element */ - -static awk_bool_t -read_elem(int fd, awk_element_t *element) -{ - uint32_t index_len; - static char *buffer; - static uint32_t buflen; - ssize_t ret; - - if ((ret = read(fd, & index_len, sizeof(index_len))) != sizeof(index_len)) { - return awk_false; - } - index_len = ntohl(index_len); - - memset(element, 0, sizeof(*element)); - - if (index_len > 0) { - if (buffer == NULL) { - // allocate buffer - emalloc(buffer, char *, index_len, "read_elem"); - buflen = index_len; - } else if (buflen < index_len) { - // reallocate buffer - char *cp = realloc(buffer, index_len); - - if (cp == NULL) - return awk_false; - - buffer = cp; - buflen = index_len; - } - - if (read(fd, buffer, index_len) != (ssize_t) index_len) { - return awk_false; - } - make_const_string(buffer, index_len, & element->index); - } else { - make_null_string(& element->index); - } - - if (! read_value(fd, & element->value)) - return awk_false; - - return awk_true; -} - -/* read_value --- read a number or a string */ - -static awk_bool_t -read_value(int fd, awk_value_t *value) -{ - uint32_t code, len; - - if (read(fd, & code, sizeof(code)) != sizeof(code)) - return awk_false; - - code = ntohl(code); - - if (code == 2) { - awk_array_t array = create_array(); - - if (! read_array(fd, array)) - return awk_false; - - /* hook into value */ - value->val_type = AWK_ARRAY; - value->array_cookie = array; - } else if (code == 1) { - double d; - - if (read(fd, & d, sizeof(d)) != sizeof(d)) - return awk_false; - - /* hook into value */ - value->val_type = AWK_NUMBER; - value->num_value = d; - } else { - if (read(fd, & len, sizeof(len)) != sizeof(len)) { - return awk_false; - } - len = ntohl(len); - value->val_type = AWK_STRING; - value->str_value.len = len; - value->str_value.str = malloc(len + 1); - - if (read(fd, value->str_value.str, len) != (ssize_t) len) { - free(value->str_value.str); - return awk_false; - } - value->str_value.str[len] = '\0'; - } - - return awk_true; -} - -static awk_ext_func_t func_table[] = { - { "writea", do_writea, 2, 2, awk_false, NULL }, - { "reada", do_reada, 2, 2, awk_false, NULL }, -}; - - -/* define the dl_load function using the boilerplate macro */ - -dl_load_func(func_table, rwarray, "") diff --git a/mkinstalldirs b/mkinstalldirs deleted file mode 100755 index 36aa9095..00000000 --- a/mkinstalldirs +++ /dev/null @@ -1,162 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy - -scriptversion=2018-03-07.03; # UTC - -# Original author: Noah Friedman <friedman@prep.ai.mit.edu> -# Created: 1993-05-16 -# Public domain. -# -# This file is maintained in Automake, please report -# bugs to <bug-automake@gnu.org> or send patches to -# <automake-patches@gnu.org>. - -nl=' -' -IFS=" "" $nl" -errstatus=0 -dirmode= - -usage="\ -Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... - -Create each directory DIR (with mode MODE, if specified), including all -leading file name components. - -Report bugs to <bug-automake@gnu.org>." - -# process command line arguments -while test $# -gt 0 ; do - case $1 in - -h | --help | --h*) # -h for help - echo "$usage" - exit $? - ;; - -m) # -m PERM arg - shift - test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } - dirmode=$1 - shift - ;; - --version) - echo "$0 $scriptversion" - exit $? - ;; - --) # stop option processing - shift - break - ;; - -*) # unknown option - echo "$usage" 1>&2 - exit 1 - ;; - *) # first non-opt arg - break - ;; - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in - 0) exit 0 ;; -esac - -# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and -# mkdir -p a/c at the same time, both will detect that a is missing, -# one will create a, then the other will try to create a and die with -# a "File exists" error. This is a problem when calling mkinstalldirs -# from a parallel make. We use --version in the probe to restrict -# ourselves to GNU mkdir, which is thread-safe. -case $dirmode in - '') - if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - else - # On NextStep and OpenStep, the 'mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because '.' already - # exists. - test -d ./-p && rmdir ./-p - test -d ./--version && rmdir ./--version - fi - ;; - *) - if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && - test ! -d ./--version; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - else - # Clean up after NextStep and OpenStep mkdir. - for d in ./-m ./-p ./--version "./$dirmode"; - do - test -d $d && rmdir $d - done - fi - ;; -esac - -for file -do - case $file in - /*) pathcomp=/ ;; - *) pathcomp= ;; - esac - oIFS=$IFS - IFS=/ - set fnord $file - shift - IFS=$oIFS - - for d - do - test "x$d" = x && continue - - pathcomp=$pathcomp$d - case $pathcomp in - -*) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - lasterr= - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp=$pathcomp/ - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC0" -# time-stamp-end: "; # UTC" -# End: diff --git a/po/ChangeLog b/po/ChangeLog index e9a15fbe..59d1abb5 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,7 @@ +2021-11-07 Arnold D. Robbins <arnold@skeeve.com> + + * POTFILES.in: Remove extension/rwarray0.c. + 2021-10-27 Arnold D. Robbins <arnold@skeeve.com> * 5.1.1: Release tar ball made. diff --git a/po/POTFILES.in b/po/POTFILES.in index bc8c9c72..cd12f28b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -20,7 +20,6 @@ extension/readfile.c extension/revoutput.c extension/revtwoway.c extension/rwarray.c -extension/rwarray0.c extension/stack.c extension/testext.c extension/time.c |