21 |
|
|
22 |
#include "system.h" |
#include "system.h" |
23 |
|
|
24 |
#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC |
#include <stdarg.h> |
25 |
# ifdef __STDC__ |
#if ! (HAVE_VPRINTF || defined vfprintf) |
26 |
# include <stdarg.h> |
# define vfprintf(stream, message, args) _doprnt (message, args, stream) |
|
# define VA_START(args, lastarg) va_start(args, lastarg) |
|
|
# else |
|
|
# include <varargs.h> |
|
|
# define VA_START(args, lastarg) va_start(args) |
|
|
# endif |
|
|
#else |
|
|
# define va_alist a1, a2, a3, a4, a5, a6, a7, a8 |
|
|
# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; |
|
27 |
#endif |
#endif |
28 |
|
|
29 |
#if STDC_HEADERS || _LIBC |
#if STDC_HEADERS || _LIBC |
66 |
"this configure-time declaration test was not run" |
"this configure-time declaration test was not run" |
67 |
# endif |
# endif |
68 |
# if !HAVE_DECL_STRERROR && !defined strerror |
# if !HAVE_DECL_STRERROR && !defined strerror |
69 |
char *strerror PARAMS ((int)); |
char *strerror (int); |
70 |
# endif |
# endif |
71 |
# else |
# else |
72 |
static char * |
static char * |
73 |
private_strerror (errnum) |
private_strerror (int errnum) |
|
int errnum; |
|
74 |
{ |
{ |
75 |
extern char *sys_errlist[]; |
extern char *sys_errlist[]; |
76 |
extern int sys_nerr; |
extern int sys_nerr; |
95 |
`--------------------------------*/ |
`--------------------------------*/ |
96 |
|
|
97 |
void |
void |
|
#if defined VA_START && defined __STDC__ |
|
98 |
warn_at (location_t location, const char *message, ...) |
warn_at (location_t location, const char *message, ...) |
|
#else |
|
|
warn_at (location, message, va_alist) |
|
|
location_t location |
|
|
char *message; |
|
|
va_dcl |
|
|
#endif |
|
99 |
{ |
{ |
|
#ifdef VA_START |
|
100 |
va_list args; |
va_list args; |
|
#endif |
|
101 |
|
|
102 |
fflush (stdout); |
fflush (stdout); |
103 |
LOCATION_PRINT (stderr, location); |
LOCATION_PRINT (stderr, location); |
104 |
fputs (": ", stderr); |
fputs (": ", stderr); |
105 |
fputs (_("warning: "), stderr); |
fputs (_("warning: "), stderr); |
106 |
|
|
107 |
#ifdef VA_START |
va_start (args, message); |
|
VA_START (args, message); |
|
108 |
vfprintf (stderr, message, args); |
vfprintf (stderr, message, args); |
109 |
va_end (args); |
va_end (args); |
|
#else |
|
|
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8); |
|
|
#endif |
|
110 |
|
|
111 |
++warn_message_count; |
++warn_message_count; |
112 |
putc ('\n', stderr); |
putc ('\n', stderr); |
114 |
} |
} |
115 |
|
|
116 |
void |
void |
|
#if defined VA_START && defined __STDC__ |
|
117 |
warn (const char *message, ...) |
warn (const char *message, ...) |
|
#else |
|
|
warn (message, va_alist) |
|
|
char *message; |
|
|
va_dcl |
|
|
#endif |
|
118 |
{ |
{ |
|
#ifdef VA_START |
|
119 |
va_list args; |
va_list args; |
|
#endif |
|
120 |
|
|
121 |
fflush (stdout); |
fflush (stdout); |
122 |
fprintf (stderr, "%s: %s", infile ? infile : program_name, _("warning: ")); |
fprintf (stderr, "%s: %s", infile ? infile : program_name, _("warning: ")); |
123 |
|
|
124 |
#ifdef VA_START |
va_start (args, message); |
|
VA_START (args, message); |
|
125 |
vfprintf (stderr, message, args); |
vfprintf (stderr, message, args); |
126 |
va_end (args); |
va_end (args); |
|
#else |
|
|
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8); |
|
|
#endif |
|
127 |
|
|
128 |
++warn_message_count; |
++warn_message_count; |
129 |
putc ('\n', stderr); |
putc ('\n', stderr); |
135 |
`-----------------------------------------------------------*/ |
`-----------------------------------------------------------*/ |
136 |
|
|
137 |
void |
void |
|
#if defined VA_START && defined __STDC__ |
|
138 |
complain_at (location_t location, const char *message, ...) |
complain_at (location_t location, const char *message, ...) |
|
#else |
|
|
complain_at (location, message, va_alist) |
|
|
location_t location; |
|
|
char *message; |
|
|
va_dcl |
|
|
#endif |
|
139 |
{ |
{ |
|
#ifdef VA_START |
|
140 |
va_list args; |
va_list args; |
|
#endif |
|
141 |
|
|
142 |
fflush (stdout); |
fflush (stdout); |
143 |
LOCATION_PRINT (stderr, location); |
LOCATION_PRINT (stderr, location); |
144 |
fputs (": ", stderr); |
fputs (": ", stderr); |
145 |
|
|
146 |
#ifdef VA_START |
va_start (args, message); |
|
VA_START (args, message); |
|
147 |
vfprintf (stderr, message, args); |
vfprintf (stderr, message, args); |
148 |
va_end (args); |
va_end (args); |
|
#else |
|
|
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8); |
|
|
#endif |
|
149 |
|
|
150 |
++complain_message_count; |
++complain_message_count; |
151 |
putc ('\n', stderr); |
putc ('\n', stderr); |
153 |
} |
} |
154 |
|
|
155 |
void |
void |
|
#if defined VA_START && defined __STDC__ |
|
156 |
complain (const char *message, ...) |
complain (const char *message, ...) |
|
#else |
|
|
complain (message, va_alist) |
|
|
char *message; |
|
|
va_dcl |
|
|
#endif |
|
157 |
{ |
{ |
|
#ifdef VA_START |
|
158 |
va_list args; |
va_list args; |
|
#endif |
|
159 |
|
|
160 |
fflush (stdout); |
fflush (stdout); |
161 |
fprintf (stderr, "%s: ", infile ? infile : program_name); |
fprintf (stderr, "%s: ", infile ? infile : program_name); |
162 |
|
|
163 |
#ifdef VA_START |
va_start (args, message); |
|
VA_START (args, message); |
|
164 |
vfprintf (stderr, message, args); |
vfprintf (stderr, message, args); |
165 |
va_end (args); |
va_end (args); |
|
#else |
|
|
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8); |
|
|
#endif |
|
166 |
|
|
167 |
++complain_message_count; |
++complain_message_count; |
168 |
putc ('\n', stderr); |
putc ('\n', stderr); |
174 |
`-------------------------------------------------*/ |
`-------------------------------------------------*/ |
175 |
|
|
176 |
void |
void |
|
#if defined VA_START && defined __STDC__ |
|
177 |
fatal_at (location_t location, const char *message, ...) |
fatal_at (location_t location, const char *message, ...) |
|
#else |
|
|
fatal_at (location, message, va_alist) |
|
|
location_t location; |
|
|
char *message; |
|
|
va_dcl |
|
|
#endif |
|
178 |
{ |
{ |
|
#ifdef VA_START |
|
179 |
va_list args; |
va_list args; |
|
#endif |
|
180 |
|
|
181 |
fflush (stdout); |
fflush (stdout); |
182 |
LOCATION_PRINT (stderr, location); |
LOCATION_PRINT (stderr, location); |
183 |
fputs (": ", stderr); |
fputs (": ", stderr); |
184 |
fputs (_("fatal error: "), stderr); |
fputs (_("fatal error: "), stderr); |
185 |
|
|
186 |
#ifdef VA_START |
va_start (args, message); |
|
VA_START (args, message); |
|
187 |
vfprintf (stderr, message, args); |
vfprintf (stderr, message, args); |
188 |
va_end (args); |
va_end (args); |
|
#else |
|
|
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8); |
|
|
#endif |
|
189 |
putc ('\n', stderr); |
putc ('\n', stderr); |
190 |
fflush (stderr); |
fflush (stderr); |
191 |
exit (1); |
exit (1); |
192 |
} |
} |
193 |
|
|
194 |
void |
void |
|
#if defined VA_START && defined __STDC__ |
|
195 |
fatal (const char *message, ...) |
fatal (const char *message, ...) |
|
#else |
|
|
fatal (message, va_alist) |
|
|
char *message; |
|
|
va_dcl |
|
|
#endif |
|
196 |
{ |
{ |
|
#ifdef VA_START |
|
197 |
va_list args; |
va_list args; |
|
#endif |
|
198 |
|
|
199 |
fflush (stdout); |
fflush (stdout); |
200 |
fprintf (stderr, "%s: ", infile ? infile : program_name); |
fprintf (stderr, "%s: ", infile ? infile : program_name); |
201 |
|
|
202 |
fputs (_("fatal error: "), stderr); |
fputs (_("fatal error: "), stderr); |
203 |
|
|
204 |
#ifdef VA_START |
va_start (args, message); |
|
VA_START (args, message); |
|
205 |
vfprintf (stderr, message, args); |
vfprintf (stderr, message, args); |
206 |
va_end (args); |
va_end (args); |
|
#else |
|
|
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8); |
|
|
#endif |
|
207 |
putc ('\n', stderr); |
putc ('\n', stderr); |
208 |
fflush (stderr); |
fflush (stderr); |
209 |
exit (1); |
exit (1); |