cLK/dmesg_filter.c

25 lines
400 B
C
Raw Permalink Normal View History

2011-11-06 23:48:03 +00:00
#include <stdio.h>
#include <string.h>
int main() {
char buff[0x40000];
char* ptr = buff;
while(!feof(stdin) && fgetc(stdin)!='\n');
while(!feof(stdin))
{
*ptr++=fgetc(stdin);*ptr=0;
if(ptr-buff>=5 && memcmp(ptr-5,"\nINFO",5)==0)
{
ptr[-5]=0;
if(ptr-buff>=6 && ptr[-6]=='\r' ) ptr[-6]=0;
printf("%s", buff);
ptr=buff;
}
}
printf("%s", buff);
}