Currently class is initialised as 2, which means that the charclass check is bypassed (max(charclass)=2 => class always >= charclass), and quoted strings are never emitted. Does this mean that there was a problem with quoted strings at some time?
It's more obvious what is going on in the following replacement switch statement version. (Seems to work with class = 0) Cheers, Patrick static int imclient_writeastring(struct imclient *imclient, const char *str) { const char *p; unsigned len = 0; int class = 0; char buf[30]; assert(imclient); assert(str); for (p = str; *p; p++) { len++; if (class > charclass[(unsigned char)*p]) { class = charclass[(unsigned char)*p]; } } if (len == 0) return 0; if (len >= 1024) class = 0; switch (class) { case 2: /* Atom */ imclient_write(imclient, str, len); break; case 1: /* Quoted-string */ imclient_write(imclient, "\"", 1); imclient_write(imclient, str, len); imclient_write(imclient, "\"", 1); break; case 0: /* Literal */ if (imclient->flags & IMCLIENT_CONN_NONSYNCLITERAL) { snprintf(buf, sizeof(buf), "{%u+}\r\n", len); imclient_write(imclient, buf, strlen(buf)); } else { imclient->readytag = imclient->gensym; snprintf(buf, sizeof(buf), "{%u}\r\n", len); imclient_write(imclient, buf, strlen(buf)); while (imclient->readytag) { imclient_processoneevent(imclient); } if (!imclient->readytxt) return 1; } imclient_write(imclient, str, len); break; } return 0; }