From a769c765cfaf1e930d973fab3907fa10ebb3f50b Mon Sep 17 00:00:00 2001 From: erg Date: Thu, 3 May 2007 19:09:15 +0000 Subject: [PATCH] Add modifications for ast to build on Windows --- lib/ast/compat_unistd.h | 51 +++++++++++++++++++++++++++++++++++++++++ lib/ast/pathaccess.c | 4 ++++ lib/ast/pathexists.c | 3 +++ lib/ast/pathfind.c | 2 ++ lib/ast/pathgetlink.c | 8 ++++++- 5 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 lib/ast/compat_unistd.h diff --git a/lib/ast/compat_unistd.h b/lib/ast/compat_unistd.h new file mode 100644 index 000000000..09087dfd0 --- /dev/null +++ b/lib/ast/compat_unistd.h @@ -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 diff --git a/lib/ast/pathaccess.c b/lib/ast/pathaccess.c index 5541f3fed..0d7077bc1 100644 --- a/lib/ast/pathaccess.c +++ b/lib/ast/pathaccess.c @@ -26,7 +26,11 @@ */ #include +#ifdef HAVE_UNISTD_H #include +#else +#include +#endif #include #include diff --git a/lib/ast/pathexists.c b/lib/ast/pathexists.c index 3e795dfe5..eb8489769 100644 --- a/lib/ast/pathexists.c +++ b/lib/ast/pathexists.c @@ -30,6 +30,9 @@ #include #include #include +#ifdef WIN32 +#include +#endif /* #include "lclib.h" */ /* #include */ diff --git a/lib/ast/pathfind.c b/lib/ast/pathfind.c index cd598f719..c1d1a61c1 100644 --- a/lib/ast/pathfind.c +++ b/lib/ast/pathfind.c @@ -27,6 +27,8 @@ #include #ifdef HAVE_UNISTD_H #include +#else +#include #endif #ifdef HAVE_STRINGS_H #include diff --git a/lib/ast/pathgetlink.c b/lib/ast/pathgetlink.c index 7a666b6a9..754625df8 100644 --- a/lib/ast/pathgetlink.c +++ b/lib/ast/pathgetlink.c @@ -31,7 +31,9 @@ #endif #ifdef HAVE_UNISTD_H -# include +#include +#else +#include #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 } -- 2.40.0