summaryrefslogtreecommitdiff
path: root/lib/mbswidth.h
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-07-29 06:02:28 +0000
committerJim Meyering <jim@meyering.net>2000-07-29 06:02:28 +0000
commitf247c7bd44bb0abc6f4da3ade3dd6b6dfbb5f4e1 (patch)
treef4835f79ffcecf6f90d5cf822b6b417a9325f5a0 /lib/mbswidth.h
parente7a7601ef421747905605fb5b9b919357bc91eb6 (diff)
downloadcoreutils-f247c7bd44bb0abc6f4da3ade3dd6b6dfbb5f4e1.tar.xz
(mbswidth): Add a flags argument.
(mbswidth): New declaration. (MBSW_ACCEPT_INVALID, MBSW_ACCEPT_UNPRINTABLE): New macros.
Diffstat (limited to 'lib/mbswidth.h')
-rw-r--r--lib/mbswidth.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/mbswidth.h b/lib/mbswidth.h
index 1ef47d622..f76021b93 100644
--- a/lib/mbswidth.h
+++ b/lib/mbswidth.h
@@ -23,4 +23,19 @@
# endif
#endif
-extern int mbswidth PARAMS ((const char *string));
+/* Optional flags to influence mbswidth/mbsnwidth behavior. */
+
+/* Assume invalid characters have width 0. If this is not set, the
+ functions return -1 if an invalid or incomplete character occurs. */
+#define MBSW_ACCEPT_INVALID 1
+
+/* Assume unprintable characters have width 1. If this is not set, the
+ functions return -1 if a non-printable character occurs. */
+#define MBSW_ACCEPT_UNPRINTABLE 2
+
+/* Returns the number of screen columns needed for STRING. */
+extern int mbswidth PARAMS ((const char *string, int flags));
+
+/* Returns the number of screen columns needed for the NBYTES bytes
+ starting at BUF. */
+extern int mbsnwidth PARAMS ((const char *buf, size_t nbytes, int flags));