diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-05-25 19:43:09 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-05-25 19:43:09 -0700 |
commit | f492fa9b676e95dbf317ec3b34d085909713da73 (patch) | |
tree | c532d638e009d2852f602ef3d6b65f6bb0e19811 /txr.c | |
parent | ed16b6ad1030981253aa6e6575024df41318cf99 (diff) | |
download | txr-f492fa9b676e95dbf317ec3b34d085909713da73.tar.gz txr-f492fa9b676e95dbf317ec3b34d085909713da73.tar.bz2 txr-f492fa9b676e95dbf317ec3b34d085909713da73.zip |
New variable: txr-path.
* txr.c (dirname): New static function.
(sysroot_init): Register txr-path variable.
* txr.1: documented txr-path.
Diffstat (limited to 'txr.c')
-rw-r--r-- | txr.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -267,6 +267,12 @@ static val maybe_sysroot(val exepart) sysroot_path = sub_str(prog_path, 0, neg(length(exepart)))); } +static val dirname(val path) +{ + val rslash = rpos(chr('/'), path, nil, nil); + return if3(rslash, sub_str(path, zero, succ(rslash)), path); +} + static val substitute_basename(val edited_path, val source_path) { val lslash = rpos(chr('/'), edited_path, nil, nil); @@ -316,6 +322,7 @@ static void sysroot_init(void) toint(lit(TXR_VER), nil)); reg_varl(intern(lit("txr-version"), user_package), toint(lit(TXR_VER), nil)); + reg_varl(intern(lit("txr-path"), user_package), dirname(prog_path)); } static int license(void) |