diff --git a/frontends/yasm/yasm-options.c b/frontends/yasm/yasm-options.c index 282d705e..95464d2c 100644 --- a/frontends/yasm/yasm-options.c +++ b/frontends/yasm/yasm-options.c @@ -58,6 +58,16 @@ parse_cmdline(int argc, char **argv, opt_option *options, size_t nopts, if (argv[0][0] == '-') { /* opt */ got_it = 0; if (argv[0][1] == '-') { /* lopt */ + if (argv[0][2] == '\0') { /* --, end of options */ + /* Handle rest of args as non-options */ + while (--argc) { + argv++; + if (not_an_option_handler(argv[0])) + errors++; + } + return errors; + } + for (i = 0; i < nopts; i++) { if (options[i].lopt && strncmp(&argv[0][2], options[i].lopt, @@ -92,8 +102,10 @@ parse_cmdline(int argc, char **argv, opt_option *options, size_t nopts, argv[0]); warnings++; } + } else if (argv[0][1] == '\0') { /* just -, is non-option */ + if (not_an_option_handler(argv[0])) + errors++; } else { /* sopt */ - for (i = 0; i < nopts; i++) { if (argv[0][1] == options[i].sopt) { char *cmd = &argv[0][1]; diff --git a/frontends/yasm/yasm.c b/frontends/yasm/yasm.c index 396485b1..3281ad89 100644 --- a/frontends/yasm/yasm.c +++ b/frontends/yasm/yasm.c @@ -263,7 +263,10 @@ main(int argc, char *argv[]) return EXIT_FAILURE; } - if (in_filename && strcmp(in_filename, "-") != 0) { + if (!in_filename) { + print_error(_("No input files specified")); + return EXIT_FAILURE; + } else if (strcmp(in_filename, "-") != 0) { /* Open the input file (if not standard input) */ in = fopen(in_filename, "rt"); if (!in) { @@ -275,10 +278,8 @@ main(int argc, char *argv[]) return EXIT_FAILURE; } } else { - /* If no files were specified or filename was "-", read stdin */ + /* Filename was "-", read stdin */ in = stdin; - if (!in_filename) - in_filename = yasm__xstrdup("-"); } /* Initialize intnum and floatnum */ diff --git a/out_test.sh b/out_test.sh index e7f55acb..eab45b33 100755 --- a/out_test.sh +++ b/out_test.sh @@ -31,7 +31,7 @@ do fi # Run within a subshell to prevent signal messages from displaying. - sh -c "cat ${asm} | ./yasm $4 -o results/${o} 2>results/${e}" >/dev/null 2>/dev/null + sh -c "cat ${asm} | ./yasm $4 -o results/${o} - 2>results/${e}" >/dev/null 2>/dev/null status=$? if test $status -gt 128; then # We should never get a coredump!