summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2023-07-25 00:47:01 +0200
committerLouis Burda <quent.burda@gmail.com>2023-07-25 00:47:01 +0200
commit40d8eb449ed072b47bfbe953a191708f761c53a0 (patch)
tree63ed15404eb3acd99a9ca0f77654b2c97efe54d9 /util.c
parent29894d56e144223629e558070cbc52080e21342e (diff)
downloadtis100-40d8eb449ed072b47bfbe953a191708f761c53a0.tar.gz
tis100-40d8eb449ed072b47bfbe953a191708f761c53a0.zip
Reimplement value passing and improve curses ui
Diffstat (limited to 'util.c')
-rw-r--r--util.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/util.c b/util.c
index 202cd5b..e5684aa 100644
--- a/util.c
+++ b/util.c
@@ -10,6 +10,8 @@ die(const char *fmt, ...)
{
va_list ap;
+ if (cleanup) cleanup();
+
va_start(ap, fmt);
fprintf(stderr, "%s: ", progname);
vfprintf(stderr, fmt, ap);
@@ -23,3 +25,20 @@ die(const char *fmt, ...)
exit(1);
}
+
+size_t
+strdcpy(char *dst, const char *src, size_t n)
+{
+ strncpy(dst, src, n);
+ return strlen(src);
+}
+
+size_t
+strdcat(char *dst, const char *src, size_t n)
+{
+ size_t len;
+
+ len = strlen(dst);
+ strncpy(dst + len, src, n - len);
+ return strlen(src);
+}