diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-30 14:24:00 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-30 14:24:00 +0100 |
commit | 456202f2327c6366a89250dda7f5286e2deeb4f0 (patch) | |
tree | ecf99456ecb0092464d17474ac5f063f903b4a78 | |
parent | man pages (diff) | |
download | sat-456202f2327c6366a89250dda7f5286e2deeb4f0.tar.gz sat-456202f2327c6366a89250dda7f5286e2deeb4f0.tar.bz2 sat-456202f2327c6366a89250dda7f5286e2deeb4f0.tar.xz |
the DEL char must be quoted
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
-rw-r--r-- | src/satd-list.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/satd-list.c b/src/satd-list.c index 08d0f75..0f0cfa9 100644 --- a/src/satd-list.c +++ b/src/satd-list.c @@ -40,17 +40,18 @@ quote(const char *str) { #define UNSAFE(c) strchr(" \"$()[]{};|&^#!?*~`<>", c) - size_t in = 0; /* < ' ' */ - size_t sn = 0; /* in UNSAFE */ - size_t bn = 0; /* = '\\' */ - size_t qn = 0; /* = '\'' */ - size_t rn = 0; /* other */ + size_t in = 0; /* < ' ' or 127 */ + size_t sn = 0; /* in UNSAFE */ + size_t bn = 0; /* = '\\' */ + size_t qn = 0; /* = '\'' */ + size_t rn = 0; /* other */ size_t n, i = 0; const unsigned char *s; char *rc = NULL; for (s = (const unsigned char *)str; *s; s++) { if (*s < ' ') in++; + else if (*s == 127) in++; else if (UNSAFE(*s)) sn++; else if (*s == '\\') bn++; else if (*s == '\'') qn++; @@ -77,7 +78,7 @@ quote(const char *str) rc[i++] = '$'; rc[i++] = '\''; for (s = (const unsigned char *)str; *s; s++) { - if (*s < ' ') { + if ((*s < ' ') || (*s == 127)) { rc[i++] = '\\'; rc[i++] = 'x'; rc[i++] = "0123456789ABCDEF"[(*s >> 4) & 15]; |