mirror of git://sourceware.org/git/glibc.git
2001-08-17 Roland McGrath <roland@frob.com>
* stdio-common/perror.c (perror) [! USE_IN_LIBIO]: Don't use _IO_fwide. * misc/error.c (error_tail, error, error_at_line) [! USE_IN_LIBIO]: Likewise.
This commit is contained in:
parent
89f29a0742
commit
55183f249f
12
misc/error.c
12
misc/error.c
|
@ -127,7 +127,7 @@ static void
|
||||||
error_tail (int status, int errnum, const char *message, va_list args)
|
error_tail (int status, int errnum, const char *message, va_list args)
|
||||||
{
|
{
|
||||||
# if HAVE_VPRINTF || _LIBC
|
# if HAVE_VPRINTF || _LIBC
|
||||||
# ifdef _LIBC
|
# if _LIBC && USE_IN_LIBIO
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
{
|
{
|
||||||
# define ALLOCA_LIMIT 2000
|
# define ALLOCA_LIMIT 2000
|
||||||
|
@ -181,7 +181,7 @@ error_tail (int status, int errnum, const char *message, va_list args)
|
||||||
#if defined HAVE_STRERROR_R || _LIBC
|
#if defined HAVE_STRERROR_R || _LIBC
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
char *s = __strerror_r (errnum, errbuf, sizeof errbuf);
|
char *s = __strerror_r (errnum, errbuf, sizeof errbuf);
|
||||||
# ifdef _LIBC
|
# if _LIBC && USE_IN_LIBIO
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
__fwprintf (stderr, L": %s", s);
|
__fwprintf (stderr, L": %s", s);
|
||||||
else
|
else
|
||||||
|
@ -191,7 +191,7 @@ error_tail (int status, int errnum, const char *message, va_list args)
|
||||||
fprintf (stderr, ": %s", strerror (errnum));
|
fprintf (stderr, ": %s", strerror (errnum));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef _LIBC
|
#if _LIBC && USE_IN_LIBIO
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
putwc (L'\n', stderr);
|
putwc (L'\n', stderr);
|
||||||
else
|
else
|
||||||
|
@ -236,7 +236,7 @@ error (status, errnum, message, va_alist)
|
||||||
(*error_print_progname) ();
|
(*error_print_progname) ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _LIBC
|
#if _LIBC && USE_IN_LIBIO
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
__fwprintf (stderr, L"%s: ", program_name);
|
__fwprintf (stderr, L"%s: ", program_name);
|
||||||
else
|
else
|
||||||
|
@ -317,7 +317,7 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
|
||||||
(*error_print_progname) ();
|
(*error_print_progname) ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _LIBC
|
#if _LIBC && USE_IN_LIBIO
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
__fwprintf (stderr, L"%s: ", program_name);
|
__fwprintf (stderr, L"%s: ", program_name);
|
||||||
else
|
else
|
||||||
|
@ -327,7 +327,7 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
|
||||||
|
|
||||||
if (file_name != NULL)
|
if (file_name != NULL)
|
||||||
{
|
{
|
||||||
#ifdef _LIBC
|
#if _LIBC && USE_IN_LIBIO
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
__fwprintf (stderr, L"%s:%d: ", file_name, line_number);
|
__fwprintf (stderr, L"%s:%d: ", file_name, line_number);
|
||||||
else
|
else
|
||||||
|
|
|
@ -55,9 +55,11 @@ perror_internal (FILE *fp, const char *s)
|
||||||
void
|
void
|
||||||
perror (const char *s)
|
perror (const char *s)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_IN_LIBIO
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
|
|
||||||
|
|
||||||
/* The standard says that 'perror' must not change the orientation
|
/* The standard says that 'perror' must not change the orientation
|
||||||
of the stream. What is supposed to happen when the stream isn't
|
of the stream. What is supposed to happen when the stream isn't
|
||||||
oriented yet? In this case we'll create a new stream which is
|
oriented yet? In this case we'll create a new stream which is
|
||||||
|
@ -84,4 +86,7 @@ perror (const char *s)
|
||||||
|
|
||||||
((_IO_FILE *) stderr)->_offset = _IO_pos_BAD;
|
((_IO_FILE *) stderr)->_offset = _IO_pos_BAD;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
perror_internal (stderr, s);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue