summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-07-03 16:06:17 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-07-03 16:06:17 -0700
commitccb998581d8ba1e2f8f9c56768d57e32c51777c5 (patch)
treef29a4d79f4dfa91880ca415c85229ea80e83d89b /txr.1
parentfc4d580aaa4bbd5908507596a429621e560b024b (diff)
downloadtxr-ccb998581d8ba1e2f8f9c56768d57e32c51777c5.tar.gz
txr-ccb998581d8ba1e2f8f9c56768d57e32c51777c5.tar.bz2
txr-ccb998581d8ba1e2f8f9c56768d57e32c51777c5.zip
suffix functions: ignore trailing slashes.
Another requirements tweak to short-suffix and long-suffix: ignore one or more trailing slashes, instead of just one. This harmonizes with base-name, which does same, that requirement being copies from the POSIX basename utility. * stream.c (short_suffix, long_suffix): If sl points to a trailing slash which is the start of a suffix that consists of nothing but trailing slashes, then we pretend it isn't there. * tests/018/path.tl: Adjusted two existing test cases, and added more. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.111
1 files changed, 7 insertions, 4 deletions
diff --git a/txr.1 b/txr.1
index 4b7e7236..d963097d 100644
--- a/txr.1
+++ b/txr.1
@@ -57406,10 +57406,10 @@ If a suffix delimiter is present, then the long or short suffix is the
substring of
.meta path
which includes the delimiting period and all characters which follow,
-except that if the last character of
+except that if
.meta path
-is a path separator character, that character is omitted from the
-returned suffix.
+ends in a sequence of one or more path separator characters,
+those characters are omitted from the returned suffix.
If multiple periods occur in the last component of the path,
the delimiter for the long suffix is the leftmost period and
@@ -57428,7 +57428,8 @@ For the purpose of identifying the last component of
.metn path ,
if
.meta path
-ends in a path-separator character, then that character is removed.
+ends a sequence of one or more path-separator characters, then those
+characters are removed from consideration.
If the remaining string contains path-separator characters, then
the last component consists of that portion of it which follows
the rightmost path-separator character. Otherwise, the last component
@@ -57446,6 +57447,7 @@ extracted from this last component.
(short-suffix "abc" "") -> ""
(short-suffix "abc.") -> "."
(short-suffix "abc.tar") -> ".tar"
+ (short-suffix "abc.tar///") -> ".tar"
(short-suffix "abc.tar.gz") -> ".gz"
(short-suffix "abc.tar.gz/") -> ".gz"
(short-suffix "x.y.z/abc.tar.gz/") -> ".gz"
@@ -57458,6 +57460,7 @@ extracted from this last component.
(long-suffix "/.abc") -> nil
(long-suffix "abc.") -> "."
(long-suffix "abc.tar") -> ".tar"
+ (long-suffix "abc.tar///") -> ".tar"
(long-suffix "abc.tar.gz") -> ".tar.gz"
(long-suffix "abc.tar.gz/") -> ".tar.gz"
(long-suffix "x.y.z/abc.tar.gz/") -> ".tar.gz"