File: nodelist2lbdb.pl.in

package info (click to toggle)
lbdb 0.56-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,224 kB
  • sloc: sh: 6,891; ansic: 1,779; perl: 381; lisp: 265; makefile: 225; objc: 44
file content (122 lines) | stat: -rw-r--r-- 2,964 bytes parent folder | download | duplicates (4)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#! @PERL@
#
# -*-perl-*-
#
# This little script reads Fido nodelist.XXX (and points24.YYY) in and
# generates a list with the following format from it: 
# <mailaddress> TAB <realname> TAB <comment>
# To reduce the size of the generated list, only Region 24 of the
# nodelist is used.
#
# The generated list can be used in combination of Thomas Roessler's
# lbdb for the Mutt mailreader.
#
##########################################################################
#
#   Copyright (C) 1998-2018  Roland Rosenfeld <roland@spinnaker.de>
#
#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License as
#   published by the Free Software Foundation; either version 2 of
#   the License, or (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#   General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software Foundation,
#   Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,, USA.
#
##########################################################################

$database="$ENV{HOME}/.lbdb/nodelist";

if (@ARGV == 0 || @ARGV >2 
    || !($ARGV[0] =~ /nodelist\.\d\d\d$/i) 
    || ((@ARGV == 2) && !($ARGV[1] =~ /points24\.\d\d\d$/i ))) {
  die "Usage: $0 nodelist.XXX [points24.YYY]\n";
}

open (DB, ">$database") || die "Cannot open $database for writing";

#
# Process Nodelist:
#

$zone=2;
$net=0;
$node=0;

open (NODELIST, "<$ARGV[0]") || die "Cannot open $ARGV[0]";
while (<NODELIST>) {
  next if /^;/;
  ($special,$number,$bbs,$city,$name) = split(/,/);

  if ($special =~ /Zone/) {
    $zone=$number;
    $net=$number;
    $node=0;
  } elsif ($special =~ /Region/) {
    $net=$number;
    $node=0;
  } elsif ($special =~ /Host/) {
    $net=$number;
    $node=0;
  } elsif ($special =~ /Down|Hold/) {
    next;
  } else {
    $node = $number;
  }

  $address = "$name\@f$node.n$net.z$zone.fidonet.org";
  $name =~ s/_/ /g;
  $bbs =~ s/_/ /g;

  #
  # Restrict to Region 24:
  #
#  if ($zone =~ /^2$/ && $net =~ /^24/ ) {
    print DB "$address\t$name\t$bbs\n";
#  }
}
close NODELIST;


#
# Process Pointlist:
#

$zone=2;
$net=0;
$node=0;
$point=0;

open (POINTLIST, "<$ARGV[1]") || die "Cannot open $ARGV[1]";
while (<POINTLIST>) {
  next if /^;/;
  ($special,$number,$bbs,$city,$name) = split(/,/);

  if ($special =~ /Region/) {
    next;
  } elsif ($special =~ /Host/) {
    ($net,$node) = split(/\//, $bbs);
    next;
  } elsif ($special =~ /Down|Hold/) {
    next;
  } else {
    $point = $number;
  }

  $address = "$name\@p$point.f$node.n$net.z$zone.fidonet.org";
  $name =~ s/_/ /g;
  $city =~ s/_/ /g;

  print DB "$address\t$name\t$city\n";

}
close NODELIST;


close DB;