summaryrefslogtreecommitdiffstats
path: root/src/bfstd.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-07-06 14:16:20 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-07-06 14:16:20 -0400
commit187ef092b6ea0f92dac53fbd2deb71379400446e (patch)
tree1c953830b3af06b18a8d507372b271df26b8a9f4 /src/bfstd.h
parenta215ab6de0ae34db7311136404d0f9feab34ef04 (diff)
downloadbfs-187ef092b6ea0f92dac53fbd2deb71379400446e.tar.xz
wordesc: Also escape non-printable chars
Diffstat (limited to 'src/bfstd.h')
-rw-r--r--src/bfstd.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/bfstd.h b/src/bfstd.h
index ebbcdb9..832db66 100644
--- a/src/bfstd.h
+++ b/src/bfstd.h
@@ -135,6 +135,38 @@ int ynprompt(void);
void *xmemdup(const void *src, size_t size);
/**
+ * A nice string copying function.
+ *
+ * @param dest
+ * The NUL terminator of the destination string, or `end` if it is
+ * already truncated.
+ * @param end
+ * The end of the destination buffer.
+ * @param src
+ * The string to copy from.
+ * @return
+ * The new NUL terminator of the destination, or `end` on truncation.
+ */
+char *xstpecpy(char *dest, char *end, const char *src);
+
+/**
+ * A nice string copying function.
+ *
+ * @param dest
+ * The NUL terminator of the destination string, or `end` if it is
+ * already truncated.
+ * @param end
+ * The end of the destination buffer.
+ * @param src
+ * The string to copy from.
+ * @param n
+ * The maximum number of characters to copy.
+ * @return
+ * The new NUL terminator of the destination, or `end` on truncation.
+ */
+char *xstpencpy(char *dest, char *end, const char *src, size_t n);
+
+/**
* Format a mode like ls -l (e.g. -rw-r--r--).
*
* @param mode