diff --git a/jni/makefile.in b/jni/makefile.in index 45e378f..54dc4f2 100644 --- a/jni/makefile.in +++ b/jni/makefile.in @@ -26,7 +26,7 @@ bindir = @bindir@ libdir = @libdir@/post4 PROG = ${top_srcdir}/src/post4$E -POST4_PATH = .:${top_srcdir}/src:${top_srcdir}/examples +POST4_PATH = ${top_srcdir}/examples:${top_srcdir}/src # Override from the command-line, eg. make DBG='-O0 -g' DBG := @DBG@ diff --git a/src/post4.c b/src/post4.c index 3f61a6f..ffa77d3 100755 --- a/src/post4.c +++ b/src/post4.c @@ -144,9 +144,9 @@ p4FindFilePath(const char *path_list, size_t plen, const char *file, size_t flen if ((str.string = calloc(1, PATH_MAX)) == NULL) { goto error0; } - /* Try the given file relative the current working directory. */ + /* Try the given file directly. */ str.length = snprintf(str.string, PATH_MAX, "%.*s", (int)flen, file); - if (stat(str.string, &sb) == 0) { + if (strchr("./", *str.string) != NULL && stat(str.string, &sb) == 0) { return str; } /* Path list supplied or use the default? */ diff --git a/src/post4.h b/src/post4.h index e50e616..a764002 100755 --- a/src/post4.h +++ b/src/post4.h @@ -94,7 +94,7 @@ extern "C" { #endif #ifndef P4_CORE_PATH -#define P4_CORE_PATH ".:/usr/pkg/lib/post4:/usr/local/lib/post4:/usr/lib/post4" +#define P4_CORE_PATH "/usr/local/lib/post4:/usr/pkg/lib/post4:/usr/lib/post4" #endif #ifndef P4_CORE_FILE diff --git a/src/post4.p4 b/src/post4.p4 index d5b8c82..12aa8ab 100644 --- a/src/post4.p4 +++ b/src/post4.p4 @@ -2013,7 +2013,7 @@ VARIABLE SCR 256 CONSTANT path_max \ (S: name -- ) -: file-path CREATE 0 , path_max ALLOT DOES> @+ ; +: file-path CREATE 0 , 0 , path_max ALLOT DOES> @+ ; \ (S: sd.path xt -- ) : set-file-path diff --git a/test/makefile.in b/test/makefile.in index 927e4de..6d79a07 100644 --- a/test/makefile.in +++ b/test/makefile.in @@ -33,7 +33,7 @@ LIBS = @LIBS@ PROG = ${top_srcdir}/src/post4$E WORDS = ${top_srcdir}/src/post4.p4 -POST4_PATH = POST4_PATH='.:${top_srcdir}/src:${top_srcdir}/examples' +POST4_PATH = POST4_PATH='${top_srcdir}/examples:${top_srcdir}/src' BUILT := `date +'%a, %d %b %Y %H:%M:%S %z'`