blob: 07089bb65443db60f91cdbb295b34cec1d23f6c1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/* $Id: webgrep.c,v 1.1 2002/03/07 15:13:46 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char genbuf[256], *str, *buf;
while (fgets(genbuf, 255, stdin))
{
register int ansi;
if (!strncmp(genbuf, "References", 10))
break;
str = genbuf;
buf = genbuf;
if (!strncmp(genbuf, "lynx: Can't access", 18))
{
printf("氣象報導小姐休假中,請到Record版翻過去資料.");
break;
}
for (ansi = 0; *str; str++)
{
if (*str == '[' && strchr("0123456789", *(str + 1)))
{
ansi = 1;
}
else if (ansi)
{
if (!strchr("0123456789]", *str))
{
ansi = 0;
if (str)
*buf++ = *str;
}
}
else
{
if (str)
*buf++ = *str;
}
}
*buf = 0;
printf(genbuf);
}
return 0;
}
|