diff -uNr renameutils-0.12.0/src/common/Makefile.am renameutils-0.12.0.mod/src/common/Makefile.am
--- renameutils-0.12.0/src/common/Makefile.am	2012-04-23 14:11:04.000000000 +0300
+++ renameutils-0.12.0.mod/src/common/Makefile.am	2020-01-02 20:43:15.306228148 +0200
@@ -25,4 +25,6 @@
 	tab-utils.c \
 	tab-utils.h \
 	tmap.c \
-	tmap.h
+	tmap.h \
+	wordexp.c \
+	wordexp.h
diff -uNr renameutils-0.12.0/src/common/Makefile.in renameutils-0.12.0.mod/src/common/Makefile.in
--- renameutils-0.12.0/src/common/Makefile.in	2012-04-23 14:24:10.000000000 +0300
+++ renameutils-0.12.0.mod/src/common/Makefile.in	2020-01-02 20:47:56.755267916 +0200
@@ -156,7 +156,7 @@
 am_lib_common_a_OBJECTS = error.$(OBJEXT) hmap.$(OBJEXT) \
 	io-utils.$(OBJEXT) intutil.$(OBJEXT) llist.$(OBJEXT) \
 	strbuf.$(OBJEXT) string-utils.$(OBJEXT) tab-utils.$(OBJEXT) \
-	tmap.$(OBJEXT)
+	tmap.$(OBJEXT) wordexp.$(OBJEXT)
 lib_common_a_OBJECTS = $(am_lib_common_a_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
@@ -997,7 +997,9 @@
 	tab-utils.c \
 	tab-utils.h \
 	tmap.c \
-	tmap.h
+	tmap.h \
+	wordexp.c \
+	wordexp.h
 
 all: all-am
 
diff -uNr renameutils-0.12.0/src/common/wordexp.c renameutils-0.12.0.mod/src/common/wordexp.c
--- renameutils-0.12.0/src/common/wordexp.c	1970-01-01 03:00:00.000000000 +0300
+++ renameutils-0.12.0.mod/src/common/wordexp.c	2020-01-02 20:41:33.516494851 +0200
@@ -0,0 +1,194 @@
+#include "wordexp.h"
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+#include <signal.h>
+#include <errno.h>
+#include <fcntl.h>
+//##include <bthread.h>
+#include <sys/types.h>
+static void reap(pid_t pid)
+{
+	int status;
+	for (;;) {
+		if (waitpid(pid, &status, 0) < 0) {
+			if (errno != EINTR) return;
+		} else {
+			if (WIFEXITED(status)) return;
+		}
+	}
+}
+
+static char *getword(FILE *f)
+{
+	char *s = 0;
+	return getdelim(&s, (size_t [1]){0}, 0, f) < 0 ? 0 : s;
+}
+
+static int do_wordexp(const char *s, wordexp_t *we, int flags)
+{
+	size_t i, l;
+	int sq=0, dq=0;
+	size_t np=0;
+	char *w, **tmp;
+	char *redir = (flags & WRDE_SHOWERR) ? "" : "2>/dev/null";
+	int err = 0;
+	FILE *f;
+	size_t wc = 0;
+	char **wv = 0;
+	int p[2];
+	pid_t pid;
+	sigset_t set;
+	sigset_t all_set;
+	if (flags & WRDE_REUSE) wordfree(we);
+
+	if (flags & WRDE_NOCMD) for (i=0; s[i]; i++) switch (s[i]) {
+	case '\\':
+		if (!sq) i++;
+		break;
+	case '\'':
+		if (!dq) sq^=1;
+		break;
+	case '"':
+		if (!sq) dq^=1;
+		break;
+	case '(':
+		if (np) {
+			np++;
+			break;
+		}
+	case ')':
+		if (np) {
+			np--;
+			break;
+		}
+	case '\n':
+	case '|':
+	case '&':
+	case ';':
+	case '<':
+	case '>':
+	case '{':
+	case '}':
+		if (!(sq|dq|np)) return WRDE_BADCHAR;
+		break;
+	case '$':
+		if (sq) break;
+		if (s[i+1]=='(' && s[i+2]=='(') {
+			i += 2;
+			np += 2;
+			break;
+		} else if (s[i+1] != '(') break;
+	case '`':
+		if (sq) break;
+		return WRDE_CMDSUB;
+	}
+
+	if (flags & WRDE_APPEND) {
+		wc = we->we_wordc;
+		wv = we->we_wordv;
+	}
+
+	i = wc;
+	if (flags & WRDE_DOOFFS) {
+		if (we->we_offs > SIZE_MAX/sizeof(void *)/4)
+			goto nospace;
+		i += we->we_offs;
+	} else {
+		we->we_offs = 0;
+	}
+
+	if (pipe2(p, O_CLOEXEC) < 0) goto nospace;
+//	sigfillset(&all_set);
+//	sigprocmask(SIG_SETMASK, &all_set, &set);
+	pid = fork();
+//	sigprocmask(SIG_SETMASK, &set, &all_set);
+	if (pid < 0) {
+		close(p[0]);
+		close(p[1]);
+		goto nospace;
+	}
+	if (!pid) {
+		if (p[1] == 1) fcntl(1, F_SETFD, 0);
+		else dup2(p[1], 1);
+		execl("@TERMUX_PREFIX@/bin/sh", "sh", "-c",
+			"eval \"printf %s\\\\\\\\0 x $1 $2\"",
+			"sh", s, redir, (char *)0);
+		_exit(1);
+	}
+	close(p[1]);
+	
+	f = fdopen(p[0], "r");
+	if (!f) {
+		close(p[0]);
+		kill(pid, SIGKILL);
+		reap(pid);
+		goto nospace;
+	}
+
+	l = wv ? i+1 : 0;
+
+	free(getword(f));
+	if (feof(f)) {
+		fclose(f);
+		reap(pid);
+		return WRDE_SYNTAX;
+	}
+
+	while ((w = getword(f))) {
+		if (i+1 >= l) {
+			l += l/2+10;
+			tmp = realloc(wv, l*sizeof(char *));
+			if (!tmp) break;
+			wv = tmp;
+		}
+		wv[i++] = w;
+		wv[i] = 0;
+	}
+	if (!feof(f)) err = WRDE_NOSPACE;
+
+	fclose(f);
+	reap(pid);
+
+	if (!wv) wv = calloc(i+1, sizeof *wv);
+
+	we->we_wordv = wv;
+	we->we_wordc = i;
+
+	if (flags & WRDE_DOOFFS) {
+		if (wv) for (i=we->we_offs; i; i--)
+			we->we_wordv[i-1] = 0;
+		we->we_wordc -= we->we_offs;
+	}
+	return err;
+
+nospace:
+	if (!(flags & WRDE_APPEND)) {
+		we->we_wordc = 0;
+		we->we_wordv = 0;
+	}
+	return WRDE_NOSPACE;
+}
+
+int wordexp(const char *restrict s, wordexp_t *restrict we, int flags)
+{
+	int r, cs;
+	//pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
+	r = do_wordexp(s, we, flags);
+	//pthread_setcancelstate(cs, 0);
+	return r;
+}
+
+void wordfree(wordexp_t *we)
+{
+	size_t i;
+	if (!we->we_wordv) return;
+	for (i=0; i<we->we_wordc; i++) free(we->we_wordv[we->we_offs+i]);
+	free(we->we_wordv);
+	we->we_wordv = 0;
+	we->we_wordc = 0;
+}
diff -uNr renameutils-0.12.0/src/common/wordexp.h renameutils-0.12.0.mod/src/common/wordexp.h
--- renameutils-0.12.0/src/common/wordexp.h	1970-01-01 03:00:00.000000000 +0300
+++ renameutils-0.12.0.mod/src/common/wordexp.h	2020-01-02 20:41:33.516494851 +0200
@@ -0,0 +1,41 @@
+#ifndef	_WORDEXP_H
+#define	_WORDEXP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+
+//#include <sys/types.h>
+
+#define WRDE_DOOFFS  1
+#define WRDE_APPEND  2
+#define WRDE_NOCMD   4
+#define WRDE_REUSE   8
+#define WRDE_SHOWERR 16
+#define WRDE_UNDEF   32
+#include <sys/types.h>
+typedef struct {
+	size_t we_wordc;
+	char **we_wordv;
+	size_t we_offs;
+} wordexp_t;
+
+#define WRDE_NOSYS   -1
+#define WRDE_NOSPACE 1
+#define WRDE_BADCHAR 2
+#define WRDE_BADVAL  3
+#define WRDE_CMDSUB  4
+#define WRDE_SYNTAX  5
+
+int wordexp (const char *__restrict, wordexp_t *__restrict, int);
+void wordfree (wordexp_t *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff -uNr renameutils-0.12.0/src/editformats/getsubopt.c renameutils-0.12.0.mod/src/editformats/getsubopt.c
--- renameutils-0.12.0/src/editformats/getsubopt.c	1970-01-01 03:00:00.000000000 +0300
+++ renameutils-0.12.0.mod/src/editformats/getsubopt.c	2020-01-02 20:56:21.548067937 +0200
@@ -0,0 +1,59 @@
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+char *suboptarg;
+
+int
+getsubopt(optionp, tokens, valuep)
+	char **optionp, **valuep;
+	char * const *tokens;
+{
+	int cnt;
+	char *p;
+
+	/* optionp is tested below */
+
+	suboptarg = *valuep = NULL;
+
+	if (!optionp || !*optionp)
+		return(-1);
+
+	/* skip leading white-space, commas */
+	for (p = *optionp; *p && (*p == ',' || *p == ' ' || *p == '\t'); ++p);
+
+	if (!*p) {
+		*optionp = p;
+		return(-1);
+	}
+
+	/* save the start of the token, and skip the rest of the token. */
+	for (suboptarg = p;
+	    *++p && *p != ',' && *p != '=' && *p != ' ' && *p != '\t';);
+
+	if (*p) {
+		/*
+		 * If there's an equals sign, set the value pointer, and
+		 * skip over the value part of the token.  Terminate the
+		 * token.
+		 */
+		if (*p == '=') {
+			*p = '\0';
+			for (*valuep = ++p;
+			    *p && *p != ',' && *p != ' ' && *p != '\t'; ++p);
+			if (*p) 
+				*p++ = '\0';
+		} else
+			*p++ = '\0';
+		/* Skip any whitespace or commas after this token. */
+		for (; *p && (*p == ',' || *p == ' ' || *p == '\t'); ++p);
+	}
+
+	/* set optionp for next round. */
+	*optionp = p;
+
+	for (cnt = 0; *tokens; ++tokens, ++cnt)
+		if (!strcmp(suboptarg, *tokens))
+			return(cnt);
+	return(-1);
+}
diff -uNr renameutils-0.12.0/src/editformats/Makefile.am renameutils-0.12.0.mod/src/editformats/Makefile.am
--- renameutils-0.12.0/src/editformats/Makefile.am	2012-04-23 14:11:26.000000000 +0300
+++ renameutils-0.12.0.mod/src/editformats/Makefile.am	2020-01-02 20:54:12.826838061 +0200
@@ -9,4 +9,5 @@
 lib_editformats_a_SOURCES = \
   destination-only.c \
   dual-column.c \
-  single-column.c
+  single-column.c \
+  getsubopt.c
diff -uNr renameutils-0.12.0/src/editformats/Makefile.in renameutils-0.12.0.mod/src/editformats/Makefile.in
--- renameutils-0.12.0/src/editformats/Makefile.in	2012-04-23 14:24:11.000000000 +0300
+++ renameutils-0.12.0.mod/src/editformats/Makefile.in	2020-01-02 20:55:04.196335228 +0200
@@ -154,7 +154,7 @@
 lib_editformats_a_AR = $(AR) $(ARFLAGS)
 lib_editformats_a_LIBADD =
 am_lib_editformats_a_OBJECTS = destination-only.$(OBJEXT) \
-	dual-column.$(OBJEXT) single-column.$(OBJEXT)
+	dual-column.$(OBJEXT) single-column.$(OBJEXT) getsubopt.$(OBJEXT)
 lib_editformats_a_OBJECTS = $(am_lib_editformats_a_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
@@ -979,7 +979,8 @@
 lib_editformats_a_SOURCES = \
   destination-only.c \
   dual-column.c \
-  single-column.c
+  single-column.c \
+  getsubopt.c
 
 all: all-am
 
diff -uNr renameutils-0.12.0/src/interactive.c renameutils-0.12.0.mod/src/interactive.c
--- renameutils-0.12.0/src/interactive.c	2008-09-21 12:10:31.000000000 +0300
+++ renameutils-0.12.0.mod/src/interactive.c	2020-01-02 20:45:42.994296610 +0200
@@ -23,9 +23,6 @@
 # include <sys/wait.h>	    	    	/* POSIX */
 #endif
 #include <unistd.h> 	    	    	/* gnulib (POSIX) */
-#if HAVE_WORDEXP_H
-#include <wordexp.h>	    	    	/* POSIX */
-#endif
 #include <signal.h> 	    	    	/* gnulib (POSIX) */
 #include <errno.h>  	    	    	/* C89 */
 #include <stdio.h>  	    	    	/* C89 */
@@ -45,6 +42,7 @@
 #include "common/comparison.h"
 #include "common/string-utils.h"
 #include "common/error.h"
+#include "common/wordexp.h"
 #include "qcmd.h"
 
 struct Command {
