summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-06-01 20:07:51 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-06-01 20:07:51 -0700
commitae05a8f6e9dbaa6f18a0d22475ab8fafc2b56506 (patch)
treeae68309aa0ac818f18aaa0cc3b0b82bdb25b7fef /lib.c
parentfe4ee294894e05042b806fa2202b47ae635dc2a7 (diff)
downloadtxr-ae05a8f6e9dbaa6f18a0d22475ab8fafc2b56506.tar.gz
txr-ae05a8f6e9dbaa6f18a0d22475ab8fafc2b56506.tar.bz2
txr-ae05a8f6e9dbaa6f18a0d22475ab8fafc2b56506.zip
mkstring char argument is optional.
* eval.c (eval_init): Update registration of mkstring intrinsic to make second argument optional. * lib.c (mkstring): Default second argument to space. * txr.1: Documentation of mkstring updated.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index f1309a72..3dd2c536 100644
--- a/lib.c
+++ b/lib.c
@@ -3313,7 +3313,7 @@ val string_8bit_size(const unsigned char *str, size_t sz)
return string_own(wstr);
}
-val mkstring(val len, val ch)
+val mkstring(val len, val ch_in)
{
size_t l = if3(minusp(len),
(uw_throwf(error_s, lit("mkstring: negative size ~s specified"),
@@ -3321,6 +3321,7 @@ val mkstring(val len, val ch)
c_num(len));
wchar_t *str = chk_wmalloc(l + 1);
val s = string_own(str);
+ val ch = default_arg_strict(ch_in, chr(' '));
wmemset(str, c_chr(ch), l);
str[l] = 0;
s->st.len = len;