file_property should check unification result.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@523 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
8c372cfa59
commit
0871e5b323
@ -16,6 +16,10 @@
|
|||||||
|
|
||||||
<h2>Yap-4.3.23:</h2>
|
<h2>Yap-4.3.23:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>FIXED: check unification result in file_property (Nicos).</li>
|
||||||
|
<li>FIXED: yap_flag(fileerrors) (Nicos).</li>
|
||||||
|
<li>FIXED: clauses with blobs cannot be simply abolished.</li>
|
||||||
|
<li>FIXED: retract of undefined predicate makes it dynamic.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>Yap-4.3.22:</h2>
|
<h2>Yap-4.3.22:</h2>
|
||||||
|
@ -258,18 +258,25 @@ file_property(void)
|
|||||||
/* return an error number */
|
/* return an error number */
|
||||||
return(unify(ARG6, MkIntTerm(errno)));
|
return(unify(ARG6, MkIntTerm(errno)));
|
||||||
}
|
}
|
||||||
if (S_ISREG(buf.st_mode))
|
if (S_ISREG(buf.st_mode)) {
|
||||||
unify(ARG2, MkAtomTerm(LookupAtom("regular")));
|
if (!unify(ARG2, MkAtomTerm(LookupAtom("regular"))))
|
||||||
else if (S_ISDIR(buf.st_mode))
|
return(FALSE);
|
||||||
unify(ARG2, MkAtomTerm(LookupAtom("directory")));
|
} else if (S_ISDIR(buf.st_mode)) {
|
||||||
else if (S_ISFIFO(buf.st_mode))
|
if (!unify(ARG2, MkAtomTerm(LookupAtom("directory"))))
|
||||||
unify(ARG2, MkAtomTerm(LookupAtom("fifo")));
|
return(FALSE);
|
||||||
else if (S_ISLNK(buf.st_mode))
|
} else if (S_ISFIFO(buf.st_mode)) {
|
||||||
unify(ARG2, MkAtomTerm(LookupAtom("symlink")));
|
if (!unify(ARG2, MkAtomTerm(LookupAtom("fifo"))))
|
||||||
else if (S_ISSOCK(buf.st_mode))
|
return(FALSE);
|
||||||
unify(ARG2, MkAtomTerm(LookupAtom("socket")));
|
} else if (S_ISLNK(buf.st_mode)) {
|
||||||
else
|
if (!unify(ARG2, MkAtomTerm(LookupAtom("symlink"))))
|
||||||
unify(ARG2, MkAtomTerm(LookupAtom("unknown")));
|
return(FALSE);
|
||||||
|
} else if (S_ISSOCK(buf.st_mode)) {
|
||||||
|
if (!unify(ARG2, MkAtomTerm(LookupAtom("socket"))))
|
||||||
|
return(FALSE);
|
||||||
|
} else {
|
||||||
|
if (!unify(ARG2, MkAtomTerm(LookupAtom("unknown"))))
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
#elif defined(__MINGW32__) || _MSC_VER
|
#elif defined(__MINGW32__) || _MSC_VER
|
||||||
/* for some weird reason _stat did not work with mingw32 */
|
/* for some weird reason _stat did not work with mingw32 */
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
@ -279,17 +286,22 @@ file_property(void)
|
|||||||
/* return an error number */
|
/* return an error number */
|
||||||
return(unify(ARG6, MkIntTerm(errno)));
|
return(unify(ARG6, MkIntTerm(errno)));
|
||||||
}
|
}
|
||||||
if (buf.st_mode & S_IFREG)
|
if (buf.st_mode & S_IFREG) {
|
||||||
unify(ARG2, MkAtomTerm(LookupAtom("regular")));
|
if (!unify(ARG2, MkAtomTerm(LookupAtom("regular"))))
|
||||||
else if (buf.st_mode & S_IFDIR)
|
return(FALSE);
|
||||||
unify(ARG2, MkAtomTerm(LookupAtom("directory")));
|
} else if (buf.st_mode & S_IFDIR) {
|
||||||
else
|
if (!unify(ARG2, MkAtomTerm(LookupAtom("directory"))))
|
||||||
unify(ARG2, MkAtomTerm(LookupAtom("unknown")));
|
return(FALSE);
|
||||||
|
} else {
|
||||||
|
if (!unify(ARG2, MkAtomTerm(LookupAtom("unknown"))))
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
unify(ARG3, MkIntTerm(buf.st_size));
|
return (
|
||||||
unify(ARG4, MkIntTerm(buf.st_mtime));
|
unify(ARG3, MkIntTerm(buf.st_size)) &&
|
||||||
unify(ARG5, MkIntTerm(buf.st_mode));
|
unify(ARG4, MkIntTerm(buf.st_mtime)) &&
|
||||||
return(TRUE);
|
unify(ARG5, MkIntTerm(buf.st_mode))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* temporary files */
|
/* temporary files */
|
||||||
|
Reference in New Issue
Block a user