summaryrefslogtreecommitdiffstats
path: root/util.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-03-26 19:42:13 -0400
committerTavian Barnes <tavianator@tavianator.com>2022-03-26 19:42:13 -0400
commitc2139e2e03cbcee9a1ae03956b1f06d3a9c269b0 (patch)
treeb6bda303b95d1f783fa9ae885e14c864943a94ea /util.h
parent5026a144add526567771a75b414a4d9873054620 (diff)
downloadbfs-c2139e2e03cbcee9a1ae03956b1f06d3a9c269b0.tar.xz
util: New xstrwidth() function
Diffstat (limited to 'util.h')
-rw-r--r--util.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/util.h b/util.h
index b780624..b5c7d80 100644
--- a/util.h
+++ b/util.h
@@ -208,6 +208,16 @@ int xfaccessat(int fd, const char *path, int amode);
int xstrtofflags(const char **str, unsigned long long *set, unsigned long long *clear);
/**
+ * wcswidth() variant that works on narrow strings.
+ *
+ * @param str
+ * The string to measure.
+ * @return
+ * The likely width of that string in a terminal.
+ */
+size_t xstrwidth(const char *str);
+
+/**
* Return whether an error code is due to a path not existing.
*/
bool is_nonexistence_error(int error);