From 5f944b144b5bae019e578213d76e9bd81237c6dd Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 25 Sep 2021 09:23:02 -0700 Subject: path-search: rewrite in C with saner semantics. The new function: - just returns the name if it contains path name components. - returns nil if the name is "." or "..". - tests for existence only, not permission to execute. * lisplib.c (path_test_set_entries): Do not auto-load path-test module on the path-search symbol, since it is no longer implemented there. * stdlib/path-test.tl (path-search): Function removed. * stream.c (path_var_sep_char): New global variable. (path_search): New function. (detect_path_separators): Also set path_var_sep_char to semicolon on Cygnal. (stream-init): Register path-search intrinsic here now. * stream.h (path_var_sep_char, path_search): Declared. * tests/018/path-test.tl: New tests. * txr.1: Documentation revised for path-search. --- tests/018/path-test.tl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/018/path-test.tl') diff --git a/tests/018/path-test.tl b/tests/018/path-test.tl index 919186ac..d3aa6dce 100644 --- a/tests/018/path-test.tl +++ b/tests/018/path-test.tl @@ -15,4 +15,8 @@ (path-search "sh" "AlMoStCeRtAiNlLyNoNeXisTenT:/bin") "/bin/sh" (path-search "sh" "/bin") "/bin/sh" (path-search "sh" "/bin/") "/bin/sh" - (path-search "sh" ":/bin/") "/bin/sh") + (path-search "sh" ":/bin/") "/bin/sh" + (path-search "" "/bin") nil + (path-search "." "/bin") nil + (path-search ".." "/bin") nil + (path-search "foo/bar" "/bin") "foo/bar") -- cgit v1.2.3