8c7cfd0a3e3cd5cc1de0a73cdd812521b0759973
[reactos.git] / reactos / sdk / tools / isohybrid / reactos_support_code.h
1 #ifndef _REACTOS_SUPPORT_CODE_H
2 #define _REACTOS_SUPPORT_CODE_H
3
4 #include <stdarg.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8
9 #ifdef _WIN32
10 #include <malloc.h>
11 #include <windows.h>
12 #else
13 #include <alloca.h>
14 #include <unistd.h>
15 #endif
16
17 void isohybrid_error(int eval, const char* fmt, ...);
18 void isohybrid_warning(const char* fmt, ...);
19
20 #define err(...) isohybrid_error(__VA_ARGS__)
21 #define errx(...) isohybrid_error(__VA_ARGS__)
22 #define warn(...) isohybrid_warning(__VA_ARGS__)
23 #define warnx(...) isohybrid_warning(__VA_ARGS__)
24
25
26 /////////////////////////////////////////////////////////////////////////////
27 // getopt code from mingw-w64
28 /////////////////////////////////////////////////////////////////////////////
29 extern int optopt; /* single option character, as parsed */
30 extern char *optarg; /* pointer to argument of current option */
31
32 struct option /* specification for a long form option... */
33 {
34 const char *name; /* option name, without leading hyphens */
35 int has_arg; /* does it take an argument? */
36 int *flag; /* where to save its status, or NULL */
37 int val; /* its associated status value */
38 };
39
40 enum /* permitted values for its `has_arg' field... */
41 {
42 no_argument = 0, /* option never takes an argument */
43 required_argument, /* option always requires an argument */
44 optional_argument /* option may take an argument */
45 };
46
47 int getopt_long_only(int nargc, char * const *nargv, const char *options, const struct option *long_options, int *idx);
48 /////////////////////////////////////////////////////////////////////////////
49
50 #ifdef _WIN32
51 int fsync(int fd);
52 int getppid(void);
53 #endif
54
55 #ifdef _MSC_VER
56 #define fseeko _fseeki64
57 #define ftruncate _chsize
58 #endif
59
60 #endif