OSDN Git Service

Unify the duplicated windows and other system fallback logic in stubs.h
[uclinux-h8/elf2flt.git] / stubs.c
1 #include <errno.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5 #include <unistd.h>
6
7 #include "libiberty.h"
8
9 #include "stubs.h"
10
11 #ifndef HAVE_DCGETTEXT
12 const char *dcgettext(const char *domain, const char *msg, int category)
13 {
14   return msg;
15 }
16 #endif /* !HAVE_DCGETTEXT */
17
18 #ifndef HAVE_LIBINTL_DGETTEXT
19 const char *libintl_dgettext(const char *domain, const char *msg)
20 {
21   return msg;
22 }
23 #endif /* !HAVE_LIBINTL_DGETTEXT */
24
25 /* fatal error & exit */
26 void fatal(const char *format, ...)
27 {
28         va_list args;
29
30         va_start(args, format);
31         fprintf(stderr, "%s: ", elf2flt_progname);
32         vfprintf(stderr, format, args);
33         fprintf(stderr, "\n");
34         va_end(args);
35         exit(1);
36 }
37
38 /* fatal error, perror & exit */
39 void fatal_perror(const char *format, ...)
40 {
41         int e = errno;
42         va_list args;
43
44         va_start(args, format);
45         fprintf(stderr, "%s: ", elf2flt_progname);
46         vfprintf(stderr, format, args);
47         fprintf(stderr, ": %s\n", strerror(e));
48         va_end(args);
49         exit(1);
50 }