Ilja,
I'm working on the imap code (glibifying, refactoring, etc) and came
across the quoted_string_out function. Me no understand.
It's docstring reads:
/*
* sends a string to outstream, escaping the following characters:
* " --> \"
* \ --> \\
*
* double quotes are placed at the beginning and end of the string.
*
*/
But the code says:
int quoted_string_out(FILE * outstream, const char *s)
{
int i, cnt;
// check wheter we must use literal string
for (i = 0; s[i]; i++) {
if (!(s[i] & 0xe0) || (s[i] & 0x80) || (s[i] == '"')
|| (s[i] == '\\')) {
cnt = fprintf(outstream, "{");
cnt +=
fprintf(outstream, "%lu",
(unsigned long) strlen(s));
cnt += fprintf(outstream, "}\r\n");
cnt += fprintf(outstream, "%s", s);
return cnt;
}
}
cnt = fprintf(outstream, "\"");
cnt += fprintf(outstream, "%s", s);
cnt += fprintf(outstream, "\"");
return cnt;
}
Am I being dense; I just don't see any escaping going on here. Perhaps I
should just rewrite the docstring then... or is the code out of whack
here ? Does this ring a bell or do I have to search the rfc ?
--
________________________________________________________________
Paul Stevens mailto:[EMAIL PROTECTED]
NET FACILITIES GROUP PGP: finger [EMAIL PROTECTED]
The Netherlands________________________________http://www.nfg.nl