typedef void (*bfd_error_handler_type) (const char *, va_list);
typedef int (*bfd_print_callback) (void *, const char *, ...);
-void bfd_print_error (bfd_print_callback print_func,
- void *stream, const char *fmt, va_list ap);
-
void _bfd_error_handler (const char *fmt, ...) ATTRIBUTE_PRINTF_1;
bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
return arg_count;
}
-/*
-FUNCTION
- bfd_print_error
-
-SYNOPSIS
- void bfd_print_error (bfd_print_callback print_func,
- void *stream, const char *fmt, va_list ap);
-
-DESCRIPTION
-
- This formats FMT and AP according to BFD "printf" rules,
- sending the output to STREAM by repeated calls to PRINT_FUNC.
- PRINT_FUNC is a printf-like function; it does not need to
- implement the BFD printf format extensions. This can be used
- in a callback that is set via bfd_set_error_handler to turn
- the error into ordinary output.
-*/
-
-void
+static void
bfd_print_error (bfd_print_callback print_func, void *stream,
const char *fmt, va_list ap)
{
union _bfd_doprnt_args args[MAX_ARGS];
- print_func (stream, "%s: ", _bfd_get_error_program_name ());
_bfd_doprnt_scan (fmt, ap, args);
_bfd_doprnt (print_func, stream, fmt, args);
}
/* PR 4992: Don't interrupt output being sent to stdout. */
fflush (stdout);
+ fprintf (stderr, "%s: ", _bfd_get_error_program_name ());
bfd_print_error ((bfd_print_callback) fprintf, stderr, fmt, ap);
/* On AIX, putc is implemented as a macro that triggers a -Wunused-value
static void
print_warnmsg (struct per_xvec_message **list)
{
- fflush (stdout);
- fprintf (stderr, "%s: ", _bfd_get_error_program_name ());
-
for (struct per_xvec_message *warn = *list; warn; warn = warn->next)
- {
- fputs (warn->message, stderr);
- fputc ('\n', stderr);
- }
- fflush (stderr);
+ _bfd_error_handler ("%s", warn->message);
}
static void