hexcurse: Backport patch to show help
authorFredrik Fornwall <fredrik@fornwall.net>
Sat, 16 Jan 2016 13:51:45 +0000 (08:51 -0500)
committerFredrik Fornwall <fredrik@fornwall.net>
Sat, 16 Jan 2016 13:51:45 +0000 (08:51 -0500)
Add patch from unreleased version which shows help if no filename
argument is supplied.

packages/hexcurse/build.sh
packages/hexcurse/hexcurse.c.patch [new file with mode: 0644]

index 1d7543e..7a1a1b5 100644 (file)
@@ -1,6 +1,7 @@
 TERMUX_PKG_HOMEPAGE=https://github.com/LonnyGomes/hexcurse
 TERMUX_PKG_DESCRIPTION="Console hexeditor"
 TERMUX_PKG_VERSION=1.60.0
+TERMUX_PKG_BUILD_REVISION=1
 TERMUX_PKG_SRCURL=https://github.com/LonnyGomes/hexcurse/archive/v${TERMUX_PKG_VERSION}.tar.gz
 TERMUX_PKG_FOLDERNAME=hexcurse-${TERMUX_PKG_VERSION}
 TERMUX_PKG_DEPENDS="ncurses"
diff --git a/packages/hexcurse/hexcurse.c.patch b/packages/hexcurse/hexcurse.c.patch
new file mode 100644 (file)
index 0000000..f8c2a62
--- /dev/null
@@ -0,0 +1,28 @@
+From 37f94f2c1d0a3cc5110b2771e02ed894522d65d3 Mon Sep 17 00:00:00 2001
+From: Lonny Gomes <code@lonnygomes.com>
+Date: Wed, 18 Nov 2015 23:57:31 -0500
+Subject: [PATCH] Fixes #23, shows help if no filename argument is supplied
+
+---
+ src/hexcurse.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/hexcurse.c b/src/hexcurse.c
+index 9a275ee..9342eb5 100644
+--- a/src/hexcurse.c
++++ b/src/hexcurse.c
+@@ -217,9 +217,13 @@ off_t parseArgs(int argc, char *argv[])
+         fpINfilename = strdup(argv[0]);
+     }
+-    if (fpINfilename && strcmp(fpINfilename, ""))
++    if (fpINfilename == NULL) {
++        print_usage();
++        exit(-1);
++    } else if (fpINfilename && strcmp(fpINfilename, "")) {
+         if ((fpIN = fopen(fpINfilename, "r")) == NULL)
+             exit_err("Could not open file");
++    }
+     return ((fpIN != NULL) ? maxLoc(fpIN):0);         /* return file length */
+ }