]> granicus.if.org Git - graphviz/commitdiff
Add modifications for ast to build on Windows
authorerg <devnull@localhost>
Thu, 3 May 2007 19:09:15 +0000 (19:09 +0000)
committererg <devnull@localhost>
Thu, 3 May 2007 19:09:15 +0000 (19:09 +0000)
lib/ast/compat_unistd.h [new file with mode: 0644]
lib/ast/pathaccess.c
lib/ast/pathexists.c
lib/ast/pathfind.c
lib/ast/pathgetlink.c

diff --git a/lib/ast/compat_unistd.h b/lib/ast/compat_unistd.h
new file mode 100644 (file)
index 0000000..09087df
--- /dev/null
@@ -0,0 +1,51 @@
+/* $Id$ $Revision$ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/**********************************************************
+*      This software is part of the graphviz package      *
+*                http://www.graphviz.org/                 *
+*                                                         *
+*            Copyright (c) 1994-2004 AT&T Corp.           *
+*                and is licensed under the                *
+*            Common Public License, Version 1.0           *
+*                      by AT&T Corp.                      *
+*                                                         *
+*        Information and Software Systems Research        *
+*              AT&T Research, Florham Park NJ             *
+**********************************************************/
+
+#ifndef UNISTD_H
+#define UNISTD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define        F_OK    0
+#define        R_OK    4
+#define        W_OK    2
+#define        X_OK    1
+
+#define      S_ISDIR(m)      (((m) & 0170000) == 0040000) 
+
+#define        S_IRWXU         (S_IRUSR | S_IWUSR | S_IXUSR)
+#define                S_IRUSR 0000400 /* read permission, owner */
+#define                S_IWUSR 0000200 /* write permission, owner */
+#define                S_IXUSR 0000100/* execute/search permission, owner */
+#define        S_IRWXG         (S_IRGRP | S_IWGRP | S_IXGRP)
+#define                S_IRGRP 0000040 /* read permission, group */
+#define                S_IWGRP 0000020 /* write permission, grougroup */
+#define                S_IXGRP 0000010/* execute/search permission, group */
+#define        S_IRWXO         (S_IROTH | S_IWOTH | S_IXOTH)
+#define                S_IROTH 0000004 /* read permission, other */
+#define                S_IWOTH 0000002 /* write permission, other */
+#define                S_IXOTH 0000001/* execute/search permission, other */
+
+extern int access (const char*, int);
+extern char* getcwd (char*, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index 5541f3fedcf3fb239c6a97424e32dc5fcde4118c..0d7077bc14b402a9f9e9eeab9717d28134290129 100644 (file)
  */
 
 #include <ast.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#else
+#include <compat_unistd.h>
+#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 
index 3e795dfe52c99f961047bf619ae829815bf509d4..eb848976980e5552b338022b39e91d4de7f77f2b 100644 (file)
@@ -30,6 +30,9 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef WIN32
+#include <compat_unistd.h>
+#endif
 /* #include "lclib.h" */
 /* #include <ls.h> */
 
index cd598f71983136c973d465ef2c369ed17214a0d9..c1d1a61c173738f2b3a07a255af1e5901f9fa21b 100644 (file)
@@ -27,6 +27,8 @@
 #include <ast.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#else
+#include <compat_unistd.h>
 #endif
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
index 7a666b6a9a1700b16990b3ebfd00afecb11940cd..754625df863bdb753dd6434b97a88efda2f7bab0 100644 (file)
@@ -31,7 +31,9 @@
 #endif
 
 #ifdef HAVE_UNISTD_H
-# include <unistd.h>
+#include <unistd.h>
+#else
+#include <compat_unistd.h>
 #endif
 
 /*
@@ -41,6 +43,9 @@
 
 int pathgetlink(const char *name, char *buf, int siz)
 {
+#ifdef WIN32
+       return (-1);
+#else
     int n;
 
     if ((n = readlink(name, buf, siz)) < 0)
@@ -94,4 +99,5 @@ int pathgetlink(const char *name, char *buf, int siz)
     }
 #endif
     return (n);
+#endif
 }