From c81c1d87f776719c8ae134184b84642a26051567 Mon Sep 17 00:00:00 2001 From: devzero2000 Date: Mon, 29 Nov 2010 13:38:06 +0000 Subject: Start of fixes to get build with MSVC Merge 0613daf76688bb5f06c348a1f8c5470d5a4b63a8 from Matt Arsenault git://github.com/arsenm/POPT.git master branch --- system.h | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'system.h') diff --git a/system.h b/system.h index 8a30f64..29d106c 100644 --- a/system.h +++ b/system.h @@ -31,6 +31,37 @@ char *alloca (); # endif #endif +#if defined(_MSC_VER) || defined(__STDC__) +# define inline __inline +#endif /* _MSC_VER */ + +#ifdef _MSC_VER +/* missing unistd.h stuff */ + +#define F_OK 0 +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 + +#define srandom srand +#define random rand +#define access _access + +/* Pretend to be root to replace these */ +inline int setuid(int) { return 1; } +inline int getuid(void) { return 0; } + +inline int seteuid(int) { return 1; } +inline int geteuid(void) { return 0; } + +inline int setgid(int) { return 1; } +inline int getgid(void) { return 0; } + +inline int setegid(int) { return 1; } + +#endif + + /* XXX isspace(3) has i18n encoding signednesss issues on Solaris. */ #define _isspaceptr(_chp) isspace((int)(*(unsigned char *)(_chp))) @@ -50,6 +81,10 @@ char *alloca (); #include #endif +#ifdef _MSC_VER +#include +#endif + #ifdef __NeXT /* access macros are not declared in non posix mode in unistd.h - don't try to use posix on NeXTstep 3.3 ! */ @@ -110,7 +145,7 @@ static inline char * stpcpy (char *dest, const char * src) { #endif #if !defined(__GNUC__) && !defined(__attribute__) -#define __attribute__(x) +#define __attribute__(x) #endif #define UNUSED(x) x __attribute__((__unused__)) -- cgit v1.2.1