554 */
555 while (--argc > 0) {
556 char *arg;
557 int arglen;
558
559 arg = *++argv;
560 arglen = strlen(arg);
561
562 if (*arg != '-') {
563 char *filename;
564
565 /*
566 * filenames ending in '.s' are taken to be
567 * assembler files, and provide the default
568 * basename of the output file.
569 *
570 * other files are passed through to the
571 * preprocessor, if present, or to gas if not.
572 */
573 filename = arg;
574 if (arglen > 2 &&
575 strcmp(arg + arglen - 2, ".s") == 0) {
576 /*
577 * Though 'as' allows multiple assembler
578 * files to be processed in one invocation
579 * of the assembler, ON only processes one
580 * file at a time, which makes things a lot
581 * simpler!
582 */
583 if (srcfile == NULL)
584 srcfile = arg;
585 else
586 return (usage(
587 "one assembler file at a time"));
588
589 /*
590 * If we haven't seen a -o option yet,
591 * default the output to the basename
592 * of the input, substituting a .o on the end
593 */
594 if (outfile == NULL) {
595 char *argcopy;
|
554 */
555 while (--argc > 0) {
556 char *arg;
557 int arglen;
558
559 arg = *++argv;
560 arglen = strlen(arg);
561
562 if (*arg != '-') {
563 char *filename;
564
565 /*
566 * filenames ending in '.s' are taken to be
567 * assembler files, and provide the default
568 * basename of the output file.
569 *
570 * other files are passed through to the
571 * preprocessor, if present, or to gas if not.
572 */
573 filename = arg;
574 if ((arglen > 2) &&
575 ((strcmp(arg + arglen - 2, ".s") == 0) ||
576 (strcmp(arg + arglen - 2, ".S") == 0))) {
577 /*
578 * Though 'as' allows multiple assembler
579 * files to be processed in one invocation
580 * of the assembler, ON only processes one
581 * file at a time, which makes things a lot
582 * simpler!
583 */
584 if (srcfile == NULL)
585 srcfile = arg;
586 else
587 return (usage(
588 "one assembler file at a time"));
589
590 /*
591 * If we haven't seen a -o option yet,
592 * default the output to the basename
593 * of the input, substituting a .o on the end
594 */
595 if (outfile == NULL) {
596 char *argcopy;
|