summaryrefslogtreecommitdiffstats
path: root/txr.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-05-21 08:48:20 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-05-21 08:48:20 -0700
commit60782a5351d2306ac69f700bfb5ab458648190d7 (patch)
tree814122f41e65786b3bacf1958d491eb8703de7e8 /txr.c
parent002969ba8021677cb6dc9a29374f174cbb4f8654 (diff)
downloadtxr-60782a5351d2306ac69f700bfb5ab458648190d7.tar.gz
txr-60782a5351d2306ac69f700bfb5ab458648190d7.tar.bz2
txr-60782a5351d2306ac69f700bfb5ab458648190d7.zip
Adding base-name and dir-name functions.
* stream.c (path_sep_chars): New global variable. (detect_path_separators): New static function. (base_name, dir_name): New functions. (stream_init): Call detect_path_separators. Register base-name and dir-name intrinsic functions, and path-sep-chars variable. * stream.h (path_sep_chars, base_name, dir_name): Declared. * txr.c (dirname): Static function removed. (sysroot_init): Use dir_name instead of dirname. * txr.1: Documented dir-name, base-name and path-sep-chars.
Diffstat (limited to 'txr.c')
-rw-r--r--txr.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/txr.c b/txr.c
index 5b0ade21..743530c3 100644
--- a/txr.c
+++ b/txr.c
@@ -273,12 +273,6 @@ 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);
@@ -311,7 +305,7 @@ static void sysroot_init(void)
#if HAVE_WINDOWS_H
prog_path = regsub(slash, lit("/"), prog_path);
#endif
- prog_dir = dirname(prog_path);
+ prog_dir = dir_name(prog_path);
if (!(maybe_sysroot(lit(TXR_REL_PATH)) ||
maybe_sysroot(lit(TXR_REL_PATH EXE_SUFF)) ||