+ "%s%s%s version %s (%s) compiled by CC.\n"
+#endif
+ , indent, *indent != 0 ? " " : "",
+ lang_hooks.name, version_string, TARGET_NAME,
+ indent, __VERSION__);
+}
+
+/* Print an option value and return the adjusted position in the line.
+ ??? We don't handle error returns from fprintf (disk full); presumably
+ other code will catch a disk full though. */
+
+static int
+print_single_switch (file, pos, max, indent, sep, term, type, name)
+ FILE *file;
+ int pos, max;
+ const char *indent, *sep, *term, *type, *name;
+{
+ /* The ultrix fprintf returns 0 on success, so compute the result we want
+ here since we need it for the following test. */
+ int len = strlen (sep) + strlen (type) + strlen (name);
+
+ if (pos != 0
+ && pos + len > max)
+ {
+ fprintf (file, "%s", term);
+ pos = 0;
+ }
+ if (pos == 0)
+ {
+ fprintf (file, "%s", indent);
+ pos = strlen (indent);
+ }
+ fprintf (file, "%s%s%s", sep, type, name);
+ pos += len;
+ return pos;
+}
+
+/* Print active target switches to FILE.
+ POS is the current cursor position and MAX is the size of a "line".
+ Each line begins with INDENT and ends with TERM.
+ Each switch is separated from the next by SEP. */
+
+static void
+print_switch_values (file, pos, max, indent, sep, term)
+ FILE *file;
+ int pos, max;
+ const char *indent, *sep, *term;
+{
+ size_t j;
+ char **p;
+
+ /* Print the options as passed. */
+
+ pos = print_single_switch (file, pos, max, indent, *indent ? " " : "", term,
+ _("options passed: "), "");
+
+ for (p = &save_argv[1]; *p != NULL; p++)
+ if (**p == '-')
+ {
+ /* Ignore these. */
+ if (strcmp (*p, "-o") == 0)
+ {
+ if (p[1] != NULL)
+ p++;
+ continue;
+ }
+ if (strcmp (*p, "-quiet") == 0)
+ continue;
+ if (strcmp (*p, "-version") == 0)
+ continue;
+ if ((*p)[1] == 'd')
+ continue;
+
+ pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
+ }
+ if (pos > 0)
+ fprintf (file, "%s", term);
+
+ /* Print the -f and -m options that have been enabled.
+ We don't handle language specific options but printing argv
+ should suffice. */
+
+ pos = print_single_switch (file, 0, max, indent, *indent ? " " : "", term,
+ _("options enabled: "), "");
+
+ for (j = 0; j < ARRAY_SIZE (f_options); j++)
+ if (*f_options[j].variable == f_options[j].on_value)
+ pos = print_single_switch (file, pos, max, indent, sep, term,
+ "-f", f_options[j].string);
+
+ /* Print target specific options. */
+
+ for (j = 0; j < ARRAY_SIZE (target_switches); j++)
+ if (target_switches[j].name[0] != '\0'
+ && target_switches[j].value > 0
+ && ((target_switches[j].value & target_flags)
+ == target_switches[j].value))
+ {
+ pos = print_single_switch (file, pos, max, indent, sep, term,
+ "-m", target_switches[j].name);
+ }
+
+#ifdef TARGET_OPTIONS
+ for (j = 0; j < ARRAY_SIZE (target_options); j++)
+ if (*target_options[j].variable != NULL)
+ {
+ char prefix[256];
+ sprintf (prefix, "-m%s", target_options[j].prefix);
+ pos = print_single_switch (file, pos, max, indent, sep, term,
+ prefix, *target_options[j].variable);
+ }
+#endif
+
+ fprintf (file, "%s", term);
+}
+\f
+/* Open assembly code output file. Do this even if -fsyntax-only is
+ on, because then the driver will have provided the name of a
+ temporary file or bit bucket for us. NAME is the file specified on
+ the command line, possibly NULL. */
+static void
+init_asm_output (name)
+ const char *name;
+{
+ if (name == NULL && asm_file_name == 0)
+ asm_out_file = stdout;
+ else
+ {
+ if (asm_file_name == 0)
+ {
+ int len = strlen (dump_base_name);
+ char *dumpname = (char *) xmalloc (len + 6);
+ memcpy (dumpname, dump_base_name, len + 1);
+ strip_off_ending (dumpname, len);
+ strcat (dumpname, ".s");
+ asm_file_name = dumpname;
+ }
+ if (!strcmp (asm_file_name, "-"))
+ asm_out_file = stdout;
+ else
+ asm_out_file = fopen (asm_file_name, "w");
+ if (asm_out_file == 0)
+ fatal_io_error ("can't open %s for writing", asm_file_name);
+ }
+
+#ifdef IO_BUFFER_SIZE
+ setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
+ _IOFBF, IO_BUFFER_SIZE);
+#endif
+
+ if (!flag_syntax_only)
+ {
+#ifdef ASM_FILE_START
+ ASM_FILE_START (asm_out_file);
+#endif
+
+#ifdef ASM_COMMENT_START
+ if (flag_verbose_asm)
+ {
+ /* Print the list of options in effect. */
+ print_version (asm_out_file, ASM_COMMENT_START);
+ print_switch_values (asm_out_file, 0, MAX_LINE,
+ ASM_COMMENT_START, " ", "\n");
+ /* Add a blank line here so it appears in assembler output but not
+ screen output. */
+ fprintf (asm_out_file, "\n");
+ }