diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-07-22 14:06:39 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-07-22 14:06:39 +0800 |
commit | 323a29ae9f3474b8b017ffe8c7ee18d5633a9f9a (patch) | |
tree | 748b0c34fb53d9f8cb085bed430ec87253bfc093 | |
parent | 8eb6342572fb997b86dbe6c6b07ba0cd056db4b4 (diff) | |
download | pttbbs-trunk@1075.tar pttbbs-trunk@1075.tar.gz pttbbs-trunk@1075.tar.bz2 pttbbs-trunk@1075.tar.lz pttbbs-trunk@1075.tar.xz pttbbs-trunk@1075.tar.zst pttbbs-trunk@1075.zip |
check program for newsfeeds.bbstrunk@1075
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk@1075 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/innbbsd/inncheck.pl | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/pttbbs/innbbsd/inncheck.pl b/pttbbs/innbbsd/inncheck.pl new file mode 100644 index 00000000..2b98a305 --- /dev/null +++ b/pttbbs/innbbsd/inncheck.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl +use IO::Socket::INET; +$BBSHOME = '/home/bbs'; + +open NODES, "<$BBSHOME/innd/nodelist.bbs"; +while( <NODES> ){ + next if( /^\#/ ); + + ($nodename, $host) = $_ =~ /^(\S+)\s+(\S+)/; + next if( !$nodename ); + + $sock = IO::Socket::INET->new(PeerAddr => $host, + PeerPort => 119, + Proto => 'tcp'); + next if( !$sock ); + $sock->write("list\r\nquit\r\n"); + $sock->read($data, 104857600); + + foreach( split("\n", $data) ){ + $group{$nodename}{$1} = 1 + if( /^([A-Za-z0-9\.]+) \d+ \d+ y/ ); + } +} + +open FEEDS, "<$BBSHOME/innd/newsfeeds.bbs"; +while( <FEEDS> ){ + ++$line; + next if( /^\#/ ); + + next if( !(($gname, $board, $nodename) = + $_ =~ /^([\w\.]+)\s+(\w+)\s+(\w+)/) ); + + if( !-d ("$BBSHOME/boards/". substr($board, 0, 1). "/$board") ){ + print "$line: board not found ($board)\n"; + next; + } + + if( !$group{$nodename} ){ + print "$line: node not found ($nodename)\n"; + next; + } + + if( !$group{$nodename}{$gname} ){ + print "$line: group not found ($gname)\n"; + } +} + |