/* The "logpatch.c" filter below fixes "corrupt" log lines with nested
double quotes in the referrer field like this one:

24.95.85.37 - - [26/May/2000:09:25:36 +0200] "GET /eunetweb/lucho/index.html HTTP/1.0" 200 0 "http://search.excite.com/search.gw?search="midi+filer"&lang=en" "Mozilla/4.7 [en] (Win98; U)"
*/
/* By Luchezar Georgiev, lucho@mbox.digsys.bg */

#include <stdio.h>

void main()
{
    char s[512], t[512], *p, *q;
    int f;

    while (!0) {
	fgets(s, sizeof(s), stdin);
	if (feof(stdin))
	    break;
	f = 0;
	p = s;
	q = t;
	while (*p)
	    if ((*q++ = *p++) =='"' && ++f % 2 == 0 && *p !='\n' && *p !=' ') {
		q--;
		f--;
	    }
	*q = '\0';
	fputs(t, stdout);
    }
}
