]> git.pond.sub.org Git - empserver/blob - src/lib/w32/w32misc.h
Update copyright notice
[empserver] / src / lib / w32 / w32misc.h
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2013, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                Ken Stevens, Steve McClure, Markus Armbruster
5  *
6  *  Empire is free software: you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation, either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  *  ---
20  *
21  *  See files README, COPYING and CREDITS in the root of the source
22  *  tree for related information and legal notices.  It is expected
23  *  that future projects/authors will amend these files as needed.
24  *
25  *  ---
26  *
27  *  w32misc.h: POSIX emulation for WIN32, miscellaneous stuff
28  *
29  *  Known contributors to this file:
30  *     Ron Koenderink, 2007
31  *     Markus Armbruster, 2007-2009
32  */
33
34 /*
35  * Stuff that cannot be put in the "correct" include files.  More of
36  * that in unistd.h.
37  */
38
39 #ifndef W32MISC_H
40 #define W32MISC_H
41
42 #include <stddef.h>
43
44 #ifdef _MSC_VER
45 /* integral mismatch, due to misuse of sector short */
46 #pragma warning (disable : 4761 )
47
48 /* strings.h */
49 #define strncasecmp(s1, s2, s3) _strnicmp((s1), (s2), (s3))
50 #endif /* _MSC_VER */
51
52 /* errno.h */
53 #define EWOULDBLOCK EAGAIN
54
55 /* fcntl.h */
56 #ifdef _MSC_VER
57 #define O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR)
58 #endif
59
60 /* stdio.h */
61 #ifdef _MSC_VER
62 #define snprintf _snprintf
63 #define vsnprintf _vsnprintf
64 #endif
65
66 /* stdlib.h */
67 #define initstate(seed, state, size) \
68     __initstate((seed), (state), (size))
69 #define setstate(state) __setstate((state))
70 #define srandom(seed) __srandom((seed))
71 #define random() __random()
72
73 extern char *__initstate(unsigned seed, char *state, size_t size);
74 extern long __random(void);
75 extern char *__setstate(char *state);
76 extern void __srandom(unsigned seed);
77
78 /* time.h */
79 struct tm;
80 extern char *strptime(const char *buf, const char *fmt, struct tm *tm);
81
82 #endif /* W32MISC_H */