X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fhelper%2Foptions.c;h=12755e010a86c915588a8a72aa692134916a2e34;hp=0016659148aa0b39e37660b9373ac8e2a5e2cc31;hb=5fbf4d4cc3f67ec8b2fb3d8a789117583a84e1a1;hpb=f63af76466234cc905df6ea8e0f3fb5284c2058d diff --git a/src/helper/options.c b/src/helper/options.c index 0016659148..12755e010a 100644 --- a/src/helper/options.c +++ b/src/helper/options.c @@ -37,6 +37,9 @@ #ifdef HAVE_SYS_SYSCTL_H #include #endif +#if IS_WIN32 && !IS_CYGWIN +#include +#endif static int help_flag, version_flag; @@ -291,9 +294,18 @@ int parse_cmdline_args(struct command_context *cmd_ctx, int argc, char *argv[]) LOG_WARNING("deprecated option: -p/--pipe. Use '-c \"gdb_port pipe; " "log_output openocd.log\"' instead."); break; + default: /* '?' */ + /* getopt will emit an error message, all we have to do is bail. */ + return ERROR_FAIL; } } + if (optind < argc) { + /* Catch extra arguments on the command line. */ + LOG_OUTPUT("Unexpected command line argument: %s\n", argv[optind]); + return ERROR_FAIL; + } + if (help_flag) { LOG_OUTPUT("Open On-Chip Debugger\nLicensed under GNU GPL v2\n"); LOG_OUTPUT("--help | -h\tdisplay this help\n");