Example #1
0
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;
}
Example #2
0
File: profile.c Project: 0xAX/emacs
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);
}