int main(int argc, char *argv[]) { int c; while ((c = getchar()) != EOF) { switch (c) { case 'z': reset_watch(); break; case 'p': puts(get_time()); break; case 'q': exit(0); default: break; } /* Anything remaining on the line is ignored. */ while (c != '\n' && c != EOF) c = getchar(); } return 1; }
int main (void) { int c; while ((c = getchar ()) != EOF) { switch (c) { case 'z': reset_watch (); break; case 'p': puts (get_time ()); break; case 'q': exit (EXIT_SUCCESS); } /* Anything remaining on the line is ignored. */ while (c != '\n' && c != EOF) c = getchar (); } exit (EXIT_FAILURE); }