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>
|
||||
<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>
|
||||
|
||||
<h2>Yap-4.3.22:</h2>
|
||||
|
@ -258,18 +258,25 @@ file_property(void)
|
||||
/* return an error number */
|
||||
return(unify(ARG6, MkIntTerm(errno)));
|
||||
}
|
||||
if (S_ISREG(buf.st_mode))
|
||||
unify(ARG2, MkAtomTerm(LookupAtom("regular")));
|
||||
else if (S_ISDIR(buf.st_mode))
|
||||
unify(ARG2, MkAtomTerm(LookupAtom("directory")));
|
||||
else if (S_ISFIFO(buf.st_mode))
|
||||
unify(ARG2, MkAtomTerm(LookupAtom("fifo")));
|
||||
else if (S_ISLNK(buf.st_mode))
|
||||
unify(ARG2, MkAtomTerm(LookupAtom("symlink")));
|
||||
else if (S_ISSOCK(buf.st_mode))
|
||||
unify(ARG2, MkAtomTerm(LookupAtom("socket")));
|
||||
else
|
||||
unify(ARG2, MkAtomTerm(LookupAtom("unknown")));
|
||||
if (S_ISREG(buf.st_mode)) {
|
||||
if (!unify(ARG2, MkAtomTerm(LookupAtom("regular"))))
|
||||
return(FALSE);
|
||||
} else if (S_ISDIR(buf.st_mode)) {
|
||||
if (!unify(ARG2, MkAtomTerm(LookupAtom("directory"))))
|
||||
return(FALSE);
|
||||
} else if (S_ISFIFO(buf.st_mode)) {
|
||||
if (!unify(ARG2, MkAtomTerm(LookupAtom("fifo"))))
|
||||
return(FALSE);
|
||||
} else if (S_ISLNK(buf.st_mode)) {
|
||||
if (!unify(ARG2, MkAtomTerm(LookupAtom("symlink"))))
|
||||
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
|
||||
/* for some weird reason _stat did not work with mingw32 */
|
||||
struct stat buf;
|
||||
@ -279,17 +286,22 @@ file_property(void)
|
||||
/* return an error number */
|
||||
return(unify(ARG6, MkIntTerm(errno)));
|
||||
}
|
||||
if (buf.st_mode & S_IFREG)
|
||||
unify(ARG2, MkAtomTerm(LookupAtom("regular")));
|
||||
else if (buf.st_mode & S_IFDIR)
|
||||
unify(ARG2, MkAtomTerm(LookupAtom("directory")));
|
||||
else
|
||||
unify(ARG2, MkAtomTerm(LookupAtom("unknown")));
|
||||
if (buf.st_mode & S_IFREG) {
|
||||
if (!unify(ARG2, MkAtomTerm(LookupAtom("regular"))))
|
||||
return(FALSE);
|
||||
} else if (buf.st_mode & S_IFDIR) {
|
||||
if (!unify(ARG2, MkAtomTerm(LookupAtom("directory"))))
|
||||
return(FALSE);
|
||||
} else {
|
||||
if (!unify(ARG2, MkAtomTerm(LookupAtom("unknown"))))
|
||||
return(FALSE);
|
||||
}
|
||||
#endif
|
||||
unify(ARG3, MkIntTerm(buf.st_size));
|
||||
unify(ARG4, MkIntTerm(buf.st_mtime));
|
||||
unify(ARG5, MkIntTerm(buf.st_mode));
|
||||
return(TRUE);
|
||||
return (
|
||||
unify(ARG3, MkIntTerm(buf.st_size)) &&
|
||||
unify(ARG4, MkIntTerm(buf.st_mtime)) &&
|
||||
unify(ARG5, MkIntTerm(buf.st_mode))
|
||||
);
|
||||
}
|
||||
|
||||
/* temporary files */
|
||||
|
Reference in New Issue
Block a user