From: cuz Date: Sat, 13 Oct 2001 15:45:04 +0000 (+0000) Subject: Fixed a bug X-Git-Tag: V2.12.0~2546 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2ec9ff05a6d2fe2c0493c4265b8af5250e0011c3;p=cc65 Fixed a bug git-svn-id: svn://svn.cc65.org/cc65/trunk@1050 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/samples/sieve.c b/samples/sieve.c index e04fc6fca..d20ef8b95 100644 --- a/samples/sieve.c +++ b/samples/sieve.c @@ -62,21 +62,21 @@ int main (void) /* Calculate the time used */ Ticks = clock() - Ticks; - /* Print the time used and wait for a key */ + /* Print the time used */ printf ("Time used: %lu ticks\n", Ticks); printf ("Press Q to quit, any other key for list\n"); - if (toupper (cgetc()) == 'Q') { - exit (EXIT_SUCCESS); - } - - /* Print the result */ - for (I = 2; I < COUNT; ++I) { - if (Sieve[I] == 0) { - printf ("%4d\n", I); - } - if (kbhit() && toupper (cgetc()) == 'q') { - break; - } + + /* Wait for a key and print the list if not 'Q' */ + if (toupper (cgetc()) != 'Q') { + /* Print the result */ + for (I = 2; I < COUNT; ++I) { + if (Sieve[I] == 0) { + printf ("%4d\n", I); + } + if (kbhit() && toupper (cgetc()) == 'Q') { + break; + } + } } return EXIT_SUCCESS;