moved several global variables to misc/GLOBALS
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
#include "Foreign.h"
|
||||
|
||||
#ifdef COFF
|
||||
|
||||
this code is no being maintained anymore
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
@@ -45,8 +45,6 @@
|
||||
|
||||
#define N_TXTOFF(x) (sizeof(struct filehdr)+(x).f_opthdr+(x).f_nscns*sizeof(struct scnhdr))
|
||||
|
||||
static char YapExecutable[YAP_FILE_MAX];
|
||||
|
||||
|
||||
/*
|
||||
* YAP_FindExecutable(argv[0]) should be called on yap initialization to
|
||||
@@ -62,10 +60,10 @@ Yap_FindExecutable(char *name)
|
||||
cp = (char *)getenv("PATH");
|
||||
if (cp == NULL)
|
||||
cp = ".:/usr/ucb:/bin:/usr/bin:/usr/local/bin";
|
||||
if (*Yap_argv[0] == '/') {
|
||||
if (oktox(Yap_argv[0])) {
|
||||
strcpy(LOCAL_FileNameBuf, Yap_argv[0]);
|
||||
Yap_TrueFileName(LOCAL_FileNameBuf, YapExecutable, TRUE);
|
||||
if (*GLOBAL_argv[0] == '/') {
|
||||
if (oktox(GLOBAL_argv[0])) {
|
||||
strcpy(LOCAL_FileNameBuf, GLOBAL_argv[0]);
|
||||
Yap_TrueFileName(LOCAL_FileNameBuf, GLOBAL_Executable, TRUE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -80,21 +78,21 @@ Yap_FindExecutable(char *name)
|
||||
for (cp2 = LOCAL_FileNameBuf; (*cp) != 0 && (*cp) != ':';)
|
||||
*cp2++ = *cp++;
|
||||
*cp2++ = '/';
|
||||
strcpy(cp2, Yap_argv[0]);
|
||||
strcpy(cp2, GLOBAL_argv[0]);
|
||||
if (*cp)
|
||||
cp++;
|
||||
if (!oktox(LOCAL_FileNameBuf))
|
||||
continue;
|
||||
Yap_TrueFileName(LOCAL_FileNameBuf, YapExecutable, TRUE);
|
||||
Yap_TrueFileName(LOCAL_FileNameBuf, GLOBAL_Executable, TRUE);
|
||||
return;
|
||||
}
|
||||
/* one last try for dual systems */
|
||||
strcpy(LOCAL_FileNameBuf, Yap_argv[0]);
|
||||
Yap_TrueFileName(LOCAL_FileNameBuf, YapExecutable, TRUE);
|
||||
if (oktox(YapExecutable))
|
||||
strcpy(LOCAL_FileNameBuf, GLOBAL_argv[0]);
|
||||
Yap_TrueFileName(LOCAL_FileNameBuf, GLOBAL_Executable, TRUE);
|
||||
if (oktox(GLOBAL_Executable))
|
||||
return;
|
||||
else
|
||||
Yap_Error(SYSTEM_ERROR,MkAtomTerm(Yap_LookupAtom(YapExecutable)),
|
||||
Yap_Error(SYSTEM_ERROR,MkAtomTerm(Yap_LookupAtom(GLOBAL_Executable)),
|
||||
"cannot find file being executed");
|
||||
}
|
||||
|
||||
@@ -175,12 +173,12 @@ LoadForeign(StringList ofiles,
|
||||
|
||||
/* prepare the magic */
|
||||
if (strlen(o_files) + strlen(l_files) + strlen(proc_name) +
|
||||
strlen(YapExecutable) > 2*MAXPATHLEN) {
|
||||
strlen(GLOBAL_Executable) > 2*MAXPATHLEN) {
|
||||
strcpy(LOCAL_ErrorSay, " too many parameters in load_foreign/3 ");
|
||||
return LOAD_FAILLED;
|
||||
}
|
||||
sprintf(command, "/usr/bin/ld -N -A %s -o %s %s %s -lc",
|
||||
YapExecutable,
|
||||
GLOBAL_Executable,
|
||||
tfile, o_files, l_files);
|
||||
/* now, do the magic */
|
||||
if (system(command) != 0) {
|
||||
|
Reference in New Issue
Block a user