From 80a14ef0f636b8976c74d9832a8d7570750dfa09 Mon Sep 17 00:00:00 2001 From: paulino Date: Thu, 16 Apr 2015 16:20:18 +0000 Subject: [PATCH] Prints a friendly error message when --resume is used with other options. Fixes #84 --- main.cc | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/main.cc b/main.cc index cd53306eb..c50a95116 100644 --- a/main.cc +++ b/main.cc @@ -175,6 +175,7 @@ int main(int argc, char *argv[]) { char *cptr; int ret; int i; + int resume; set_program_name(argv[0]); @@ -216,14 +217,22 @@ int main(int argc, char *argv[]) { return ret; } - if (argc == 3 && strcmp("--resume", argv[1]) == 0) { - /* OK, they want to resume an aborted scan given the log file specified. - Lets gather our state from the log file */ - if (gather_logfile_resumption_state(argv[2], &myargc, &myargv) == -1) { - fatal("Cannot resume from (supposed) log file %s", argv[2]); + /* Don't allow users to use --resume with other options */ + for (i=0; i"); + } + if (gather_logfile_resumption_state(argv[i+1], &myargc, &myargv) == -1) { + fatal("Cannot resume from (supposed) log file %s", argv[i+1]); + } } - return nmap_main(myargc, myargv); } - return nmap_main(argc, argv); + if (resume == 1) { + return nmap_main(myargc, myargv); + } else { + return nmap_main(argc, argv); + } }