aboutsummaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-04-30 06:00:13 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-04-30 06:00:13 +0000
commita3f7928084f291e23b7dea7b4ebd874d18b0c266 (patch)
tree0b75b973ba7ec8f2e214cd6b5b8b4d7c0b1b5e45 /util.c
parent38a33addf7c6323bec68384041297395af1c2835 (diff)
downloadrtmux-a3f7928084f291e23b7dea7b4ebd874d18b0c266.tar.gz
rtmux-a3f7928084f291e23b7dea7b4ebd874d18b0c266.tar.bz2
rtmux-a3f7928084f291e23b7dea7b4ebd874d18b0c266.zip
Oops, revert - need u_char.
Diffstat (limited to 'util.c')
-rw-r--r--util.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/util.c b/util.c
index f5658668..2478f912 100644
--- a/util.c
+++ b/util.c
@@ -1,4 +1,4 @@
-/* $Id: util.c,v 1.3 2009-04-30 05:42:46 nicm Exp $ */
+/* $Id: util.c,v 1.4 2009-04-30 06:00:13 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -53,18 +53,19 @@ section_string(char *buf, size_t len, size_t sectoff, size_t sectlen)
/* Clean string of invisible characters. */
void
-clean_string(const char *in, char *buf, size_t len)
+clean_string(const u_char *in, char *buf, size_t len)
{
- size_t off;
+ const u_char *cp;
+ size_t off;
off = 0;
- for (; *in != '\0'; in++) {
+ for (cp = in; *cp != '\0'; cp++) {
if (off >= len)
break;
- if (*in >= 0x20 && *in <= 0x7f)
- buf[off++] = *in;
+ if (*cp >= 0x20 && *cp <= 0x7f)
+ buf[off++] = *cp;
else
- off += xsnprintf(buf + off, len - off, "\\%03hho", *in);
+ off += xsnprintf(buf + off, len - off, "\\%03hho", *cp);
}
if (off < len)
buf[off] = '\0';