Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
Created September 20, 2011 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piscisaureus/1230165 to your computer and use it in GitHub Desktop.
Save piscisaureus/1230165 to your computer and use it in GitHub Desktop.
for (i = 0; i < nread; i++) {
char c = buf.base[i];
if ((c == '\r' && !(state & 1)) ||
(c == '\n' && (state & 1))) {
client->state++;
if (client->state == 4) {
// write!
break;
}
} else {
client->state = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment