summaryrefslogtreecommitdiffstats
path: root/util/webgrep.c
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-03-07 23:13:44 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-03-07 23:13:44 +0800
commitae31e19f92e717919ac8e3db9039eb38d2b89aae (patch)
treec70164d6a1852344f44b04a653ae2815043512af /util/webgrep.c
downloadpttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.gz
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.bz2
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.lz
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.xz
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.zst
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.zip
Initial revision
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@1 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
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;
+}