From b39484c0ace6c9516bef189edc206e00170b79e6 Mon Sep 17 00:00:00 2001 From: Albert Graef Date: Mon, 15 Oct 2018 05:56:47 +0200 Subject: [PATCH] Make the -r optional, so that just 'midizap rcfile' will work. --- midizap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/midizap.c b/midizap.c index 15a59dd..a373105 100644 --- a/midizap.c +++ b/midizap.c @@ -1609,7 +1609,7 @@ handle_event(uint8_t *msg, uint8_t portno, int depth, int recursive) void help(char *progname) { - fprintf(stderr, "Usage: %s [-hkn] [-d[rskmj]] [-ost[n]] [-j name] [-P[prio]] [-r rcfile]\n", progname); + fprintf(stderr, "Usage: %s [-hkn] [-d[rskmj]] [-ost[n]] [-j name] [-P[prio]] [[-r] rcfile]\n", progname); fprintf(stderr, "-h print this message\n"); fprintf(stderr, "-d debug (r = regex, s = strokes, k = keys, m = midi, j = jack; default: all)\n"); fprintf(stderr, "-j jack client name (default: midizap)\n"); @@ -1842,11 +1842,16 @@ main(int argc, char **argv) } } - if (optind < argc) { + if (optind+1 < argc) { help(argv[0]); exit(1); } + if (optind < argc) { + config_file_name = argv[optind]; + add_command(absolute_path(argv[optind]), 1); + } + if (command_line) jack_command_line = command_line; initdisplay();