summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/Makefile2
-rw-r--r--util/stock.perl19
-rw-r--r--util/weather.perl1
-rw-r--r--util/webgrep.c46
4 files changed, 11 insertions, 57 deletions
diff --git a/util/Makefile b/util/Makefile
index e423d171..cc94fdd5 100644
--- a/util/Makefile
+++ b/util/Makefile
@@ -31,7 +31,7 @@ CPROG_WITH_UTIL= \
# 下面這些程式, 會直接被 compile
CPROG_WITHOUT_UTIL= \
uhash_loader showboard \
- countalldice webgrep bbsrf initbbs \
+ countalldice bbsrf initbbs \
userlist merge_passwd \
merge_board bbsmail gamble_fix
diff --git a/util/stock.perl b/util/stock.perl
index 568c2d86..1c4120ed 100644
--- a/util/stock.perl
+++ b/util/stock.perl
@@ -6,18 +6,19 @@
# 中央氣象局的 WWW 及 URL 是否正確。
# 理論上適用所有 Eagle BBS 系列。
# -- Beagle Apr 13 1997
-open(BBSPOST, "| bin/webgrep >etc/stock.tmp");
-# 日期
-open(DATE, "date +'%a %b %d %T %Y' |");
-$date = <DATE>;
-chop $date;
-close DATE;
+open(BBSPOST, " >etc/stock.tmp");
# Header
# 內容
-#open(WEATHER, "/usr/local/bin/lynx -dump http://www.dashin.com.tw/bulletin_board/today_stock_price.htm |"); while (<WEATHER>) {
-open(WEATHER, "/usr/bin/lynx -dump http://quotecenter.jpc.com.tw/today_stock_price.htm |"); while(<WEATHER>) {
- print BBSPOST if ($_ ne "\n");
+my $url = 'http://quotecenter.jpc.com.tw/today_stock_price.htm';
+open(WEATHER, "/usr/bin/lynx -dump $url |");
+while(<WEATHER>) {
+ next if $_ eq "\n";
+ last if m/^References/;
+
+ s/\[[0-9\]]*//g;
+
+ print BBSPOST $_;
}
close WEATHER;
diff --git a/util/weather.perl b/util/weather.perl
index 0c3ce208..36d773d7 100644
--- a/util/weather.perl
+++ b/util/weather.perl
@@ -20,7 +20,6 @@ sub weather_report
# Header
# 內容
-#open(WEATHER, "$LYNX -assume_charset=big5 -assume_local_charset=big5 -dump http://www.cwb.gov.tw/V3.0/weather/text/W03.htm |");
open(WEATHER, "$LYNX -assume_charset=big5 -assume_local_charset=big5 -dump -nolist $link|");
while (<WEATHER>) {
diff --git a/util/webgrep.c b/util/webgrep.c
deleted file mode 100644
index d101e035..00000000
--- a/util/webgrep.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $Id$ */
-#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;
-}