This is landkreis.pl in view mode; [Download] [Up]
#
# Erzeugung einer Landkreisliste
#
#############################################################################
# Copyright (C) 1993
# Andreas Koppenhoefer (koppenh@dia.informatik.uni-stuttgart.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., 675 Mass Ave, Cambridge, MA 02139, USA.
#############################################################################
# @(#)$Id: landkreis.pl,v 1.2 1993/06/15 15:38:36 koppenh Exp $
# $Log: landkreis.pl,v $
# Revision 1.2 1993/06/15 15:38:36 koppenh
# Neue Release Nummer;
#
# Revision 1.1.0.1 1993/06/08 19:14:29 koppenh
# RCSid string korrigiert
#
#############################################################################
sub landkreisliste {
return unless $landkreisliste;
local (@geschl) = keys(%gemeindeschluessel);
return if ($#geschl < $[);
# print join(':',(sort @geschl),"\n");
local($geschl, %landkreis);
while ($geschl = shift @geschl) {
$landkreis{substr($geschl, $[, 5)} ++;
}
# print join(':',(sort keys %landkreis),"\n");
print STDERR "Generiere Landkreisliste...\n";
# reopen database files
&do_lock;
open (UMSDA, "<$localprefix$umsdafile.packed")
|| die "$localprefix$umsdafile.packed: $!, aborted";
local($umsdasize) = (stat(UMSDA))[7];
$umsdasize *= 2 if ($landkreisliste==1);
local($plza, $oname_sort_a, $npanst_a, $ortname_a, $ortzusa, $alort,
$geschl, $nplz_z, $plz_z, $ortname_n, $nplz_p, $plz_p, $oname24_n,
@rest);
local($plzort, $longname, $line);
local($pass) = 2;
while ($pass >= $landkreisliste) {
$pass--;
seek (UMSDA, 0, &SEEK_SET) || die "seek UMSDA '0' failed, aborted";
while (<UMSDA>) {
printf (STDERR "%7.1f %% - %d Ort%s gefunden \r",
tell(UMSDA)*100/$umsdasize+($pass?0:50),
$count, ($count==1)?'':'e')
unless $. % 1000;
chop;
($plza, $oname_sort_a, $npanst_a, $ortname_a, $ortzusa, $alort,
$geschl, $nplz_z, $plz_z, $ortname_n, $nplz_p, $plz_p, $oname24_n,
@rest)
= split(/:/);
next if ($nplz_z < 1); # Ort hat keinen Zustellbezirk
if ($pass) {
next unless ($landkreis{substr($geschl, $[, 5)});
$plzwanted{$plza}++;
} else {
next unless ($plzwanted{$plza});
}
$longname = $ortname_a.' '.$ortzusa.' '.$npanst_a;
$longname =~ s/\s*(\W)/\1/g;
$longname =~ s/ $//;
if ($oname24_n ne '') {
$ortname_n = $oname24_n;
} else {
$ortname_n = $ortname_a
if (! $ortname_n); # && $ortname_a ne $longname);
}
$plzortneu = (($nplz_z == 1) ? $plz_z : '.....')." $ortname_n";
$plzortalt = "$plza $longname";
if (! $plzort{$plzortalt}) {
$plzort{$plzortalt} = $plzortneu;
local($sort) = &iso2umlaut($longname);
$sort =~ y/a-z/A-Z/;
$plzortsort{$plzortalt} = $sort." _".$plza;
# printf STDERR "%-40s %s\n", $plzortalt, $sort;
$count++;
# $line = sprintf ("%-43s= %s\n", $plzortalt, $plzortneu);
# while ($line =~ s/ ([.=])/ . \1/) {
# }
# print STDERR &iso2output($line);
}
}
}
print STDERR " \n";
sub by_ort {
$plzortsort{$a} cmp $plzortsort{$b};
}
print $printerinit[$printertype & 0xf];
foreach $plzortalt (sort by_ort keys %plzort) {
$line = sprintf ("%-43s= %s\n",
&iso2output($plzortalt),
&iso2output($plzort{$plzortalt}));
while ($line =~ s/ ([.=])/ . \1/) {
}
print $line;
}
}
1;
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.