Skip to content

Instantly share code, notes, and snippets.

@dsturnbull
Created January 19, 2011 02:05
Show Gist options
  • Save dsturnbull/785551 to your computer and use it in GitHub Desktop.
Save dsturnbull/785551 to your computer and use it in GitHub Desktop.
int
main(int argc, char *argv[])
{
dispatch_async(dispatch_get_global_queue(0, 0), ^{
EditLine *el;
History *myhistory;
int count;
const char *line;
HistEvent ev;
el = el_init("sp", stdin, stdout, stderr);
el_set(el, EL_PROMPT, &prompt);
el_set(el, EL_EDITOR, "emacs");
myhistory = history_init();
history(myhistory, &ev, H_SETSIZE, 800);
el_set(el, EL_HIST, history, myhistory);
while (true) {
line = el_gets(el, &count);
/* HANDLE INPUT HERE */
if (count > 0)
history(myhistory, &ev, H_ENTER, line);
}
history_end(myhistory);
el_end(el);
});
/* run the service */
while (true)
game_step();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment