OSDN Git Service

Unify the duplicated windows and other system fallback logic in stubs.h
[uclinux-h8/elf2flt.git] / stubs.h
1 /* macros for conversion between host and (internet) network byte order */
2 #ifndef WIN32
3 # include <netinet/in.h> /* Consts and structs defined by the internet system */
4 # define BINARY_FILE_OPTS
5 #else
6 # include <winsock2.h>
7 # define BINARY_FILE_OPTS "b"
8 #endif
9
10 #ifndef __WIN32
11 # include <sys/wait.h>
12 #endif
13 #ifndef WIFSIGNALED
14 # define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f)
15 #endif
16 #ifndef WTERMSIG
17 # define WTERMSIG(S) ((S) & 0x7f)
18 #endif
19 #ifndef WIFEXITED
20 # define WIFEXITED(S) (((S) & 0xff) == 0)
21 #endif
22 #ifndef WEXITSTATUS
23 # define WEXITSTATUS(S) (((S) & 0xff00) >> 8)
24 #endif
25 #ifndef WCOREDUMP
26 # define WCOREDUMP(S) ((S) & WCOREFLG)
27 #endif
28 #ifndef WCOREFLG
29 # define WCOREFLG 0200
30 #endif
31 #ifndef HAVE_STRSIGNAL
32 # define strsignal(sig) "SIG???"
33 #endif
34
35 extern const char *elf2flt_progname;
36
37 void fatal(const char *, ...);
38 void fatal_perror(const char *, ...);