+#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 ); */
+}
+