chiark / gitweb /
vim: Use sensible.vim as system vimrc
[termux-packages] / packages / hexcurse / hexcurse.c.patch
1 From 37f94f2c1d0a3cc5110b2771e02ed894522d65d3 Mon Sep 17 00:00:00 2001
2 From: Lonny Gomes <code@lonnygomes.com>
3 Date: Wed, 18 Nov 2015 23:57:31 -0500
4 Subject: [PATCH] Fixes #23, shows help if no filename argument is supplied
5
6 ---
7  src/hexcurse.c | 6 +++++-
8  1 file changed, 5 insertions(+), 1 deletion(-)
9
10 diff --git a/src/hexcurse.c b/src/hexcurse.c
11 index 9a275ee..9342eb5 100644
12 --- a/src/hexcurse.c
13 +++ b/src/hexcurse.c
14 @@ -217,9 +217,13 @@ off_t parseArgs(int argc, char *argv[])
15          fpINfilename = strdup(argv[0]);
16      }
17  
18 -    if (fpINfilename && strcmp(fpINfilename, ""))
19 +    if (fpINfilename == NULL) {
20 +        print_usage();
21 +        exit(-1);
22 +    } else if (fpINfilename && strcmp(fpINfilename, "")) {
23          if ((fpIN = fopen(fpINfilename, "r")) == NULL)
24              exit_err("Could not open file");
25 +    }
26  
27      return ((fpIN != NULL) ? maxLoc(fpIN):0);          /* return file length */
28  }