C pongd: press enter to quit.

This commit is contained in:
Philippe Pittoli 2025-10-18 23:15:29 +02:00
parent 6656e90790
commit 4d6af92a43

View file

@ -50,7 +50,14 @@ int main(int argc, char**argv) {
printf ("Set the timer to two seconds.\n");
ipc_context_timer (ctx, 2000);
printf ("Loop over events.\n");
printf ("Listening to the standard input (press enter to quit).\n");
ret = ipc_add_external (ctx, 0);
if (ret != 0) {
return err (ctx, "Cannot listen to standard input.");
}
printf ("Loop over events. Press enter to quit.\n");
char should_continue = 1;
size_t count = 0;
size_t count_timer = 0;
@ -68,7 +75,11 @@ int main(int argc, char**argv) {
switch ((enum event_types) event_type) {
case ERROR: return err(ctx, "Error.");
case EXTERNAL: return err(ctx, "External (shouldn't happen).");
case EXTERNAL: {
printf("Quitting!\n");
should_continue = 0;
break;
}
case SWITCH_RX: return err(ctx, "Switch RX (shouldn't happen).");
case SWITCH_TX: return err(ctx, "Switch TX (shouldn't happen).");
case CONNECTION: { printf ("New connection.\n"); break; }