2 Copyright (C) 2003, 2010 - Wolfire Games
4 This file is part of Lugaru.
6 Lugaru is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
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.
15 See the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #if !defined(WINCOMPAT_INCLUDED) && !defined(PLATFORM_WINDOWS) && !defined(WIN32) && !defined(WINDOWS) && !defined(__WIN32__)
23 #define WINCOMPAT_INCLUDED
27 * Author: Magnus Naeslund (mag@fbab.net, mag@bahnhof.se)
28 * (c) 2000 Magnus Naeslund, all rights reserved
33 #include <sys/types.h>
47 #define stricmp strcasecmp
48 #define strnicmp strncasecmp
50 #define Sleep(x) usleep((x)*1000)
53 static struct termios ori;
55 static void tcatexit(){
59 static void init_terminal(){
63 t.c_lflag &= ~(ICANON);
68 static inline int kbhit(){
81 return select(1, &rfds, NULL, NULL, &tv)>0;
84 static inline int getch(){
94 if (select(1, &rfds, NULL, NULL, NULL)>0)
97 printf("wincompat.h: select() on fd 0 failed\n");