summaryrefslogtreecommitdiffstats
path: root/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2018-12-25 16:27:57 -0500
committerTavian Barnes <tavianator@tavianator.com>2018-12-28 01:01:15 -0500
commite4a192ec9c272b7be3ba54bd8ea5154d5af18dca (patch)
treebc3ee275680653e1fb6d63e1483884a0ba0ed48b /parse.c
parent36cb1762dd647a6c9cbb0ab36993c83798c854f1 (diff)
downloadbfs-e4a192ec9c272b7be3ba54bd8ea5154d5af18dca.tar.xz
parse: Handle argc == 0
Linux allows you to exec() with no argument list at all. Default to "bfs" in that case.
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index 524a80d..70987b6 100644
--- a/parse.c
+++ b/parse.c
@@ -3108,6 +3108,12 @@ struct cmdline *parse_cmdline(int argc, char *argv[]) {
cmdline->open_files = NULL;
cmdline->nopen_files = 0;
+ static char* default_argv[] = {"bfs", NULL};
+ if (argc < 1) {
+ argc = 1;
+ argv = default_argv;
+ }
+
cmdline->argv = malloc((argc + 1)*sizeof(*cmdline->argv));
if (!cmdline->argv) {
perror("malloc()");