datatracker/6.130.2.dev0/bin/count.c
Robert Sparks cf949872f1 New branch for 6.130.2.dev0
- Legacy-Id: 17832
2020-05-19 13:52:46 +00:00

27 lines
495 B
C

#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 = fgetc(stdin);
while(c != EOF)
{
if (c=='.' || c=='E' || c=='F' || c=='s') count++; else count=0;
fputc(c, stdout);
fflush(stdout);
if (count && count % 76 == 0) {
fprintf(stderr, "%4d\n", count);
fflush(stderr);
}
c = fgetc(stdin);
}
return 0;
}