summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2019-05-15 18:06:09 +0000
committerschwarze <schwarze@openbsd.org>2019-05-15 18:06:09 +0000
commit6cdb3149886fe7ea73d9df3d8e464e2a9bcbc66c (patch)
treeaa02ef1ec7f808f9e3cf36d947981e82b0264e3f
parentdelete two stray blank lines (diff)
downloadwireguard-openbsd-6cdb3149886fe7ea73d9df3d8e464e2a9bcbc66c.tar.xz
wireguard-openbsd-6cdb3149886fe7ea73d9df3d8e464e2a9bcbc66c.zip
UTF-8 cleanup in the function cmd_putstr().
This function is only ever called with constant ASCII string arguments, so actually it doesn't need any UTF-8 handling whatsoever. OK millert@
-rw-r--r--usr.bin/less/cmdbuf.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/usr.bin/less/cmdbuf.c b/usr.bin/less/cmdbuf.c
index 233ab24609e..e0a4e172fad 100644
--- a/usr.bin/less/cmdbuf.c
+++ b/usr.bin/less/cmdbuf.c
@@ -117,29 +117,16 @@ clear_cmd(void)
}
/*
- * Display a string, usually as a prompt for input into the command buffer.
+ * Display an ASCII string, usually as a prompt for input,
+ * into the command buffer.
*/
void
cmd_putstr(char *s)
{
- LWCHAR prev_ch = 0;
- LWCHAR ch;
- char *endline = s + strlen(s);
while (*s != '\0') {
- char *ns = s;
- ch = step_char(&ns, +1, endline);
- while (s < ns)
- putchr(*s++);
- if (!utf_mode) {
- cmd_col++;
- prompt_col++;
- } else if (!is_composing_char(ch) &&
- !is_combining_char(prev_ch, ch)) {
- int width = is_wide_char(ch) ? 2 : 1;
- cmd_col += width;
- prompt_col += width;
- }
- prev_ch = ch;
+ putchr(*s++);
+ cmd_col++;
+ prompt_col++;
}
}