mirror of
https://github.com/tmux/tmux.git
synced 2024-12-14 10:58:48 +00:00
Don't need cp.
This commit is contained in:
parent
71a903d4be
commit
38a33addf7
13
util.c
13
util.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: util.c,v 1.2 2009-04-29 22:25:20 nicm Exp $ */
|
/* $Id: util.c,v 1.3 2009-04-30 05:42:46 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -55,17 +55,16 @@ section_string(char *buf, size_t len, size_t sectoff, size_t sectlen)
|
|||||||
void
|
void
|
||||||
clean_string(const char *in, char *buf, size_t len)
|
clean_string(const char *in, char *buf, size_t len)
|
||||||
{
|
{
|
||||||
const u_char *cp;
|
size_t off;
|
||||||
size_t off;
|
|
||||||
|
|
||||||
off = 0;
|
off = 0;
|
||||||
for (cp = in; *cp != '\0'; cp++) {
|
for (; *in != '\0'; in++) {
|
||||||
if (off >= len)
|
if (off >= len)
|
||||||
break;
|
break;
|
||||||
if (*cp >= 0x20 && *cp <= 0x7f)
|
if (*in >= 0x20 && *in <= 0x7f)
|
||||||
buf[off++] = *cp;
|
buf[off++] = *in;
|
||||||
else
|
else
|
||||||
off += xsnprintf(buf + off, len - off, "\\%03hho", *cp);
|
off += xsnprintf(buf + off, len - off, "\\%03hho", *in);
|
||||||
}
|
}
|
||||||
if (off < len)
|
if (off < len)
|
||||||
buf[off] = '\0';
|
buf[off] = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user