diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-07-06 14:16:20 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-07-06 14:16:20 -0400 |
commit | 187ef092b6ea0f92dac53fbd2deb71379400446e (patch) | |
tree | 1c953830b3af06b18a8d507372b271df26b8a9f4 /src/bfstd.h | |
parent | a215ab6de0ae34db7311136404d0f9feab34ef04 (diff) | |
download | bfs-187ef092b6ea0f92dac53fbd2deb71379400446e.tar.xz |
wordesc: Also escape non-printable chars
Diffstat (limited to 'src/bfstd.h')
-rw-r--r-- | src/bfstd.h | 32 |
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 |