summaryrefslogtreecommitdiff
path: root/system.h
diff options
context:
space:
mode:
authordevzero2000 <devzero2000>2010-11-29 13:38:06 +0000
committerdevzero2000 <devzero2000>2010-11-29 13:38:06 +0000
commitc81c1d87f776719c8ae134184b84642a26051567 (patch)
treec60205517aaf0a428e02efbcebc59c6cd2fc5b47 /system.h
parentb273159d8784facb92da9dec1509dbba5bff16af (diff)
downloadlibpopt-c81c1d87f776719c8ae134184b84642a26051567.tar.gz
Start of fixes to get build with MSVC
Merge 0613daf76688bb5f06c348a1f8c5470d5a4b63a8 from Matt Arsenault <arsenm2@rpi.edu> git://github.com/arsenm/POPT.git master branch
Diffstat (limited to 'system.h')
-rw-r--r--system.h37
1 files changed, 36 insertions, 1 deletions
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 <unistd.h>
#endif
+#ifdef _MSC_VER
+#include <io.h>
+#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__))