X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-select-stdin.c;h=e9cee96f1fac7ea64677d903dbf31dc2ac5104f6;hb=0d92ff0717ae44fc7098f1f00aec634e5e79f2e9;hp=079dec50e709d6a23d23c0eb70e1a29987023dfa;hpb=b886ebac9e37729d68e765b141b099ec5b24ab2c;p=gnulib.git diff --git a/tests/test-select-stdin.c b/tests/test-select-stdin.c index 079dec50e..e9cee96f1 100644 --- a/tests/test-select-stdin.c +++ b/tests/test-select-stdin.c @@ -1,5 +1,5 @@ /* Test of select() substitute, reading from stdin. - Copyright (C) 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,34 +47,34 @@ main (void) gettimeofday (&after, NULL); spent_usec = (after.tv_sec - before.tv_sec) * 1000000 - + after.tv_usec - before.tv_usec; + + after.tv_usec - before.tv_usec; if (ret < 0) - { - perror ("select failed"); - exit (1); - } + { + perror ("select failed"); + exit (1); + } if ((ret == 0) != ! FD_ISSET (0, &readfds)) - { - fprintf (stderr, "incorrect return value\n"); - exit (1); - } + { + fprintf (stderr, "incorrect return value\n"); + exit (1); + } if (ret == 0) - { - if (spent_usec < 250000) - { - fprintf (stderr, "returned too early\n"); - exit (1); - } - /* Timeout */ - printf ("."); fflush (stdout); - } + { + if (spent_usec < 250000) + { + fprintf (stderr, "returned too early\n"); + exit (1); + } + /* Timeout */ + printf ("."); fflush (stdout); + } else - { - char c; + { + char c; - printf ("Input available! Trying to read 1 byte...\n"); - read (0, &c, 1); - } + printf ("Input available! Trying to read 1 byte...\n"); + read (0, &c, 1); + } } }