diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-08-09 06:28:58 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-08-09 06:28:58 -0700 |
commit | a5e69db365a98857ac2594590614a981d5f9ae74 (patch) | |
tree | b55fcc2b4ed6ee7bb6e645f861e0c47efaee601e /txr.1 | |
parent | 9a067618e82ca2a34960376725952c3439db6fa0 (diff) | |
download | txr-a5e69db365a98857ac2594590614a981d5f9ae74.tar.gz txr-a5e69db365a98857ac2594590614a981d5f9ae74.tar.bz2 txr-a5e69db365a98857ac2594590614a981d5f9ae74.zip |
base-name: optionally remove suffix.
The base-name function now takes a second argument which is
optional, specifying a suffix to be removed. The behavior is
similar to that of the second argument of the POSIX basename
command.
* stream.c (base_name): Second argument added. If present, the
returned value is adjusted by trimming the suffix, unless that
would cause an empty string to be returned.
(stream_init): Update registration of base-name intrinsic.
* stream.h (base_name): Declaration updated.
* txr.1: New base-name parameter documented.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -48234,7 +48234,7 @@ Examples of strings which are not pure relative paths: .coNP Functions @ dir-name and @ base-name .synb .mets (dir-name << path ) -.mets (base-name << path ) +.mets (base-name < path <> [ suffix ]) .syne .desc The @@ -48300,6 +48300,17 @@ The function returns the remaining part of the effective path, after the raw directory prefix. +If the +.meta suffix +argument is given to +.codn base-name , +then the returned base name is adjusted as follows. If the base +name ends in +.meta suffix +then a trimmed version of the base name is returned instead, with that suffix +removed. This adjustment isn't performed if it would result in an empty +string being returned. + .coNP Function @ path-cat .synb .mets (path-cat < dir-path << rel-path ) |