an error if no files are specified (instead of defaulting to stdin).
While the old behavior mimiced GNU AS, the new behavior is far more common
amongst typical compilers (e.g. GCC), including NASM.
While I'm here, add support for '--' (e.g. "yasm -- -f").
svn path=/trunk/yasm/; revision=1659
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,
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];
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) {
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 */
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!