* in the distribution for details.
*
* $RCSfile: hugs.c,v $
- * $Revision: 1.8 $
- * $Date: 1999/07/06 15:24:37 $
+ * $Revision: 1.9 $
+ * $Date: 1999/10/11 12:15:13 $
* ------------------------------------------------------------------------*/
#include <setjmp.h>
CStackBase = &argc; /* Save stack base for use in gc */
+ /* Try and figure out an absolute path to the executable, so
+ we can make a reasonable guess about where the default
+ libraries (Prelude etc) are.
+ */
+ setDefaultLibDir ( argv[0] );
+
/* If first arg is +Q or -Q, be entirely silent, and automatically run
main after loading scripts. Useful for running the nofib suite. */
if (argc > 1 && (strcmp(argv[1],"+Q") == 0 || strcmp(argv[1],"-Q")==0)) {
if (!(sAvail || (oAvail && iAvail)))
internal("chase");
/* Load objects in preference to sources if both are available */
+ /* 11 Oct 99: disable object loading in the interim.
+ Will probably only reinstate when HEP becomes available.
fromObj = sAvail
? (oAvail && iAvail && timeEarlier(sTime,oTime))
: TRUE;
+ */
+
+ fromObj = FALSE;
+
/* ToDo: namesUpto overflow */
ent->modName = strCopy(iname);
ent->details = TRUE;
if (projectLoaded)
Printf(" (project: %s)",currProject);
for (i=0; i<numScripts; ++i)
- Printf("\n%s",scriptInfo[i].modName);
+ Printf("\n%s%s",scriptInfo[i].path, scriptInfo[i].modName);
Putchar('\n');
}
* in the distribution for details.
*
* $RCSfile: machdep.c,v $
- * $Revision: 1.6 $
- * $Date: 1999/06/07 17:22:37 $
+ * $Revision: 1.7 $
+ * $Date: 1999/10/11 12:15:12 $
* ------------------------------------------------------------------------*/
#ifdef HAVE_SIGNAL_H
* New path handling stuff for the Combined System (tm)
* ------------------------------------------------------------------------*/
+#define N_DEFAULT_LIBDIR 1000
+char defaultLibDir[N_DEFAULT_LIBDIR];
+
+/* Assumes that getcwd()++argv[0] is the absolute path to the
+ executable. Basically wrong.
+*/
+void setDefaultLibDir ( String argv_0 )
+{
+ int i;
+ if (argv_0[0] != SLASH) {
+ if (!getcwd(defaultLibDir,N_DEFAULT_LIBDIR-strlen(argv_0)-10)) {
+ ERRMSG(0) "Can't get current working directory"
+ EEND;
+ }
+ i = strlen(defaultLibDir);
+ defaultLibDir[i++] = SLASH;
+ } else {
+ i = 0;
+ }
+ strcpy(&defaultLibDir[i],argv_0);
+ i += strlen(argv_0);
+ while (defaultLibDir[i] != SLASH) i--;
+ i++;
+ strcpy(&defaultLibDir[i], "lib");
+ /* fprintf ( stderr, "default lib dir = %s\n", defaultLibDir ); */
+}
+
Bool findFilesForModule (
String modName,
String* path,
Int nPath;
Bool literate;
String peStart, peEnd;
- String augdPath; /* . and then hugsPath */
+ String augdPath; /* .:defaultLibDir:hugsPath */
*path = *sExt = NULL;
*sAvail = *iAvail = *oAvail = FALSE;
*sSize = *iSize = *oSize = 0;
- augdPath = malloc(3+strlen(hugsPath));
+ augdPath = malloc(4+strlen(defaultLibDir)+strlen(hugsPath));
if (!augdPath)
internal("moduleNameToFileNames: malloc failed(2)");
augdPath[0] = '.';
augdPath[1] = PATHSEP;
augdPath[2] = 0;
+ strcat ( augdPath, defaultLibDir );
+ augdPath[2+strlen(defaultLibDir)] = PATHSEP;
+ augdPath[3+strlen(defaultLibDir)] = 0;
strcat(augdPath,hugsPath);
peEnd = augdPath-1;