summaryrefslogtreecommitdiffstats
path: root/util/webgrep.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/webgrep.c')
-rw-r--r--util/webgrep.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/util/webgrep.c b/util/webgrep.c
new file mode 100644
index 00000000..07089bb6
--- /dev/null
+++ b/util/webgrep.c
@@ -0,0 +1,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;
+}