Mercurial > hg > octave-jordi > gnulib-hg
annotate lib/error.c @ 12559:c2cbabec01dd
update nearly all FSF copyright year lists to include 2010
Use the same procedure as for 2009, outlined in
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Fri, 01 Jan 2010 10:31:12 +0100 |
parents | e8d2c6fc33ad |
children | 2792eeac632f |
rev | line source |
---|---|
1268 | 1 /* Error handler for noninteractive utilities |
12559
c2cbabec01dd
update nearly all FSF copyright year lists to include 2010
Jim Meyering <meyering@redhat.com>
parents:
12421
diff
changeset
|
2 Copyright (C) 1990-1998, 2000-2007, 2009-2010 Free Software Foundation, Inc. |
4739
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
3 This file is part of the GNU C Library. |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
4 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9112
diff
changeset
|
5 This program is free software: you can redistribute it and/or modify |
4020 | 6 it under the terms of the GNU General Public License as published by |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9112
diff
changeset
|
7 the Free Software Foundation; either version 3 of the License, or |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9112
diff
changeset
|
8 (at your option) any later version. |
9 | 9 |
4020 | 10 This program is distributed in the hope that it will be useful, |
724
3f555c6de1b9
Use #if, not #ifdef in test for HAVE_CONFIG_H.
Jim Meyering <jim@meyering.net>
parents:
719
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
4020 | 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 GNU General Public License for more details. | |
572 | 14 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9112
diff
changeset
|
15 You should have received a copy of the GNU General Public License |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9112
diff
changeset
|
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
9 | 17 |
398 | 18 /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ |
19 | |
7302
8a1a9361108c
* _fpending.c: Include <config.h> unconditionally, since we no
Paul Eggert <eggert@cs.ucla.edu>
parents:
7232
diff
changeset
|
20 #if !_LIBC |
1289 | 21 # include <config.h> |
398 | 22 #endif |
9 | 23 |
4636 | 24 #include "error.h" |
25 | |
26 #include <stdarg.h> | |
9 | 27 #include <stdio.h> |
4636 | 28 #include <stdlib.h> |
29 #include <string.h> | |
3966
22d3032f0239
Include gettext.h instead of <libintl.h> with #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
3618
diff
changeset
|
30 |
5562
2479d10c3961
[!_LIBC && !ENABLE_NLS]: Do not include "gettext.h";
Paul Eggert <eggert@cs.ucla.edu>
parents:
5319
diff
changeset
|
31 #if !_LIBC && ENABLE_NLS |
3966
22d3032f0239
Include gettext.h instead of <libintl.h> with #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
3618
diff
changeset
|
32 # include "gettext.h" |
9112
8b2acf250f22
Add missing definition of _ macro.
Bruno Haible <bruno@clisp.org>
parents:
7302
diff
changeset
|
33 # define _(msgid) gettext (msgid) |
2984
5b1fa2113060
Add a couple #includes, merging from GNU libc version.
Jim Meyering <jim@meyering.net>
parents:
2643
diff
changeset
|
34 #endif |
3966
22d3032f0239
Include gettext.h instead of <libintl.h> with #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
3618
diff
changeset
|
35 |
3446 | 36 #ifdef _LIBC |
7088
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
37 # include <libintl.h> |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
38 # include <stdbool.h> |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
39 # include <stdint.h> |
3446 | 40 # include <wchar.h> |
41 # define mbsrtowcs __mbsrtowcs | |
42 #endif | |
9 | 43 |
5319
61af141e6032
error.c, md5.c, regex.c: Use '#if USE_UNLOCKED_IO' instead of
Simon Josefsson <simon@josefsson.org>
parents:
5318
diff
changeset
|
44 #if USE_UNLOCKED_IO |
4070
925594d77a99
Merge in changes from libc's misc/error.c, in preparation
Jim Meyering <jim@meyering.net>
parents:
4020
diff
changeset
|
45 # include "unlocked-io.h" |
925594d77a99
Merge in changes from libc's misc/error.c, in preparation
Jim Meyering <jim@meyering.net>
parents:
4020
diff
changeset
|
46 #endif |
925594d77a99
Merge in changes from libc's misc/error.c, in preparation
Jim Meyering <jim@meyering.net>
parents:
4020
diff
changeset
|
47 |
925594d77a99
Merge in changes from libc's misc/error.c, in preparation
Jim Meyering <jim@meyering.net>
parents:
4020
diff
changeset
|
48 #ifndef _ |
925594d77a99
Merge in changes from libc's misc/error.c, in preparation
Jim Meyering <jim@meyering.net>
parents:
4020
diff
changeset
|
49 # define _(String) String |
925594d77a99
Merge in changes from libc's misc/error.c, in preparation
Jim Meyering <jim@meyering.net>
parents:
4020
diff
changeset
|
50 #endif |
1268 | 51 |
398 | 52 /* If NULL, error will flush stdout, then print on stderr the program |
53 name, a colon and a space. Otherwise, error will call this | |
54 function without parameters instead. */ | |
4636 | 55 void (*error_print_progname) (void); |
572 | 56 |
57 /* This variable is incremented each time `error' is called. */ | |
58 unsigned int error_message_count; | |
9 | 59 |
527 | 60 #ifdef _LIBC |
572 | 61 /* In the GNU C library, there is a predefined variable for this. */ |
62 | |
1289 | 63 # define program_name program_invocation_name |
4739
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
64 # include <errno.h> |
7088
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
65 # include <limits.h> |
4070
925594d77a99
Merge in changes from libc's misc/error.c, in preparation
Jim Meyering <jim@meyering.net>
parents:
4020
diff
changeset
|
66 # include <libio/libioP.h> |
572 | 67 |
1268 | 68 /* In GNU libc we want do not want to use the common name `error' directly. |
69 Instead make it a weak alias. */ | |
3446 | 70 extern void __error (int status, int errnum, const char *message, ...) |
71 __attribute__ ((__format__ (__printf__, 3, 4))); | |
72 extern void __error_at_line (int status, int errnum, const char *file_name, | |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
73 unsigned int line_number, const char *message, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
74 ...) |
3446 | 75 __attribute__ ((__format__ (__printf__, 5, 6)));; |
1289 | 76 # define error __error |
77 # define error_at_line __error_at_line | |
1268 | 78 |
4500
cdb224406ea7
[!USE_IN_LIBIO]: Omit this case; assume USE_IN_LIBIO is 1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4072
diff
changeset
|
79 # include <libio/iolibio.h> |
cdb224406ea7
[!USE_IN_LIBIO]: Omit this case; assume USE_IN_LIBIO is 1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4072
diff
changeset
|
80 # define fflush(s) INTUSE(_IO_fflush) (s) |
cdb224406ea7
[!USE_IN_LIBIO]: Omit this case; assume USE_IN_LIBIO is 1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4072
diff
changeset
|
81 # undef putc |
cdb224406ea7
[!USE_IN_LIBIO]: Omit this case; assume USE_IN_LIBIO is 1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4072
diff
changeset
|
82 # define putc(c, fp) INTUSE(_IO_putc) (c, fp) |
2984
5b1fa2113060
Add a couple #includes, merging from GNU libc version.
Jim Meyering <jim@meyering.net>
parents:
2643
diff
changeset
|
83 |
4739
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
84 # include <bits/libc-lock.h> |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
85 |
1289 | 86 #else /* not _LIBC */ |
527 | 87 |
11713
2b42a598bba2
error: avoid undefined use of stdout
Eric Blake <ebb9@byu.net>
parents:
9309
diff
changeset
|
88 # include <fcntl.h> |
12338
6d35e757e103
Oops, move the include of unistd.h in the last commit.
Bruno Haible <bruno@clisp.org>
parents:
12337
diff
changeset
|
89 # include <unistd.h> |
11713
2b42a598bba2
error: avoid undefined use of stdout
Eric Blake <ebb9@byu.net>
parents:
9309
diff
changeset
|
90 |
3550
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
91 # if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
92 # ifndef HAVE_DECL_STRERROR_R |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
93 "this configure-time declaration test was not run" |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
94 # endif |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
95 char *strerror_r (); |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
96 # endif |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
97 |
398 | 98 /* The calling program should define program_name and set it to the |
99 name of the executing program. */ | |
100 extern char *program_name; | |
9 | 101 |
3550
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
102 # if HAVE_STRERROR_R || defined strerror_r |
1289 | 103 # define __strerror_r strerror_r |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
104 # endif /* HAVE_STRERROR_R || defined strerror_r */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
105 #endif /* not _LIBC */ |
9 | 106 |
12337
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
107 static inline void |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
108 flush_stdout (void) |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
109 { |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
110 #if !_LIBC && defined F_GETFL |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
111 int stdout_fd; |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
112 |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
113 # if GNULIB_FREOPEN_SAFER |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
114 /* Use of gnulib's freopen-safer module normally ensures that |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
115 fileno (stdout) == 1 |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
116 whenever stdout is open. */ |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
117 stdout_fd = STDOUT_FILENO; |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
118 # else |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
119 /* POSIX states that fileno (stdout) after fclose is unspecified. But in |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
120 practice it is not a problem, because stdout is statically allocated and |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
121 the fd of a FILE stream is stored as a field in its allocated memory. */ |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
122 stdout_fd = fileno (stdout); |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
123 # endif |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
124 /* POSIX states that fflush (stdout) after fclose is unspecified; it |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
125 is safe in glibc, but not on all other platforms. fflush (NULL) |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
126 is always defined, but too draconian. */ |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
127 if (0 <= stdout_fd && 0 <= fcntl (stdout_fd, F_GETFL)) |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
128 #endif |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
129 fflush (stdout); |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
130 } |
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
131 |
3550
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
132 static void |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
133 print_errno_message (int errnum) |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
134 { |
7232
b307709e3a05
* error.c (error_at_line, print_errno_message): Match libc, after
Eric Blake <ebb9@byu.net>
parents:
7131
diff
changeset
|
135 char const *s; |
3550
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
136 |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
137 #if defined HAVE_STRERROR_R || _LIBC |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
138 char errbuf[1024]; |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
139 # if STRERROR_R_CHAR_P || _LIBC |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
140 s = __strerror_r (errnum, errbuf, sizeof errbuf); |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
141 # else |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
142 if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
143 s = errbuf; |
7232
b307709e3a05
* error.c (error_at_line, print_errno_message): Match libc, after
Eric Blake <ebb9@byu.net>
parents:
7131
diff
changeset
|
144 else |
b307709e3a05
* error.c (error_at_line, print_errno_message): Match libc, after
Eric Blake <ebb9@byu.net>
parents:
7131
diff
changeset
|
145 s = 0; |
3550
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
146 # endif |
7232
b307709e3a05
* error.c (error_at_line, print_errno_message): Match libc, after
Eric Blake <ebb9@byu.net>
parents:
7131
diff
changeset
|
147 #else |
b307709e3a05
* error.c (error_at_line, print_errno_message): Match libc, after
Eric Blake <ebb9@byu.net>
parents:
7131
diff
changeset
|
148 s = strerror (errnum); |
3550
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
149 #endif |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
150 |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
151 #if !_LIBC |
7232
b307709e3a05
* error.c (error_at_line, print_errno_message): Match libc, after
Eric Blake <ebb9@byu.net>
parents:
7131
diff
changeset
|
152 if (! s) |
3550
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
153 s = _("Unknown system error"); |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
154 #endif |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
155 |
4500
cdb224406ea7
[!USE_IN_LIBIO]: Omit this case; assume USE_IN_LIBIO is 1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4072
diff
changeset
|
156 #if _LIBC |
7088
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
157 __fxprintf (NULL, ": %s", s); |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
158 #else |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
159 fprintf (stderr, ": %s", s); |
3550
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
160 #endif |
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
161 } |
3446 | 162 |
163 static void | |
164 error_tail (int status, int errnum, const char *message, va_list args) | |
165 { | |
4695 | 166 #if _LIBC |
3446 | 167 if (_IO_fwide (stderr, 0) > 0) |
168 { | |
4695 | 169 # define ALLOCA_LIMIT 2000 |
3446 | 170 size_t len = strlen (message) + 1; |
7088
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
171 wchar_t *wmessage = NULL; |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
172 mbstate_t st; |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
173 size_t res; |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
174 const char *tmp; |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
175 bool use_malloc = false; |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
176 |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
177 while (1) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
178 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
179 if (__libc_use_alloca (len * sizeof (wchar_t))) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
180 wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
181 else |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
182 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
183 if (!use_malloc) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
184 wmessage = NULL; |
7088
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
185 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
186 wchar_t *p = (wchar_t *) realloc (wmessage, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
187 len * sizeof (wchar_t)); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
188 if (p == NULL) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
189 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
190 free (wmessage); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
191 fputws_unlocked (L"out of memory\n", stderr); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
192 return; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
193 } |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
194 wmessage = p; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
195 use_malloc = true; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
196 } |
3446 | 197 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
198 memset (&st, '\0', sizeof (st)); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
199 tmp = message; |
7088
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
200 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
201 res = mbsrtowcs (wmessage, &tmp, len, &st); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
202 if (res != len) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
203 break; |
7088
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
204 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
205 if (__builtin_expect (len >= SIZE_MAX / 2, 0)) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
206 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
207 /* This really should not happen if everything is fine. */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
208 res = (size_t) -1; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
209 break; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
210 } |
7088
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
211 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
212 len *= 2; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
213 } |
7088
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
214 |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
215 if (res == (size_t) -1) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
216 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
217 /* The string cannot be converted. */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
218 if (use_malloc) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
219 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
220 free (wmessage); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
221 use_malloc = false; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
222 } |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
223 wmessage = (wchar_t *) L"???"; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
224 } |
3446 | 225 |
226 __vfwprintf (stderr, wmessage, args); | |
7088
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
227 |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
228 if (use_malloc) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
229 free (wmessage); |
3446 | 230 } |
231 else | |
4695 | 232 #endif |
3446 | 233 vfprintf (stderr, message, args); |
234 va_end (args); | |
235 | |
236 ++error_message_count; | |
237 if (errnum) | |
3550
c18604dda2d7
(strerror_r): Do not declare unless !_LIBC.
Jim Meyering <jim@meyering.net>
parents:
3446
diff
changeset
|
238 print_errno_message (errnum); |
4680
0ec32cb1202f
Correct indentation of cpp directives.
Jim Meyering <jim@meyering.net>
parents:
4636
diff
changeset
|
239 #if _LIBC |
7088
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
240 __fxprintf (NULL, "\n"); |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
241 #else |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
242 putc ('\n', stderr); |
4680
0ec32cb1202f
Correct indentation of cpp directives.
Jim Meyering <jim@meyering.net>
parents:
4636
diff
changeset
|
243 #endif |
3446 | 244 fflush (stderr); |
245 if (status) | |
246 exit (status); | |
247 } | |
248 | |
249 | |
9 | 250 /* Print the program name and error message MESSAGE, which is a printf-style |
251 format string with optional args. | |
252 If ERRNUM is nonzero, print its corresponding system error message. | |
253 Exit with status STATUS if it is nonzero. */ | |
254 void | |
398 | 255 error (int status, int errnum, const char *message, ...) |
9 | 256 { |
257 va_list args; | |
258 | |
4739
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
259 #if defined _LIBC && defined __libc_ptf_call |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
260 /* We do not want this call to be cut short by a thread |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
261 cancellation. Therefore disable cancellation for now. */ |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
262 int state = PTHREAD_CANCEL_ENABLE; |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
263 __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
264 0); |
4739
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
265 #endif |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
266 |
12337
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
267 flush_stdout (); |
3446 | 268 #ifdef _LIBC |
269 _IO_flockfile (stderr); | |
270 #endif | |
398 | 271 if (error_print_progname) |
272 (*error_print_progname) (); | |
273 else | |
274 { | |
4500
cdb224406ea7
[!USE_IN_LIBIO]: Omit this case; assume USE_IN_LIBIO is 1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4072
diff
changeset
|
275 #if _LIBC |
7088
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
276 __fxprintf (NULL, "%s: ", program_name); |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
277 #else |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
278 fprintf (stderr, "%s: ", program_name); |
3446 | 279 #endif |
398 | 280 } |
281 | |
4636 | 282 va_start (args, message); |
3446 | 283 error_tail (status, errnum, message, args); |
284 | |
285 #ifdef _LIBC | |
286 _IO_funlockfile (stderr); | |
4739
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
287 # ifdef __libc_ptf_call |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
288 __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
289 # endif |
3446 | 290 #endif |
9 | 291 } |
572 | 292 |
573
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
293 /* Sometimes we want to have at most one error per line. This |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
294 variable controls whether this mode is selected or not. */ |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
295 int error_one_per_line; |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
296 |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
297 void |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
298 error_at_line (int status, int errnum, const char *file_name, |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
299 unsigned int line_number, const char *message, ...) |
573
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
300 { |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
301 va_list args; |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
302 |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
303 if (error_one_per_line) |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
304 { |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
305 static const char *old_file_name; |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
306 static unsigned int old_line_number; |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
307 |
3446 | 308 if (old_line_number == line_number |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
309 && (file_name == old_file_name |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
310 || strcmp (old_file_name, file_name) == 0)) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
311 /* Simply return and print nothing. */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
312 return; |
573
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
313 |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
314 old_file_name = file_name; |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
315 old_line_number = line_number; |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
316 } |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
317 |
4739
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
318 #if defined _LIBC && defined __libc_ptf_call |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
319 /* We do not want this call to be cut short by a thread |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
320 cancellation. Therefore disable cancellation for now. */ |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
321 int state = PTHREAD_CANCEL_ENABLE; |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
322 __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
323 0); |
4739
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
324 #endif |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
325 |
12337
9d131fdf3903
error: account for the possibility of freopen (stdout).
Bruno Haible <bruno@clisp.org>
parents:
11714
diff
changeset
|
326 flush_stdout (); |
3446 | 327 #ifdef _LIBC |
328 _IO_flockfile (stderr); | |
329 #endif | |
573
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
330 if (error_print_progname) |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
331 (*error_print_progname) (); |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
332 else |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
333 { |
4500
cdb224406ea7
[!USE_IN_LIBIO]: Omit this case; assume USE_IN_LIBIO is 1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4072
diff
changeset
|
334 #if _LIBC |
7088
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
335 __fxprintf (NULL, "%s:", program_name); |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
336 #else |
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
337 fprintf (stderr, "%s:", program_name); |
3446 | 338 #endif |
573
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
339 } |
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
340 |
4500
cdb224406ea7
[!USE_IN_LIBIO]: Omit this case; assume USE_IN_LIBIO is 1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4072
diff
changeset
|
341 #if _LIBC |
7131
02e62250d524
* misc/error.c: Add space between program name and message if file
Eric Blake <ebb9@byu.net>
parents:
7088
diff
changeset
|
342 __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
343 file_name, line_number); |
7088
e3cb6c0685d8
* error.h: Fold in some upstream changes from glibc.
Eric Blake <ebb9@byu.net>
parents:
5848
diff
changeset
|
344 #else |
7131
02e62250d524
* misc/error.c: Add space between program name and message if file
Eric Blake <ebb9@byu.net>
parents:
7088
diff
changeset
|
345 fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12338
diff
changeset
|
346 file_name, line_number); |
3446 | 347 #endif |
573
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
348 |
4636 | 349 va_start (args, message); |
3446 | 350 error_tail (status, errnum, message, args); |
351 | |
352 #ifdef _LIBC | |
353 _IO_funlockfile (stderr); | |
4739
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
354 # ifdef __libc_ptf_call |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
355 __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); |
04758f7475fd
Merge changes from glibc.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4695
diff
changeset
|
356 # endif |
3446 | 357 #endif |
573
8a90f3b04017
update from FSF:/home/gd/gnu/lib
Jim Meyering <jim@meyering.net>
parents:
572
diff
changeset
|
358 } |
1268 | 359 |
360 #ifdef _LIBC | |
361 /* Make the weak alias. */ | |
1289 | 362 # undef error |
363 # undef error_at_line | |
1268 | 364 weak_alias (__error, error) |
365 weak_alias (__error_at_line, error_at_line) | |
366 #endif |