fix sys.c for win32
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2245 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
5974495e87
commit
fbc1f5e4a9
@ -8,8 +8,11 @@
|
||||
* *
|
||||
**************************************************************************
|
||||
* *
|
||||
* $Id: sys.c,v 1.34 2008-05-22 23:25:21 vsc Exp $ *
|
||||
* $Id: sys.c,v 1.35 2008-05-23 13:16:13 vsc Exp $ *
|
||||
* mods: $Log: not supported by cvs2svn $
|
||||
* mods: Revision 1.34 2008/05/22 23:25:21 vsc
|
||||
* mods: add tmp_file/2
|
||||
* mods:
|
||||
* mods: Revision 1.33 2007/10/05 18:24:30 vsc
|
||||
* mods: fix garbage collector and fix LeaveGoal
|
||||
* mods:
|
||||
@ -501,7 +504,6 @@ p_tmpnam(void)
|
||||
static int
|
||||
p_tmpdir(void)
|
||||
{
|
||||
char *s;
|
||||
#if defined(__MINGW32__) || _MSC_VER
|
||||
char buf[512];
|
||||
DWORD out = GetTempPath(512, buf);
|
||||
@ -509,17 +511,18 @@ p_tmpdir(void)
|
||||
return(YAP_Unify(YAP_ARG2, WinError()));
|
||||
}
|
||||
if (out > 511) {
|
||||
nbuf = malloc(out+1);
|
||||
char *nbuf = malloc(out+1);
|
||||
if (!nbuf)
|
||||
return YAP_Unify(YAP_ARG2, YAP_MkAtomTerm(YAP_LookupAtom("no malloc memory")));
|
||||
out = GetTempPath(512, nbuf);
|
||||
if (!out) {
|
||||
return(YAP_Unify(YAP_ARG2, WinError()));
|
||||
return YAP_Unify(YAP_ARG2, WinError());
|
||||
}
|
||||
return YAP_Unify(YAP_ARG1,YAP_MkAtomTerm(YAP_LookupAtom(nbuf)));
|
||||
}
|
||||
return YAP_Unify(YAP_ARG1,YAP_MkAtomTerm(YAP_LookupAtom(buf)));
|
||||
#else
|
||||
char *s;
|
||||
if ((s = getenv("TMPDIR")))
|
||||
return YAP_Unify(YAP_ARG1,YAP_MkAtomTerm(YAP_LookupAtom(s)));
|
||||
#ifdef P_tmpdir
|
||||
|
Reference in New Issue
Block a user