A tiny utility to count test dots and periodically report the count.
- Legacy-Id: 13512
This commit is contained in:
parent
08f134bf52
commit
ed1e9cd8db
24
bin/count.c
Normal file
24
bin/count.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main( void )
|
||||
{
|
||||
int c;
|
||||
int count = 0;
|
||||
|
||||
//turn off buffering
|
||||
setvbuf(stdin, NULL, _IONBF, 0);
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
setvbuf(stderr, NULL, _IONBF, 0);
|
||||
|
||||
c = getchar();
|
||||
while(c != EOF)
|
||||
{
|
||||
if (c == '.') count++;
|
||||
putchar(c);
|
||||
if ( count % 76 == 0) {
|
||||
fprintf(stderr, "%4d", count);
|
||||
}
|
||||
c = getchar();
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue