Mercurial > hg > octave-nkf > gnulib-hg
comparison lib/error.c @ 4070:925594d77a99
Merge in changes from libc's misc/error.c, in preparation
for the merge of gnulib's changes back into libc.
(_): Define only if not already defined.
Move definition to follow all #include directives.
Include unlocked-io.h only if !_LIBC.
[_LIBC]: Include <libio/libioP.h>.
[USE_IN_LIBIO]: Include <libio/iolibio.h>
(fflush): Tweak definition to use INTUSE.
(putc): Define.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Fri, 06 Dec 2002 08:00:45 +0000 |
parents | 7158a1db8695 |
children | 86ee34b1ec28 |
comparison
equal
deleted
inserted
replaced
4069:335a257b54d7 | 4070:925594d77a99 |
---|---|
25 #ifdef _LIBC | 25 #ifdef _LIBC |
26 # include <libintl.h> | 26 # include <libintl.h> |
27 #else | 27 #else |
28 # include "gettext.h" | 28 # include "gettext.h" |
29 #endif | 29 #endif |
30 #define _(msgid) gettext (msgid) | |
31 | 30 |
32 #ifdef _LIBC | 31 #ifdef _LIBC |
33 # include <wchar.h> | 32 # include <wchar.h> |
34 # define mbsrtowcs __mbsrtowcs | 33 # define mbsrtowcs __mbsrtowcs |
35 #endif | 34 #endif |
53 #else | 52 #else |
54 void exit (); | 53 void exit (); |
55 #endif | 54 #endif |
56 | 55 |
57 #include "error.h" | 56 #include "error.h" |
58 #include "unlocked-io.h" | 57 |
58 #ifndef _LIBC | |
59 # include "unlocked-io.h" | |
60 #endif | |
61 | |
62 #ifndef _ | |
63 # define _(String) String | |
64 #endif | |
59 | 65 |
60 /* If NULL, error will flush stdout, then print on stderr the program | 66 /* If NULL, error will flush stdout, then print on stderr the program |
61 name, a colon and a space. Otherwise, error will call this | 67 name, a colon and a space. Otherwise, error will call this |
62 function without parameters instead. */ | 68 function without parameters instead. */ |
63 void (*error_print_progname) ( | 69 void (*error_print_progname) ( |
72 #ifdef _LIBC | 78 #ifdef _LIBC |
73 /* In the GNU C library, there is a predefined variable for this. */ | 79 /* In the GNU C library, there is a predefined variable for this. */ |
74 | 80 |
75 # define program_name program_invocation_name | 81 # define program_name program_invocation_name |
76 # include <errno.h> | 82 # include <errno.h> |
83 # include <libio/libioP.h> | |
77 | 84 |
78 /* In GNU libc we want do not want to use the common name `error' directly. | 85 /* In GNU libc we want do not want to use the common name `error' directly. |
79 Instead make it a weak alias. */ | 86 Instead make it a weak alias. */ |
80 extern void __error (int status, int errnum, const char *message, ...) | 87 extern void __error (int status, int errnum, const char *message, ...) |
81 __attribute__ ((__format__ (__printf__, 3, 4))); | 88 __attribute__ ((__format__ (__printf__, 3, 4))); |
86 # define error __error | 93 # define error __error |
87 # define error_at_line __error_at_line | 94 # define error_at_line __error_at_line |
88 | 95 |
89 # ifdef USE_IN_LIBIO | 96 # ifdef USE_IN_LIBIO |
90 # include <libio/iolibio.h> | 97 # include <libio/iolibio.h> |
91 # define fflush(s) _IO_fflush (s) | 98 # define fflush(s) INTUSE(_IO_fflush) (s) |
99 # undef putc | |
100 # define putc(c, fp) INTUSE(_IO_putc) (c, fp) | |
92 # endif | 101 # endif |
93 | 102 |
94 #else /* not _LIBC */ | 103 #else /* not _LIBC */ |
95 | 104 |
96 # if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P | 105 # if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P |