summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-09-25 09:23:02 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-09-25 09:23:02 -0700
commit5f944b144b5bae019e578213d76e9bd81237c6dd (patch)
treead4838706d8d48d08a74b2b549346670e9a37566 /tests
parent7e36a3f2a6501a0bc6d24836610746f59427b496 (diff)
downloadtxr-5f944b144b5bae019e578213d76e9bd81237c6dd.tar.gz
txr-5f944b144b5bae019e578213d76e9bd81237c6dd.tar.bz2
txr-5f944b144b5bae019e578213d76e9bd81237c6dd.zip
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/018/path-test.tl6
1 files changed, 5 insertions, 1 deletions
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")