A tiny utility to count test dots and periodically report the count.

- Legacy-Id: 13512
This commit is contained in:
Henrik Levkowetz 2017-06-04 15:28:03 +00:00
parent 08f134bf52
commit ed1e9cd8db

24
bin/count.c Normal file
View 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;
}