Added clencode and cldecode to safe escape messages with clients

This commit is contained in:
Michiel Broek
2005-10-17 14:36:12 +00:00
parent 6cf5ac3431
commit ce6f83241b
9 changed files with 273 additions and 158 deletions

View File

@@ -530,7 +530,7 @@ char *clencode(char *s)
return s;
}
for (p = s, q = buf; *p != '\0';) {
if ((! isascii(*p)) || (*p == ',')) {
if ((! isascii(*p)) || (*p == ',') || (*p == ';')) {
*q++ = '\\';
*q++ = Base16Code[(*p >> 4) & 0x0f];
*q++ = Base16Code[*p & 0x0f];
@@ -570,6 +570,8 @@ char *cldecode(char *s)
*q++ = *p;
}
}
*q = '\0';
return s;
}