fix absolute_file_name

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1937 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc
2007-09-27 22:40:22 +00:00
parent 31ff28d3ee
commit c1917517cb
3 changed files with 74 additions and 30 deletions

View File

@@ -2143,24 +2143,38 @@ check_bom(int sno, StreamDesc *st)
}
}
static Int
p_access(char *file_name)
{
#if HAVE_STAT
#if _MSC_VER || defined(__MINGW32__)
struct _stat ss;
if (_stat(file_name, &ss) != 0) {
#define SYSTEM_STAT _stat
#else
struct stat ss;
if (stat(file_name, &ss) != 0) {
#define SYSTEM_STAT stat
#endif
/* ignore errors while checking a file */
static Int
p_access(void)
{
Term tname = Deref(ARG1);
char *file_name;
if (IsVarTerm(tname)) {
Yap_Error(INSTANTIATION_ERROR, tname, "access");
return FALSE;
}
return TRUE;
} else if (!IsAtomTerm (tname)) {
Yap_Error(TYPE_ERROR_ATOM, tname, "access");
return FALSE;
} else {
#if HAVE_STAT
struct SYSTEM_STAT ss;
file_name = RepAtom(AtomOfTerm(tname))->StrOfAE;
if (SYSTEM_STAT(file_name, &ss) != 0) {
/* ignore errors while checking a file */
return FALSE;
}
return TRUE;
#else
return FALSE;
return FALSE;
#endif
}
}
static Int