isdnlog-3.57
WARNING: Experimental version! Please use isdnlog-3.56 for production systems!
This commit is contained in:
parent
6d3d2a6638
commit
c793cb437a
|
@ -428,6 +428,26 @@ CONFIG_ISDN_LOG_DE
|
|||
Check exactly one box to integrate country specific support into
|
||||
isdnlog.
|
||||
|
||||
Primary language for country names
|
||||
CONFIG_ISDN_LOG_CC_DE
|
||||
The destination database can be built with german or english
|
||||
country names.
|
||||
|
||||
National support for cities
|
||||
CONFIG_ISDN_LOG_DEST_DE
|
||||
Select this, if you want to have German cities in the destination
|
||||
database.
|
||||
So isdnlog can show a city name instead of a number prefix.
|
||||
In isdnrate you can type in known city names and countries.
|
||||
|
||||
National support for cities
|
||||
CONFIG_ISDN_LOG_DEST_AT
|
||||
S. above text for German cities.
|
||||
|
||||
National support for cities
|
||||
CONFIG_ISDN_LOG_DEST_NL
|
||||
S. above text for German cities.
|
||||
|
||||
Diversion services support
|
||||
CONFIG_DIVERTCTRL
|
||||
This program is needed to configure the supplementary diversion
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile.in,v 1.9 1998/10/23 13:12:49 fritz Exp $
|
||||
# $Id: Makefile.in,v 1.10 1999/10/25 18:30:33 akool Exp $
|
||||
#
|
||||
# Makefile for ISDN manpages
|
||||
# (C) 1997 Fritz Elfert
|
||||
|
@ -8,10 +8,17 @@ SHELL = /bin/sh
|
|||
AWK = @AWK@
|
||||
SED = @SED@
|
||||
MANDIR = @CONFIG_MANDIR@
|
||||
MANPAGES = ttyI.4 isdninfo.4 isdn_audio.4 isdnctrl.4 isdn_cause.7
|
||||
MANPAGES = ttyI.4 isdninfo.4 isdn_audio.4 isdnctrl.4 isdn_cause.7 \
|
||||
isdnrate.1 rate-files.5
|
||||
INSTALL_MAN = @INSTALL@ -o 0 -g 0 -m 0644
|
||||
prefix = @prefix@
|
||||
|
||||
%.1: %.man
|
||||
cp $< $@
|
||||
|
||||
%.5: %.man
|
||||
cp $< $@
|
||||
|
||||
%.4: %.man
|
||||
MANDATE=`grep CHECKIN $< | $(AWK) '{print $$4}'`; \
|
||||
$(SED) -e s%@MANDATE@%$$MANDATE%g $< > $@
|
||||
|
|
|
@ -4,7 +4,7 @@ isdnrate \- Print telefon rates and various info from rate\-files(5).
|
|||
.SH SYNOPSIS
|
||||
.BI "isdnrate \-b" best " \-d" day " \-f" from " \-h" hour " \-l" len
|
||||
.BI " \-p" provs " \-t" takt " \-v" verbose " \-x" exclude
|
||||
.BI " \-C \-D" det " -\G" data " \-H \-L \-S" sort " \-T \-U \-V \-X" explain
|
||||
.BI " \-C \-D" det " -\G" data " \-H \-L \-N \-S" sort " \-T \-U \-V \-X" explain
|
||||
.B NUMBER
|
||||
.P
|
||||
All options are optional.
|
||||
|
@ -116,6 +116,10 @@ Print a semicolon separated list of
|
|||
vbn ; providername ; zone ; day ; time ; currency ; charge ; basicprice ; price ;
|
||||
duration ; charge/min ; takt ; minimum price
|
||||
.P
|
||||
.B \-N
|
||||
Show info about following numbers. If no provider is given, the preselected
|
||||
provider is used.
|
||||
.P
|
||||
.B \-S sort
|
||||
Sort output by \fIsort\fP, which may be
|
||||
.IP
|
|
@ -168,11 +168,13 @@ where
|
|||
.I MinCharge|
|
||||
is an (optional) minimum charge,
|
||||
.I Charge
|
||||
the rate per second or optional rate per
|
||||
the rate per
|
||||
.I Duration
|
||||
second or optional rate per
|
||||
.I (Divider)
|
||||
seconds,
|
||||
.I Duration
|
||||
is the length of one charge impuls. After
|
||||
is the length of one charge impuls in seconds. After
|
||||
.I Delay
|
||||
the next duration is taken. If delay ist not given it equals to the duration.
|
||||
The last duration may not have a delay and may not be zero.
|
|
@ -22,4 +22,19 @@ choice 'Country specific chargeinfo support' \
|
|||
AT CONFIG_ISDN_LOG_AT \
|
||||
NL CONFIG_ISDN_LOG_NL \
|
||||
CH CONFIG_ISDN_LOG_CH" DE
|
||||
if [ "$CONFIG_ISDN_LOG_DE" = "y" ]; then
|
||||
CONFIG_ISDN_LOG_DEST_DE="y"
|
||||
fi
|
||||
if [ "$CONFIG_ISDN_LOG_AT" = "y" ]; then
|
||||
CONFIG_ISDN_LOG_DEST_AT="y"
|
||||
fi
|
||||
if [ "$CONFIG_ISDN_LOG_NL" = "y" ]; then
|
||||
CONFIG_ISDN_LOG_DEST_NL="y"
|
||||
fi
|
||||
choice 'Primary language for country names' \
|
||||
"DE CONFIG_ISDN_LOG_CC_DE \
|
||||
EN CONFIG_ISDN_LOG_CC_EN" DE
|
||||
bool 'Include German cities in destination database' CONFIG_ISDN_LOG_DEST_DE y
|
||||
bool 'Include Austrian cities in destination database' CONFIG_ISDN_LOG_DEST_AT y
|
||||
bool 'Include Dutch cities in destination database' CONFIG_ISDN_LOG_DEST_NL y
|
||||
endmenu
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
amerikanisch samoa amerikanisch-samoa
|
||||
amerikanische jungeferninseln amerikanische jungferninseln
|
||||
antigua und barbadu antigua und barbuda
|
||||
antillen niederl. antillen
|
||||
aquatorial-guinea Äquatorial-guinea
|
||||
ascension inseln (gb) ascension
|
||||
aserbeidschan aserbaidschan
|
||||
bahrein bahrain
|
||||
bangla desh bangladesch
|
||||
botsuana botswana botsuana
|
||||
brunei daressalam brunei
|
||||
brunei darussalam brunei
|
||||
burkina faso (obervolta) burkina faso obervolta
|
||||
burkina-faso burkina faso obervolta
|
||||
cayman kaimaninseln
|
||||
cayman inseln kaimaninseln
|
||||
caymaninseln kaimaninseln
|
||||
chatham inseln chatham-inseln
|
||||
chil chile
|
||||
cook inseln cookinseln
|
||||
cook-inseln cookinseln
|
||||
dominikanische republi dominikanische republik
|
||||
dublin nordirland
|
||||
ecuador guinea Äquatorial-guinea
|
||||
elfenbeinkÜste elfenbeinküste cote de ivoire
|
||||
england großbritannien
|
||||
eritea eritrea
|
||||
faeroer färöer-inseln
|
||||
falkland inseln falklandinseln
|
||||
falkland-inseln falklandinseln
|
||||
fidschi-inseln fidschi
|
||||
fidschiinseln fidschi
|
||||
finland mobilfunk finnland mobilfunk
|
||||
französisch guayana französisch-guayana
|
||||
französisch polynesien französisch-polynesien
|
||||
färöer inseln färöer-inseln
|
||||
groenland grönland
|
||||
grossbritannien großbritannien
|
||||
guinea - bissau guinea-bissau
|
||||
guinea bissau guinea-bissau
|
||||
guyanna guyana
|
||||
hawaii-inseln hawaii
|
||||
holland niederlande
|
||||
hong kong hongkong
|
||||
hongkong mobilfunk hong kong mobilfunk
|
||||
honkong hongkong
|
||||
inmarsat a (e.atlantic) inmarsat a daten/fax
|
||||
inmarsat a (indien) inmarsat mini-m
|
||||
inmarsat a (pacific) inmarsat a daten/fax
|
||||
inmarsat a (w. atlantic) inmarsat a daten/fax
|
||||
inmarsat b ( e.atlantic) inmarsat a daten/fax
|
||||
inmarsat b (indien) inmarsat mini-m
|
||||
inmarsat b (pacific) inmarsat mini-m
|
||||
inmarsat b (w. atlantic) inmarsat a daten/fax
|
||||
inmarsat b-hsd inmarsat b hsd
|
||||
inmarsat m (e.atlantic) inmarsat a daten/fax
|
||||
inmarsat m (indien) inmarsat mini-m
|
||||
inmarsat m (pacific) inmarsat mini-m
|
||||
inmarsat m (w.atlantic) inmarsat a daten/fax
|
||||
inmarsat mini-m (e.atlantic) inmarsat mini-m
|
||||
inmarsat mini-m (indien) inmarsat mini-m
|
||||
inmarsat mini-m (pacific) inmarsat mini-m
|
||||
inmarsat mini-m (w.atlantic) inmarsat mini-m
|
||||
inmarsat mini-m (worldwide) inmarsat mini-m
|
||||
jungfern inseln britisch britische jungferninseln
|
||||
jungferninseln (us) amerikanische jungferninseln
|
||||
kaiman inseln kaimaninseln
|
||||
kanalinseln (gb) kanalinseln (großbritannien)
|
||||
kapverdische inseln cape verde
|
||||
kazachstan kasachstan
|
||||
kokos inseln kokosinseln
|
||||
kokos-inseln kokosinseln
|
||||
korea südkorea
|
||||
korea nord nordkorea
|
||||
korea süd südkorea
|
||||
liechtensctein liechtenstein
|
||||
marianen (nördliche) marianen (saipannord-)
|
||||
marokka marokko
|
||||
marshall inseln marshallinseln
|
||||
marshall-inseln marshallinseln
|
||||
mauritanien mauretanien
|
||||
mayotte island mayotte
|
||||
midway inseln midway-inseln
|
||||
moldau (republik) moldavien moldau (republik)
|
||||
moldau-republik moldavien moldau (republik)
|
||||
myanmar (burma) myanmar burma
|
||||
myanmar/burma myanmar burma
|
||||
neu kaledonien neukaledonien
|
||||
neu seeland neuseeland
|
||||
nord-korea nordkorea
|
||||
nordzypern zypern (türkisch)
|
||||
norfolk inseln norfolkinseln
|
||||
norfolk-inseln norfolkinseln
|
||||
norfolk-inseln (australien) norfolkinseln
|
||||
oman (sultanat) oman
|
||||
palau (=belau) palau /belau
|
||||
palau-inseln palau /belau
|
||||
papua - neuguinea papua-neuguinea
|
||||
papua neu guinea papua-neuguinea
|
||||
papua neuguinea papua-neuguinea
|
||||
phillipinen philippinen
|
||||
pitcairn-inseln pitcairn inseln
|
||||
russische förderation (östl.) russische forderation (ostl.)
|
||||
russland russische forderation (ostl.)
|
||||
russland (westlich) russische föderat. (westl.)
|
||||
russland (östlich) russische forderation (ostl.)
|
||||
rußland moskau overlay moskau
|
||||
saint vincent und grenadinen st. vincent und grenadinen
|
||||
salomon inseln salomonen
|
||||
samoa (western) west-samoa
|
||||
samoa west west-samoa
|
||||
san mario san marino
|
||||
saudi - arabien saudi arabien
|
||||
saudi-arabien saudi arabien
|
||||
saudiarabien saudi arabien
|
||||
slowakai slowakische republik
|
||||
slowake slowakische republik
|
||||
sonderjylland sønderjylland
|
||||
st kitts und nevis st. kitts und nevis
|
||||
st. kitts st. kitts und nevis
|
||||
süd-korea südkorea
|
||||
tansani tansania
|
||||
turks und caicos inseln turks- und caicosinseln
|
||||
turks- und caicos inseln turks- und caicosinseln
|
||||
turks- und caicos-inseln turks- und caicosinseln
|
||||
urugay uruguay
|
||||
v.r. korea. nordkorea
|
||||
vanuat vanuatu
|
||||
vereinigt arabische emirate ver. arabische emirate
|
||||
wake-inseln wake inseln
|
||||
wallis und futuna inseln wallis und futuna
|
||||
weißrussland weissrussland
|
||||
weißrußland weissrussland
|
||||
weißrußland (belarus) weissrussland
|
||||
weißrußland/belarus weissrussland
|
||||
western samoa (independent state of) west-samoa
|
||||
zentral. afrika. rep. zentralafrikanische republik
|
||||
zypern (türk.) zypern (türkisch)
|
||||
zypern(griech) zypern
|
||||
zürich zurich
|
||||
Äquatorial - guinea Äquatorial-guinea
|
||||
Äquatorial guinea Äquatorial-guinea
|
||||
Äquatorialguinea Äquatorial-guinea
|
||||
Österrreich Österreich
|
|
@ -1,4 +1,4 @@
|
|||
## $Id: Makefile.in,v 1.110 1999/10/22 19:57:58 akool Exp $
|
||||
## $Id: Makefile.in,v 1.111 1999/10/25 18:33:13 akool Exp $
|
||||
##
|
||||
## ISDN accounting for isdn4linux.
|
||||
##
|
||||
|
@ -19,6 +19,11 @@
|
|||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
##
|
||||
## $Log: Makefile.in,v $
|
||||
## Revision 1.111 1999/10/25 18:33:13 akool
|
||||
## isdnlog-3.57
|
||||
## WARNING: Experimental version!
|
||||
## Please use isdnlog-3.56 for production systems!
|
||||
##
|
||||
## Revision 1.110 1999/10/22 19:57:58 akool
|
||||
## isdnlog-3.56 (for Karsten)
|
||||
##
|
||||
|
@ -745,6 +750,8 @@ export ILABEL := %b %e %T %ICall to tei %t from %N2 on %n2
|
|||
export OLABEL := %b %e %T %Itei %t calling %N2 with %n2
|
||||
export CHARGEMAX := 1000.00
|
||||
|
||||
USE_DESTINATION =1
|
||||
|
||||
|
||||
ifndef ROOTDIR
|
||||
export ROOTDIR=$(shell pwd)
|
||||
|
@ -760,8 +767,8 @@ SUBDIRS += $(LIBISDNDIR)
|
|||
endif
|
||||
|
||||
# export CFLAGS = -Wall -pipe -O6 -fomit-frame-pointer -fforce-mem -fforce-addr -funroll-loops -fstrength-reduce
|
||||
export CFLAGS = -Wall -pipe
|
||||
|
||||
export CFLAGS = -Wall -pipe
|
||||
ifndef _CC
|
||||
export _CC = gcc
|
||||
endif
|
||||
|
@ -772,8 +779,9 @@ INCLUDE = -I./isdnlog -I./connect -I./tools -I$(PREFIXDIR) -I$(LIBISDNDIR) -
|
|||
|
||||
LIB = $(DBMLIB) -lm
|
||||
|
||||
|
||||
|
||||
ifeq ($(USE_DESTINATION),1)
|
||||
DEFS += -DUSE_DESTINATION
|
||||
endif
|
||||
|
||||
SERVICEFILE = /etc/services
|
||||
|
||||
|
@ -782,7 +790,7 @@ SERVICEFILE = /etc/services
|
|||
# DON'T EDIT BELOW THIS LINE
|
||||
######################################################################
|
||||
|
||||
VERSION = 3.56
|
||||
VERSION = 3.57
|
||||
|
||||
MANPAGES = isdnlog/callerid.conf.5 isdnlog/isdn.conf.5 \
|
||||
isdnlog/isdnformat.5 isdnlog/isdnlog.5 isdnlog/isdnlog.8 \
|
||||
|
@ -812,14 +820,15 @@ DEFS += \
|
|||
$(INCLUDE)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(DEFS) $(INCLUDE) -c -o $@ $<
|
||||
@$(CC) $(CFLAGS) $(DEFS) $(INCLUDE) -c -o $@ $<
|
||||
@echo Compiling $<
|
||||
|
||||
ISDNLOG_OBJS = isdnlog/isdnlog.o isdnlog/processor.o isdnlog/functions.o \
|
||||
isdnlog/server.o isdnlog/start_prog.o isdnlog/messages.o \
|
||||
connect/connect.o connect/socket.o tools/tools.o \
|
||||
connect/conv_address.o isdnlog/user_access.o \
|
||||
tools/isdnconf.o tools/telnum.o \
|
||||
tools/rate.o tools/zone.o tools/country.o tools/holiday.o \
|
||||
tools/rate.o tools/zone.o tools/holiday.o \
|
||||
isdnlog/asn1.o isdnlog/asn1_generic.o isdnlog/asn1_aoc.o \
|
||||
isdnlog/asn1_address.o isdnlog/asn1_diversion.o \
|
||||
isdnlog/asn1_basic_service.o isdnlog/asn1_comp.o \
|
||||
|
@ -840,19 +849,32 @@ endif
|
|||
|
||||
ISDNREP_OBJS = isdnrep/rep_main.o tools/tools.o tools/isdnconf.o \
|
||||
isdnlog/messages.o isdnrep/isdnrep.o \
|
||||
tools/rate.o tools/zone.o tools/country.o tools/holiday.o \
|
||||
tools/rate.o tools/zone.o tools/holiday.o \
|
||||
tools/telnum.o \
|
||||
$(LIBISDNDIR)/libisdn.a
|
||||
|
||||
ISDNCONF_OBJS= isdnconf/isdnconf.o tools/tools.o tools/isdnconf.o \
|
||||
tools/rate.o tools/zone.o tools/country.o tools/holiday.o \
|
||||
tools/rate.o tools/zone.o tools/holiday.o \
|
||||
tools/telnum.o \
|
||||
$(LIBISDNDIR)/libisdn.a
|
||||
|
||||
ISDNRATE_OBJS= tools/isdnrate.o tools/isdnconf.o tools/tools.o \
|
||||
tools/rate.o tools/zone.o tools/country.o tools/holiday.o \
|
||||
tools/rate.o tools/zone.o \
|
||||
tools/holiday.o \
|
||||
tools/telnum.o \
|
||||
$(LIBISDNDIR)/libisdn.a
|
||||
|
||||
ifeq ($(USE_DESTINATION),1)
|
||||
ISDNRATE_OBJS += tools/dest.o
|
||||
ISDNCONF_OBJS += tools/dest.o
|
||||
ISDNLOG_OBJS += tools/dest.o
|
||||
ISDNREP_OBJS += tools/dest.o
|
||||
else
|
||||
ISDNRATE_OBJS += tools/country.o
|
||||
ISDNCONF_OBJS += tools/country.o
|
||||
ISDNLOG_OBJS += tools/country.o
|
||||
ISDNREP_OBJS += tools/country.o
|
||||
endif
|
||||
|
||||
ISDNLOG = bin/isdnlog
|
||||
ISDNCONF = bin/isdnconf
|
||||
|
@ -863,7 +885,13 @@ MODS = *.o */*.o
|
|||
|
||||
PROGS = $(ISDNLOG) $(ISDNREP) $(ISDNCONF) $(ISDNRATE)
|
||||
|
||||
all: depend libs mybin $(PROGS) $(MANPAGES)
|
||||
all: depend libs mybin progs $(MANPAGES)
|
||||
|
||||
options:
|
||||
@echo Making $< with
|
||||
@echo $(CC) $(CFLAGS) $(DEFS) $(INCLUDE)
|
||||
|
||||
progs: options $(PROGS)
|
||||
|
||||
mybin:
|
||||
-mkdir -p bin
|
||||
|
@ -905,6 +933,8 @@ uninstall: rootperm
|
|||
$(DESTDIR)$(MAN5DIR)/isdnlog.users$(MAN5EXT) \
|
||||
$(DESTDIR)$(DATADIR)/country-$(NATION).dat \
|
||||
$(DESTDIR)$(DATADIR)/rate-$(NATION).dat \
|
||||
$(DESTDIR)$(DATADIR)/dest.gdbm
|
||||
|
||||
|
||||
installdirs: rootperm
|
||||
$(INSTALL_DIR) $(DESTDIR)$(I4LCONFDIR)
|
||||
|
@ -916,6 +946,10 @@ installdirs: rootperm
|
|||
$(INSTALL_DIR) $(DESTDIR)$(DATADIR)
|
||||
|
||||
install: all rootperm installdirs
|
||||
install-progs
|
||||
install-data
|
||||
|
||||
install-progs:
|
||||
@echo "Killing running isdnlog!"
|
||||
-@if ps x | fgrep $(ISDNLOG) >/dev/null; then kill `cat $(RUNDIR)/isdnlog.isdnctrl0.pid 2>/dev/null`; fi
|
||||
-@test ! -d $(DESTDIR)$(OLDCONFDIR) || cp -auv $(DESTDIR)$(OLDCONFDIR)/$(USERFILE) $(DESTDIR)$(I4LCONFDIR)
|
||||
|
@ -933,16 +967,21 @@ install: all rootperm installdirs
|
|||
$(INSTALL_BIN) $(ISDNREP) $(DESTDIR)$(BINDIR)
|
||||
$(INSTALL_BIN) $(ISDNCONF) $(DESTDIR)$(BINDIR)
|
||||
$(INSTALL_BIN) $(ISDNRATE) $(DESTDIR)$(BINDIR)
|
||||
|
||||
install-data:
|
||||
$(INSTALL_DATA) isdnlog/isdnlog.8 $(DESTDIR)$(MAN8DIR)/isdnlog$(MAN8EXT)
|
||||
$(INSTALL_DATA) isdnrep/isdnrep.1 $(DESTDIR)$(MAN1DIR)/isdnrep$(MAN1EXT)
|
||||
$(INSTALL_DATA) isdnconf/isdnconf.1 $(DESTDIR)$(MAN1DIR)/isdnconf$(MAN1EXT)
|
||||
$(INSTALL_DATA) isdnlog/callerid.conf.5 $(DESTDIR)$(MAN5DIR)/callerid.conf$(MAN5EXT)
|
||||
$(INSTALL_DATA) isdnlog/isdnlog.5 $(DESTDIR)$(MAN5DIR)/isdnlog$(MAN5EXT)
|
||||
$(INSTALL_DATA) isdnlog/isdnlog.users.5 $(DESTDIR)$(MAN5DIR)/isdnlog.users$(MAN5EXT)
|
||||
$(INSTALL_DATA) country-$(NATION).dat $(DESTDIR)$(DATADIR)
|
||||
$(INSTALL_DATA) country-de.dat $(DESTDIR)$(DATADIR)
|
||||
$(INSTALL_DATA) rate-$(NATION).dat $(DESTDIR)$(DATADIR)
|
||||
$(INSTALL_DATA) holiday-$(NATION).dat $(DESTDIR)$(DATADIR)
|
||||
$(INSTALL_DATA) zone-$(NATION)-dtag.gdbm $(DESTDIR)$(DATADIR)
|
||||
@for f in `ls zone-$(NATION)-*.{gdbm,db} tools/dest/dest.{gdbm,db}` ; do \
|
||||
$(INSTALL_DATA) $$f $(DESTDIR)$(DATADIR); \
|
||||
echo Installing $(DESTDIR)$(DATADIR)/$$f; \
|
||||
done
|
||||
@if [ ! -f "$(DESTDIR)$(I4LCONFDIR)/rate.conf" ]; then \
|
||||
$(INSTALL_DATA) samples/rate.conf.$(NATION) $(DESTDIR)$(I4LCONFDIR)/rate.conf ; \
|
||||
else \
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
ISDNLOG - Version 3.50 - 11-Sep-99 00:15
|
||||
ISDNLOG - Version 3.56 - 18-Oct-1999
|
||||
|
||||
|
||||
isdnlog ist ein Utility zur Auswertung des D-Kanals eines
|
||||
ISDN-BRI Anschlusses.
|
||||
|
||||
isdnlog-3.50 wurde ausgiebig mit Linux-2.0.37 getestet.
|
||||
isdnlog-3.56 wurde ausgiebig mit Linux-2.0.37 getestet.
|
||||
|
||||
|
||||
Fuer alle, die es nun ueberhaupt nicht mehr abwarten koennen, hier das
|
||||
|
@ -541,7 +541,7 @@ COUNTRYPREFIX:
|
|||
Es enthaelt den Prefix zur Laenderkennung. Beim Kompilieren ist dieser
|
||||
Wert defaultmaessig auf "+" gesetzt. Dieser Eintrag ist optional.
|
||||
|
||||
CODELIB:
|
||||
[ obsolete seit isdnlog 3.45 CODELIB:
|
||||
Es kann nach dem Kompilieren eingestellt werden, welche Library verwendet
|
||||
werden soll. Fuer AVON wird dort "AVON" eingetragen und fuer areacode
|
||||
wird dort "AREACODE" eingetragen. Andere Werte sind dort zur Zeit nicht
|
||||
|
@ -550,15 +550,17 @@ CODELIB:
|
|||
Dieser Eintrag ist optional.
|
||||
Beispiel:
|
||||
CODELIB=avon
|
||||
]
|
||||
|
||||
AREALIB:
|
||||
[ obsolete seit isdnlog 3.45 AREALIB:
|
||||
Enthaelt den vollen Pfad zu der Datei "areacode.dat". Diese Angabe ist
|
||||
optional und nur notwendig, wenn sich der Pfad nach der Compilation
|
||||
geaendert hat.
|
||||
Beispiel:
|
||||
AREALIB=/usr/share/lib/areacode.dat
|
||||
]
|
||||
|
||||
AVONLIB:
|
||||
[ obsolete seit isdnlog 3.45 AVONLIB:
|
||||
Enthaelt den vollen Pfad zu der Datei "avon". Diese Angabe ist
|
||||
optional und nur notwendig, wenn sich der Pfad nach der Compilation
|
||||
geaendert hat.
|
||||
|
@ -567,8 +569,65 @@ AVONLIB:
|
|||
|
||||
Da aber defaultmaessig die Arealib verwendet wird, ist die Datei
|
||||
avon obsolete.
|
||||
]
|
||||
|
||||
[ISDNLOG]
|
||||
|
||||
COUNTRYFILE = /usr/lib/isdn/country-de.dat
|
||||
|
||||
Diese Datei beinhaltet Länderbezeichnungen und Vorwahlen. Sie dient
|
||||
als Ausgangsbasis zum Erzeugen der Destination-Datenbank dest.gdbm.
|
||||
|
||||
RATEFILE= /usr/lib/isdn/rate-de.dat
|
||||
|
||||
Pfad für die Gebührendatenbank. Diese Datei ist landesspezifisch.
|
||||
s. auch
|
||||
man rate-files
|
||||
|
||||
RATECONF= /etc/isdn/rate.conf
|
||||
|
||||
Beinhaltet den selektierten Tarif für Provider, die unterschiedliche
|
||||
Tarife anbieten.
|
||||
|
||||
HOLIDAYS= /usr/lib/isdn/holiday-de.dat
|
||||
|
||||
Feiertagstabelle - landesspezifisch.
|
||||
|
||||
ZONEFILE= /usr/lib/isdn/zone-de-%s.gdbm
|
||||
|
||||
Verzonungsinformation für die einzelnen Provider - landesspezifisch.
|
||||
Das '%s' im Dateinahmen wird durch den Eintrag D:xxx in rate-CC.dat
|
||||
ersetzt.
|
||||
|
||||
s. auch isdnlog/samples/isdn.conf.CC für verschiedene Konfigurationen.
|
||||
|
||||
DESTFILE= /usr/lib/isdn/dest.gdbm
|
||||
|
||||
Destination Database mit Ortsnamen und Vorwahlen
|
||||
|
||||
VBN = Verbindungsnetzbetreiberauswahlnummer
|
||||
|
||||
Deutschland ... 010
|
||||
Österreich ... 10
|
||||
Niederlande ... 16:17
|
||||
|
||||
VBNLEN = Anzahl Ziffern nach VBN
|
||||
|
||||
Deutschland ... 2:3
|
||||
Österreich ... 2
|
||||
Niederlande ... 1 ???
|
||||
|
||||
|
||||
PRESELECTED = Providernummer
|
||||
|
||||
Deutschland ... 33
|
||||
Österreich ... 1
|
||||
Niederlande ... 999
|
||||
Frankreich ... 0
|
||||
|
||||
s. auch die entsprechenden Kommandlineparameter von isdnlog
|
||||
|
||||
|
||||
Die ISDN-Tools erlauben es, Umgebungsvariablen zu setzen und zu verwenden.
|
||||
Es gibt Variablen, die in der isdn.conf (oder vorher) gesetzt werden sollten.
|
||||
Diese sind in der Sektion [VARIABLES] zu setzen.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
V:0.91 Int based on 1.03-Germany [04-Oct-1999 18:00:00]
|
||||
V:0.92 Int based on 1.03-Germany [25-Oct-1999 20:00:00]
|
||||
# ISO 3166 Countrycodes ( ftp://sunsite.unc.edu/pub/Linux/apps/misc/
|
||||
# countrycodes.1.0.2.tar.gz
|
||||
# Airportcodes: http://www.TravelDesk.com/airports.html
|
||||
|
@ -17,6 +17,10 @@ E:Uzbekistan
|
|||
C:+998, +7590, +7436, +743, +7375, +7374, +7373, +7372, +7371, +737, +7369, +7367, +7366, +7365, +7362, +7361
|
||||
T:UZ
|
||||
|
||||
N:Kirgisien Mobilfunk
|
||||
C:+99631, +99632, +99634, +99635, +99636, +99637, +99639
|
||||
T:_KGMF
|
||||
|
||||
N:Kirgisien
|
||||
A:Kirgizia,Kirgisistan, Kirgistan
|
||||
E:Kyrgyzstan
|
||||
|
@ -106,6 +110,10 @@ E:Saudi Arabia
|
|||
C:+966
|
||||
T:SA
|
||||
|
||||
N:Kuwait Mobilfunk
|
||||
C:+9659
|
||||
T:_KWMF
|
||||
|
||||
N:Kuwait
|
||||
A:Kuweit
|
||||
C:+965
|
||||
|
@ -122,6 +130,10 @@ A:Syrien (Arabische Republik)
|
|||
C:+963
|
||||
T:SY
|
||||
|
||||
N:Jordanien Mobilfunk
|
||||
C:+96279
|
||||
T:_JOMF
|
||||
|
||||
N:Jordanien
|
||||
E:Jordan
|
||||
C:+962
|
||||
|
@ -161,6 +173,10 @@ N:Pakistan
|
|||
C:+92
|
||||
T:PK
|
||||
|
||||
N:Indien Mobilfunk
|
||||
C:+9198
|
||||
T:_INMF
|
||||
|
||||
N:Indien
|
||||
A:India
|
||||
E:+91
|
||||
|
@ -196,6 +212,10 @@ A:Iridium Iridium-Homed
|
|||
C:+8816
|
||||
T:_IR16
|
||||
|
||||
N:Bangladesh Mobilfunk
|
||||
C:+8801
|
||||
T:_BDMF
|
||||
|
||||
N:Bangladesch
|
||||
E:Bangladesh
|
||||
C:+880
|
||||
|
@ -558,6 +578,10 @@ C:+6421
|
|||
R:NZ
|
||||
T:_NZMF
|
||||
|
||||
N:Philippinen Mobilfunk
|
||||
C:+63241, +63242, +6327, +63275, +63291, +6385, +6390, +63912, +63915, +63917, +63918, +63973
|
||||
T:_PHMF
|
||||
|
||||
N:Philippinen
|
||||
E:Phillipines
|
||||
A:Phillippinen
|
||||
|
@ -661,6 +685,10 @@ E:Colombia
|
|||
C:+57
|
||||
T:CO
|
||||
|
||||
N:Chile Mobilfunk
|
||||
C:+561, +56568, +56569, +56600, +569
|
||||
T:_CLMF
|
||||
|
||||
N:Chile
|
||||
A:Chile & Easter Island
|
||||
C:+56
|
||||
|
@ -742,6 +770,10 @@ A:Kosta Rica
|
|||
C:+506
|
||||
T:CR
|
||||
|
||||
N:Nicaragua Mobilfunk
|
||||
C:+505800, +505830, +50583, +505832, +5059
|
||||
T:_NIMF
|
||||
|
||||
N:Nicaragua
|
||||
C:+505
|
||||
T:NI
|
||||
|
@ -759,6 +791,10 @@ N:El Salvador
|
|||
C:+503
|
||||
T:SV
|
||||
|
||||
N:Guatemala Mobilfunk
|
||||
C:+50220
|
||||
T:_GTMF
|
||||
|
||||
N:Guatemala
|
||||
C:+502
|
||||
T:GT
|
||||
|
@ -990,7 +1026,7 @@ T:MK
|
|||
|
||||
N:Bosnien-Herzegowina
|
||||
E:Bosnia and Hercegovina
|
||||
A:Bosnien-Herzegovina
|
||||
A:Bosnien-Herzegovina, Bosnien
|
||||
C:+387
|
||||
T:BA
|
||||
|
||||
|
@ -1149,6 +1185,10 @@ C:+35191
|
|||
R:PT
|
||||
T:_MADE
|
||||
|
||||
N:Portugal Mobilfunk
|
||||
C:+35193
|
||||
T:_PTMF
|
||||
|
||||
N:Portugal
|
||||
C:+351
|
||||
T:PT
|
||||
|
@ -1298,6 +1338,10 @@ E:Netherlands
|
|||
C:+31
|
||||
T:NL
|
||||
|
||||
N:Griechenland Mobilfunk
|
||||
C:+309
|
||||
T:_GRMF
|
||||
|
||||
N:Griechenland
|
||||
E:Greece
|
||||
C:+30
|
||||
|
@ -1469,6 +1513,10 @@ N:Angola
|
|||
C:+244
|
||||
T:AO
|
||||
|
||||
N:Zaire Mobilfunk
|
||||
C:+24388
|
||||
T:_ZRMF
|
||||
|
||||
N:Zaire
|
||||
A:Kongo (Republik),Kongo (Rebublik)
|
||||
C:+243
|
||||
|
@ -1613,6 +1661,10 @@ A:Western Sahara # fixme
|
|||
C:+212
|
||||
T:EH # fixme
|
||||
|
||||
N:Ägypten Mobilfunk
|
||||
C:+2012
|
||||
T:_EGMF
|
||||
|
||||
N:Ägypten
|
||||
E:Egypt
|
||||
A:Agypten
|
||||
|
@ -1647,10 +1699,14 @@ E:Trinidad and Tobago
|
|||
C:+1868, +1809680, +180967, +180966, +180965, +180964, +180963, +180962, +1809619
|
||||
T:TT
|
||||
|
||||
N:Dominikanische Rep. Mobilfunk
|
||||
C:+18092, +1809227, +1809241, +1809474, +1809537, +1809540, +1809563, +1809683, +1809695
|
||||
T:_DOMF
|
||||
|
||||
N:Dominikanische Republik
|
||||
E:Dominican Republic
|
||||
A:Dominikanische Rep.
|
||||
C:+184, +1809971, +1809970, +1809908, +1809818, +1809814, +1809813, +1809810, +1809808, +1809807, +1809806, +1809710, +1809707, +1809701, +1809699, +1809698, +1809697, +1809696, +1809695, +1809694, +1809689, +1809688, +1809687, +1809686, +1809685, +1809684, +1809683, +1809682, +1809681, +1809616, +1809615, +1809612, +1809606, +1809604, +180959, +180958, +180957, +180956, +1809559, +1809558, +1809557, +1809556, +1809554, +1809553, +1809552, +1809551, +1809550, +180954, +180953, +180952, +1809519, +1809518, +1809512, +1809508, +1809506, +1809504, +1809481, +180947, +1809414, +1809412, +1809350, +1809343, +1809320, +1809310, +1809301, +1809299, +1809295, +1809293, +1809292, +1809291, +1809290, +1809282, +1809281, +1809280, +1809279, +1809278, +1809277, +1809276, +1809275, +1809274, +1809273, +1809248, +1809247, +1809246, +1809245, +1809244, +1809243, +1809242, +1809241, +1809240, +1809239, +1809238, +1809237, +1809236, +1809234, +1809233, +1809231, +1809227, +1809226, +1809225, +1809224, +1809223, +1809222, +1809221, +1809220, +1809209, +1809208, +1809204, +1809188
|
||||
C:+184, +1809971, +1809970, +1809908, +1809818, +1809814, +1809813, +1809810, +1809808, +1809807, +1809806, +1809710, +1809707, +1809701, +1809699, +1809698, +1809697, +1809696, +1809694, +1809689, +1809688, +1809687, +1809686, +1809685, +1809684, +1809682, +1809681, +1809616, +1809615, +1809612, +1809606, +1809604, +180959, +180958, +180957, +180956, +1809559, +1809558, +1809557, +1809556, +1809554, +1809553, +1809552, +1809551, +1809550, +180954, +180953, +180952, +1809519, +1809518, +1809512, +1809508, +1809506, +1809504, +1809481, +180947, +1809414, +1809412, +1809350, +1809343, +1809320, +1809310, +1809301, +1809299, +1809295, +1809293, +1809292, +1809291, +1809290, +1809282, +1809281, +1809280, +1809279, +1809278, +1809277, +1809276, +1809275, +1809274, +1809273, +1809248, +1809247, +1809246, +1809245, +1809244, +1809243, +1809242, +1809240, +1809239, +1809238, +1809237, +1809236, +1809234, +1809233, +1809231, +1809226, +1809225, +1809224, +1809223, +1809222, +1809221, +1809220, +1809209, +1809208, +1809204, +1809188
|
||||
T:DO
|
||||
|
||||
N:Turks- und Caicosinseln
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: isdnconf.c,v 1.39 1999/10/22 19:57:59 akool Exp $
|
||||
/* $Id: isdnconf.c,v 1.40 1999/10/25 18:33:15 akool Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux. (Report-module)
|
||||
*
|
||||
|
@ -20,6 +20,11 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: isdnconf.c,v $
|
||||
* Revision 1.40 1999/10/25 18:33:15 akool
|
||||
* isdnlog-3.57
|
||||
* WARNING: Experimental version!
|
||||
* Please use isdnlog-3.56 for production systems!
|
||||
*
|
||||
* Revision 1.39 1999/10/22 19:57:59 akool
|
||||
* isdnlog-3.56 (for Karsten)
|
||||
*
|
||||
|
@ -561,24 +566,27 @@ int look_data(section **conf_dat)
|
|||
_number = _alias = NULL;
|
||||
_si[0] = '\0';
|
||||
|
||||
if ((CEPtr = Get_Entry((*conf_dat)->entries,CONF_ENT_NUM)) != NULL)
|
||||
if ((CEPtr = Get_Entry((*conf_dat)->entries,CONF_ENT_NUM)) != NULL) {
|
||||
if (del)
|
||||
_number = strdup(Replace_Variable(CEPtr->value));
|
||||
else
|
||||
_number = strdup(CEPtr->value);
|
||||
}
|
||||
|
||||
if ((CEPtr = Get_Entry((*conf_dat)->entries,CONF_ENT_ALIAS)) != NULL)
|
||||
if ((CEPtr = Get_Entry((*conf_dat)->entries,CONF_ENT_ALIAS)) != NULL) {
|
||||
if (del)
|
||||
_alias = strdup(Replace_Variable(CEPtr->value));
|
||||
else
|
||||
_alias = strdup(CEPtr->value);
|
||||
}
|
||||
|
||||
if ((CEPtr = Get_Entry((*conf_dat)->entries,CONF_ENT_SI)) != NULL &&
|
||||
CEPtr->value != NULL)
|
||||
if ((CEPtr = Get_Entry((*conf_dat)->entries,CONF_ENT_SI)) != NULL &&
|
||||
CEPtr->value != NULL) {
|
||||
if (del)
|
||||
sprintf(_si,"%ld",strtol(Replace_Variable(CEPtr->value), NIL, 0));
|
||||
else
|
||||
sprintf(_si,"%ld",strtol(CEPtr->value, NIL, 0));
|
||||
}
|
||||
|
||||
if (and)
|
||||
Ret = 1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: isdnlog.c,v 1.50 1999/09/26 10:55:20 akool Exp $
|
||||
/* $Id: isdnlog.c,v 1.51 1999/10/25 18:33:15 akool Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux. (log-module)
|
||||
*
|
||||
|
@ -19,6 +19,11 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
*
|
||||
* $Log: isdnlog.c,v $
|
||||
* Revision 1.51 1999/10/25 18:33:15 akool
|
||||
* isdnlog-3.57
|
||||
* WARNING: Experimental version!
|
||||
* Please use isdnlog-3.56 for production systems!
|
||||
*
|
||||
* Revision 1.50 1999/09/26 10:55:20 akool
|
||||
* isdnlog-3.55
|
||||
* - Patch from Oliver Lauer <Oliver.Lauer@coburg.baynet.de>
|
||||
|
@ -354,7 +359,11 @@
|
|||
#include <termios.h>
|
||||
|
||||
#include "isdnlog.h"
|
||||
#ifdef USE_DESTINATION
|
||||
#include "dest.h"
|
||||
#else
|
||||
#include "telnum.h"
|
||||
#endif
|
||||
#ifdef POSTGRES
|
||||
#include "postgres.h"
|
||||
#endif
|
||||
|
@ -638,15 +647,17 @@ static void init_variables(int argc, char* argv[])
|
|||
#ifdef Q931
|
||||
q931dmp = 0;
|
||||
#endif
|
||||
#if 0 /* Fixme: remove */
|
||||
CityWeekend = 0;
|
||||
#endif
|
||||
|
||||
sprintf(mlabel, "%%s%s %%s%%s", "%e.%b %T %I");
|
||||
amtsholung = NULL;
|
||||
dual = 0;
|
||||
|
||||
#if 0 /* Fixme: german specific there are conf entries VBN & PRESELECTED */
|
||||
preselect = DTAG; /* Telekomik */
|
||||
vbn = strdup("010"); /* Germany */
|
||||
|
||||
#endif
|
||||
hup3 = 240;
|
||||
|
||||
myname = argv[0];
|
||||
|
@ -793,9 +804,10 @@ int set_options(int argc, char* argv[])
|
|||
case 'q' : traceoptions();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if 0 /* Fixme: remove */
|
||||
case 'F' : CityWeekend++;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 'A' : amtsholung = strdup(optarg);
|
||||
break;
|
||||
|
@ -1031,9 +1043,11 @@ static int read_param_file(char *FileName)
|
|||
if (!strcmp(Ptr->name,CONF_ENT_OTHER))
|
||||
other = toupper(*(Ptr->value)) == 'Y'?1:0;
|
||||
else
|
||||
#if 0 /* Fixme: remove */
|
||||
if (!strcmp(Ptr->name,CONF_ENT_CW))
|
||||
CityWeekend++;
|
||||
else
|
||||
#endif
|
||||
if (!strcmp(Ptr->name,CONF_ENT_IGNORERR))
|
||||
ignoreRR = (int)strtol(Ptr->value, NIL, 0);
|
||||
else
|
||||
|
@ -1044,6 +1058,11 @@ static int read_param_file(char *FileName)
|
|||
free(vbn);
|
||||
vbn = strdup(Ptr->value);
|
||||
}
|
||||
else
|
||||
if (!strcmp(Ptr->name,CONF_ENT_VBNLEN)) {
|
||||
free(vbnlen);
|
||||
vbnlen = strdup(Ptr->value);
|
||||
}
|
||||
else
|
||||
print_msg(PRT_ERR,"Error: Invalid entry `%s'!\n",Ptr->name);
|
||||
|
||||
|
@ -1386,7 +1405,11 @@ int main(int argc, char *argv[], char *envp[])
|
|||
if (!Q931dmp && *version)
|
||||
print_msg(PRT_NORMAL, "%s\n", version);
|
||||
|
||||
#ifdef USE_DESTINATION
|
||||
initDest(destfile, &version);
|
||||
#else
|
||||
initCountry(countryfile, &version);
|
||||
#endif
|
||||
|
||||
if (!Q931dmp && *version)
|
||||
print_msg(PRT_NORMAL, "%s\n", version);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: server.c,v 1.5 1999/03/20 14:33:15 akool Exp $
|
||||
/* $Id: server.c,v 1.6 1999/10/25 18:33:15 akool Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux.
|
||||
*
|
||||
|
@ -20,6 +20,11 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: server.c,v $
|
||||
* Revision 1.6 1999/10/25 18:33:15 akool
|
||||
* isdnlog-3.57
|
||||
* WARNING: Experimental version!
|
||||
* Please use isdnlog-3.56 for production systems!
|
||||
*
|
||||
* Revision 1.5 1999/03/20 14:33:15 akool
|
||||
* - isdnlog Version 3.08
|
||||
* - more tesion)) Tarife from Michael Graw <Michael.Graw@bartlmae.de>
|
||||
|
@ -220,7 +225,7 @@ int new_client(int sock)
|
|||
}
|
||||
}
|
||||
|
||||
if (Old_Prints != NULL && User_Get_Message(sockets[sock].f_username,sockets[sock].f_hostname,NULL,T_PROTOCOL) == 0)
|
||||
if (Old_Prints != NULL && User_Get_Message(sockets[sock].f_username,sockets[sock].f_hostname,NULL,T_PROTOCOL) == 0) {
|
||||
for (Cnt = 0; Cnt < xlog; Cnt++)
|
||||
if (Old_Prints[Cnt] != NULL)
|
||||
{
|
||||
|
@ -235,7 +240,7 @@ int new_client(int sock)
|
|||
}
|
||||
else
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: start_prog.c,v 1.13 1998/11/21 14:03:39 luethje Exp $
|
||||
/* $Id: start_prog.c,v 1.14 1999/10/25 18:33:15 akool Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux.
|
||||
*
|
||||
|
@ -20,6 +20,11 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: start_prog.c,v $
|
||||
* Revision 1.14 1999/10/25 18:33:15 akool
|
||||
* isdnlog-3.57
|
||||
* WARNING: Experimental version!
|
||||
* Please use isdnlog-3.56 for production systems!
|
||||
*
|
||||
* Revision 1.13 1998/11/21 14:03:39 luethje
|
||||
* isdnctrl: added dialmode into the config file
|
||||
*
|
||||
|
@ -712,13 +717,13 @@ int Print_Cmd_Output( int sock )
|
|||
|
||||
int Get_Sock_From_Info_Args( info_args *Ptr, int Cnt )
|
||||
{
|
||||
if (socket_size(sockets) > Cnt || Cnt < 0)
|
||||
if (socket_size(sockets) > Cnt || Cnt < 0) {
|
||||
while (sockets[Cnt].descriptor != -2)
|
||||
if (sockets[Cnt].info_arg == Ptr)
|
||||
return Cnt;
|
||||
else
|
||||
Cnt++;
|
||||
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -726,13 +731,13 @@ int Get_Sock_From_Info_Args( info_args *Ptr, int Cnt )
|
|||
|
||||
int Get_Sock_From_Call( int chan, int Cnt )
|
||||
{
|
||||
if (socket_size(sockets) > Cnt || Cnt < 0)
|
||||
if (socket_size(sockets) > Cnt || Cnt < 0) {
|
||||
while (sockets[Cnt].descriptor != -2)
|
||||
if (sockets[Cnt].chan == chan)
|
||||
return Cnt;
|
||||
else
|
||||
Cnt++;
|
||||
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -740,13 +745,13 @@ int Get_Sock_From_Call( int chan, int Cnt )
|
|||
|
||||
int Get_Sock_From_Call_And_Info_Args( int chan, info_args *Ptr, int Cnt )
|
||||
{
|
||||
if (socket_size(sockets) > Cnt || Cnt < 0)
|
||||
if (socket_size(sockets) > Cnt || Cnt < 0) {
|
||||
while (sockets[Cnt].descriptor != -2)
|
||||
if (sockets[Cnt].chan == chan && sockets[Cnt].info_arg == Ptr)
|
||||
return Cnt;
|
||||
else
|
||||
Cnt++;
|
||||
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1079,12 +1084,13 @@ int Start_Ring(int chan, info_args *infoarg, int event, int intervalflag)
|
|||
|
||||
if (intervalflag & RING_INTERVAL)
|
||||
{
|
||||
if (f & RING_KILL)
|
||||
if (f & RING_KILL) {
|
||||
while ((sock = Get_Sock_From_Call_And_Info_Args(chan,infoarg,sock)) != -1)
|
||||
if (sockets[sock].call_event == event)
|
||||
Ring(NULL, NULL, sock++, 0);
|
||||
else
|
||||
sock++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: user_access.c,v 1.2 1997/04/03 22:34:52 luethje Exp $
|
||||
/* $Id: user_access.c,v 1.3 1999/10/25 18:33:15 akool Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux.
|
||||
*
|
||||
|
@ -19,6 +19,11 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: user_access.c,v $
|
||||
* Revision 1.3 1999/10/25 18:33:15 akool
|
||||
* isdnlog-3.57
|
||||
* WARNING: Experimental version!
|
||||
* Please use isdnlog-3.56 for production systems!
|
||||
*
|
||||
* Revision 1.2 1997/04/03 22:34:52 luethje
|
||||
* splitt the files callerid.conf and ~/.isdn.
|
||||
*
|
||||
|
@ -133,13 +138,13 @@ int read_user_access( void )
|
|||
/* Erster Durchlauf von read_user_access() */
|
||||
if (ModTime == -2)
|
||||
{
|
||||
if (stat(userfile(),&FileStat) != 0 && errno == ENOENT)
|
||||
if (stat(userfile(),&FileStat) != 0 && errno == ENOENT) {
|
||||
if ((RetCode = create_new_file()) == 0)
|
||||
stat(userfile(),&FileStat);
|
||||
else
|
||||
/* Return, weil keine Date existiert und nicht angelegt werden kann */
|
||||
return RetCode;
|
||||
|
||||
}
|
||||
ModTime = FileStat.st_mtime;
|
||||
}
|
||||
else
|
||||
|
@ -546,7 +551,7 @@ static int _Set_Entry (char* Name, char* User, char *Host, char *Flags)
|
|||
print_msg(PRT_WARN,"Warning: User \"%s\" has no Flags!\n",User);
|
||||
}
|
||||
|
||||
if (*Host != '\0')
|
||||
if (*Host != '\0') {
|
||||
if ((NewHost = GetHostByName(Host)) != NULL)
|
||||
{
|
||||
Ptr = &((*Cursor)->hosts);
|
||||
|
@ -564,6 +569,7 @@ static int _Set_Entry (char* Name, char* User, char *Host, char *Flags)
|
|||
}
|
||||
else
|
||||
print_msg(PRT_WARN,"Warning: unknown host \"%s\"!\n",Host);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: isdnrep.c,v 1.79 1999/09/13 09:09:43 akool Exp $
|
||||
/* $Id: isdnrep.c,v 1.80 1999/10/25 18:33:16 akool Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux. (Report-module)
|
||||
*
|
||||
|
@ -24,6 +24,11 @@
|
|||
*
|
||||
*
|
||||
* $Log: isdnrep.c,v $
|
||||
* Revision 1.80 1999/10/25 18:33:16 akool
|
||||
* isdnlog-3.57
|
||||
* WARNING: Experimental version!
|
||||
* Please use isdnlog-3.56 for production systems!
|
||||
*
|
||||
* Revision 1.79 1999/09/13 09:09:43 akool
|
||||
* isdnlog-3.51
|
||||
* - changed getProvider() to not return NULL on unknown providers
|
||||
|
@ -596,7 +601,12 @@
|
|||
#include "isdnrep.h"
|
||||
#include "../../vbox/src/libvbox.h"
|
||||
#include "libisdn.h"
|
||||
#ifdef USE_DESTINATION
|
||||
#include "dest.h"
|
||||
#else
|
||||
#include "telnum.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define END_TIME 1
|
||||
|
@ -783,6 +793,7 @@ static int unknowns = 0;
|
|||
static UNKNOWNS unknown[MAXUNKNOWN];
|
||||
static int zones[MAXZONES + 1];
|
||||
static int zones_usage[MAXZONES + 1];
|
||||
static char * zones_names[MAXZONES + 1];
|
||||
static double zones_dm[MAXZONES + 1];
|
||||
static double zones_dur[MAXZONES + 1];
|
||||
static char** ShowMSN = NULL;
|
||||
|
@ -963,14 +974,16 @@ int read_logfile(char *myname)
|
|||
one_call cur_call;
|
||||
|
||||
|
||||
/* FIXME: */
|
||||
initHoliday(holifile, NULL);
|
||||
#ifdef USE_DESTINATION
|
||||
initDest(destfile, NULL);
|
||||
#else
|
||||
initCountry(countryfile, NULL);
|
||||
#endif
|
||||
initRate(rateconf, ratefile, zonefile, NULL);
|
||||
initTelNum();
|
||||
currency = strdup("DM");
|
||||
vbn = strdup("010");
|
||||
interns0 = 3;
|
||||
|
||||
interns0 = 3; /* Fixme: */
|
||||
|
||||
msn_sum = calloc(mymsns + 1, sizeof(double));
|
||||
usage_sum = calloc(mymsns + 1, sizeof(int));
|
||||
|
@ -1073,11 +1086,12 @@ int read_logfile(char *myname)
|
|||
|
||||
if (timearea)
|
||||
{
|
||||
if (delentries)
|
||||
if (delentries) {
|
||||
if (cur_call.t > endtime)
|
||||
fputs(string,ftmp);
|
||||
else
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!verbose && cur_call.duration == 0)
|
||||
|
@ -1278,29 +1292,20 @@ static int print_bottom(double unit, char *start, char *stop)
|
|||
|
||||
if (!incomingonly)
|
||||
{
|
||||
#if 1
|
||||
h_percent = 60.0;
|
||||
h_table_color = H_TABLE_COLOR3;
|
||||
get_format("%-21.21s %4d call(s) %10.10s %12s");
|
||||
print_line2(F_BODY_HEADER,"");
|
||||
/* Fixme: zones are provider-specific
|
||||
we are summing up zones for all provides here */
|
||||
print_line2(F_BODY_HEADERL,"Outgoing calls ordered by Zone");
|
||||
strich(1);
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
for (i = 0; i < MAXZONES + 1; i++)
|
||||
if (zones_usage[i]) {
|
||||
register char *p;
|
||||
auto char s[BUFSIZ];
|
||||
|
||||
|
||||
switch (i) {
|
||||
case 0 : p = "Internal-/FreeCall"; break;
|
||||
case 1 : p = "Ortszone"; break;
|
||||
case 2 : p = "CityCall (< 20 km)"; break;
|
||||
case 3 : p = "RegioCall (< 50 km)"; break;
|
||||
case 4 : p = "GermanCall"; break;
|
||||
} /* case */
|
||||
|
||||
sprintf(s, "%1d:%s", i, p);
|
||||
sprintf(s, "Zone %3d:%s", i, zones_names[i]);
|
||||
|
||||
print_line3(NULL, s, zones_usage[i],
|
||||
double2clock(zones_dur[i]),
|
||||
|
@ -1313,7 +1318,6 @@ static int print_bottom(double unit, char *start, char *stop)
|
|||
#endif
|
||||
|
||||
print_line2(F_BODY_BOTTOM2,"");
|
||||
#endif
|
||||
|
||||
h_percent = 60.0;
|
||||
h_table_color = H_TABLE_COLOR4;
|
||||
|
@ -1323,19 +1327,18 @@ static int print_bottom(double unit, char *start, char *stop)
|
|||
strich(1);
|
||||
|
||||
for (i = 1; i < MAXPROVIDER; i++) {
|
||||
if (i < 100)
|
||||
sprintf(string, "%s%02d ", vbn, i);
|
||||
else
|
||||
sprintf(string, "%s%03d", vbn, i - 100);
|
||||
|
||||
prefix2provider(i, string);
|
||||
if (usage_provider[i]) {
|
||||
if (duration_provider[i])
|
||||
sprintf(sx, "%5.1f%% avail.",
|
||||
100.0 * (usage_provider[i] - provider_failed[i]) / usage_provider[i]);
|
||||
else
|
||||
*sx = 0;
|
||||
p = getProvider(i);
|
||||
if (!p || p[strlen(p) - 1] == '?') /* UNKNOWN Provider */
|
||||
p = "UNKNOWN";
|
||||
|
||||
print_line3(NULL, "Provider", string, getProvider(i),
|
||||
print_line3(NULL, "Provider", string, p,
|
||||
usage_provider[i],
|
||||
double2clock(duration_provider[i]),
|
||||
print_currency(pay_provider[i], 0), sx);
|
||||
|
@ -1386,50 +1389,10 @@ static int print_bottom(double unit, char *start, char *stop)
|
|||
if ((unknown[i].cause != 1) && /* Unallocated (unassigned) number */
|
||||
(unknown[i].cause != 3) && /* No route to destination */
|
||||
(unknown[i].cause != 28)) { /* Invalid number format (address incomplete) */
|
||||
#if 0 /* DELETE_ME AK:18-Aug-99 */
|
||||
auto char *p;
|
||||
auto int l;
|
||||
register int flag = C_NO_WARN | C_NO_EXPAND;
|
||||
auto int prefix = strlen(countryprefix);
|
||||
auto char areacode[64], vorwahl[64], rufnummer[64], iam[64];
|
||||
#endif
|
||||
|
||||
print_msg(PRT_NORMAL,"%s ", unknown[i].called ? "Called by" : " Calling");
|
||||
|
||||
#if 0 /* FIXME */
|
||||
if (is_sondernummer(unknown[i].num, DTAG) > 0) /* Fixme: DTAG is specific to Germany */
|
||||
;
|
||||
else
|
||||
#endif
|
||||
#if 0 /* DELETE_ME AK:18-Aug-99 */
|
||||
if ((p = get_areacode(unknown[i].num, &l, flag)) != 0) {
|
||||
if (l > 1) {
|
||||
/* Sehr gefaehrlich, was ist mit Laendern, die einen dreistelligen Code haben??? */
|
||||
Strncpy(areacode, unknown[i].num, 3 + prefix);
|
||||
if ((l - (2 + prefix)) > 0) {
|
||||
Strncpy(vorwahl, unknown[i].num + 2 + prefix, l - (2 + prefix) + 1);
|
||||
vorwahl[l - (2 + prefix)] = 0;
|
||||
}
|
||||
else
|
||||
*vorwahl = 0;
|
||||
strcpy(rufnummer, unknown[i].num + l);
|
||||
|
||||
strcpy(iam, num2nam(unknown[i].mynum, unknown[i].si1));
|
||||
|
||||
print_msg(PRT_NORMAL,"%s %s/%s, %s %s %s (%s %s %s,%d):%s\n\t\t\t ",
|
||||
areacode, vorwahl, rufnummer, p, (unknown[i].called ? "on" : "with"),
|
||||
iam, unknown[i].num, (unknown[i].called ? "->" : "<-"),
|
||||
unknown[i].mynum, unknown[i].si1, qmsg(TYPE_CAUSE, VERSION_EDSS1, unknown[i].cause));
|
||||
}
|
||||
else
|
||||
print_msg(PRT_NORMAL,"??? %s\n\t\t\t ", unknown[i].num);
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
print_msg(PRT_NORMAL,"??? %s\n\t\t\t ", unknown[i].num);
|
||||
#if 0 /* DELETE_ME AK:18-Aug-99 */
|
||||
}
|
||||
#endif
|
||||
print_msg(PRT_NORMAL,"??? %s\n\t\t\t ", unknown[i].num);
|
||||
} /* if */
|
||||
#endif
|
||||
for (k = 0; k < unknown[i].connects; k++) {
|
||||
|
@ -1557,9 +1520,6 @@ static int print_line2(int status, const char *fmt, ...)
|
|||
static int print_line(int status, one_call *cur_call, int computed, char *overlap)
|
||||
{
|
||||
char *string = NULL;
|
||||
#if 0 /* DELETE_ME AK:18-Aug-99 */
|
||||
char *Ptr;
|
||||
#endif
|
||||
char help[32];
|
||||
prt_fmt **fmtstring = get_format(NULL);
|
||||
int dir;
|
||||
|
@ -1690,14 +1650,7 @@ static int print_line(int status, one_call *cur_call, int computed, char *overla
|
|||
case 'L': if (status == F_BODY_LINE)
|
||||
{
|
||||
dir = cur_call->dir?CALLED:CALLING;
|
||||
#if 0 /* DELETE_ME AK:18-Aug-99 */
|
||||
if (cur_call->num[dir][0] != C_UNKNOWN &&
|
||||
cur_call->num[dir][0] != '\0' &&
|
||||
(Ptr = get_areacode(cur_call->num[dir],NULL,C_NO_WARN | C_NO_ERROR)) != NULL)
|
||||
colsize[i] = append_string(&string,*fmtstring, Ptr);
|
||||
else
|
||||
#endif
|
||||
colsize[i] = append_string(&string,*fmtstring, "");
|
||||
colsize[i] = append_string(&string,*fmtstring, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1711,14 +1664,7 @@ static int print_line(int status, one_call *cur_call, int computed, char *overla
|
|||
case 'l': if (status == F_BODY_LINE)
|
||||
{
|
||||
dir = cur_call->dir?CALLING:CALLED;
|
||||
#if 0 /* DELETE_ME AK:18-Aug-99 */
|
||||
if (cur_call->num[dir][0] != C_UNKNOWN &&
|
||||
cur_call->num[dir][0] != '\0' &&
|
||||
(Ptr = get_areacode(cur_call->num[dir],NULL,C_NO_WARN | C_NO_ERROR)) != NULL)
|
||||
colsize[i] = append_string(&string,*fmtstring, Ptr);
|
||||
else
|
||||
#endif
|
||||
colsize[i] = append_string(&string,*fmtstring, "");
|
||||
colsize[i] = append_string(&string,*fmtstring, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1803,10 +1749,9 @@ static int print_line(int status, one_call *cur_call, int computed, char *overla
|
|||
{
|
||||
register char *p;
|
||||
|
||||
p = (cur_call->provider > 0) ? getProvider(cur_call->provider) : "";
|
||||
|
||||
if ((cur_call->dir == DIALOUT) && (cur_call->provider > 0))
|
||||
p = getProvider(cur_call->provider);
|
||||
else
|
||||
if (cur_call->dir == DIALIN)
|
||||
p = "";
|
||||
|
||||
colsize[i] = append_string(&string,*fmtstring, p);
|
||||
|
@ -1905,15 +1850,10 @@ static void bprint(one_call *call)
|
|||
auto char target[BUFSIZ], s[BUFSIZ];
|
||||
auto TELNUM number;
|
||||
|
||||
|
||||
if (call->duration) {
|
||||
if (*p == '+') {
|
||||
if (!memcmp(call->num[CALLED], mycountry, strlen(mycountry))) { /* eigenes Land */
|
||||
p += strlen(mycountry);
|
||||
sprintf(target, "0%s", p);
|
||||
}
|
||||
else
|
||||
sprintf(target, "00%s", p + 1);
|
||||
if (!memcmp(call->num[CALLED], mycountry, strlen(mycountry))) { /* eigenes Land */
|
||||
p += strlen(mycountry);
|
||||
sprintf(target, "0%s", p);
|
||||
}
|
||||
else
|
||||
sprintf(target, "%s", p);
|
||||
|
@ -1929,12 +1869,8 @@ static void bprint(one_call *call)
|
|||
|
||||
strcpy(s, call->num[CALLED]);
|
||||
|
||||
if (!memcmp(s, "+491", 4)) {
|
||||
sprintf(s, "0%s", call->num[CALLED] + 3);
|
||||
// print_msg(PRT_NORMAL, "\nREPAIR: %s -> %s\n", call->num[CALLED], s);
|
||||
} /* if */
|
||||
|
||||
normalizeNumber(s, &number, TN_ALL);
|
||||
number.nprovider=call->provider;
|
||||
normalizeNumber(s, &number, TN_NO_PROVIDER);
|
||||
print_msg(PRT_NORMAL, "%s\n", formatNumber("%A", &number));
|
||||
}
|
||||
else
|
||||
|
@ -2629,58 +2565,51 @@ static int set_alias(one_call *cur_call, int *nx, char *myname)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if 0 /* FIXME */
|
||||
static void repair(one_call *cur_call)
|
||||
{
|
||||
#if 0 /* FIXME */
|
||||
auto char why[BUFSIZ], hint[BUFSIZ];
|
||||
#endif
|
||||
|
||||
|
||||
#if 0 /* FIXME */
|
||||
if (cur_call->provider == DTAG) /* Fixme: DTAG is specific to Germany */
|
||||
return;
|
||||
#endif
|
||||
RATE Rate;
|
||||
TELNUM srcnum, destnum;
|
||||
|
||||
call[0].connect = cur_call->t;
|
||||
call[0].disconnect = cur_call->t + cur_call->duration;
|
||||
call[0].intern[CALLED] = strlen(cur_call->num[CALLED]) < interns0;
|
||||
call[0].provider = cur_call->provider;
|
||||
call[0].sondernummer[CALLED] = is_sondernummer(cur_call->num[CALLED], DTAG); /* Fixme: DTAG is specific to Germany */
|
||||
call[0].aoce = cur_call->eh;
|
||||
call[0].dialin = 0;
|
||||
strcpy(call[0].num[CALLED], cur_call->num[CALLED]);
|
||||
strcpy(call[0].onum[CALLED], cur_call->num[CALLED]);
|
||||
|
||||
#if 0 /* Fixme: use RATE */
|
||||
preparecint(0, why, hint, 1);
|
||||
#endif
|
||||
normalizeNumber("4321",&srcnum,TN_ALL); /* this is a local number */
|
||||
destnum.nprovider = cur_call->provider;
|
||||
Strncpy(destnum.provider,getProvider(cur_call->provider),TN_MAX_PROVIDER_LEN);
|
||||
normalizeNumber(cur_call->num[CALLED], &destnum, TN_NO_PROVIDER);
|
||||
call[0].sondernummer[CALLED] = destnum.ncountry==0;
|
||||
|
||||
if (call[0].zone == UNKNOWN) {
|
||||
#if DEBUG
|
||||
print_msg(PRT_NORMAL, "Ooops: GlobalCall %s -- assuming \"Welt 4\"",
|
||||
cur_call->num[CALLED]);
|
||||
#endif
|
||||
call[0].zone = WELT_4;
|
||||
} /* if */
|
||||
|
||||
#if 0 /* Fixme: use RATE */
|
||||
price(0, why, 1);
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
if (fabs(cur_call->pay - call[0].pay) > 0.01)
|
||||
print_msg(PRT_NORMAL, "\ncur_call->pay=%f, call[0].pay=%f, diff=%f\n",
|
||||
cur_call->pay, call[0].pay, cur_call->pay - call[0].pay);
|
||||
#endif
|
||||
|
||||
if (call[0].pay < 0.0) /* dirty, but ... */
|
||||
call[0].pay = 0.0;
|
||||
|
||||
cur_call->pay = call[0].pay;
|
||||
cur_call->zone = call[0].zone;
|
||||
clearRate(&Rate);
|
||||
#ifdef USE_DESTINATION
|
||||
Rate.src[0] = srcnum.country;
|
||||
#else
|
||||
Rate.src[0] = srcnum.country ? srcnum.country->Code[0] : "";
|
||||
#endif
|
||||
Rate.src[1] = srcnum.area;
|
||||
Rate.src[2] = "";
|
||||
#ifdef USE_DESTINATION
|
||||
Rate.dst[0] = destnum.country;
|
||||
#else
|
||||
Rate.dst[0] = destnum.country ? destnum.country->Code[0] : "";
|
||||
#endif
|
||||
Rate.dst[1] = destnum.area;
|
||||
Rate.dst[2] = destnum.msn;
|
||||
Rate.start = cur_call->t;
|
||||
Rate.now = call[0].disconnect;
|
||||
Rate.prefix = cur_call->provider;
|
||||
if (!getRate(&Rate,0)) {
|
||||
if(strcmp(cur_call->version, LOG_VERSION))
|
||||
cur_call->pay = Rate.Charge; /* Fixme: is that ok, propably rates have changed */
|
||||
cur_call->zone = Rate._zone;
|
||||
zones_names[Rate._zone] = Rate.Zone ? strdup(Rate.Zone) : strdup("??");
|
||||
}
|
||||
} /* repair */
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
@ -2823,13 +2752,11 @@ static int set_caller_infos(one_call *cur_call, char *string, time_t from)
|
|||
|
||||
}
|
||||
|
||||
#if 0 /* FIXME */
|
||||
if ((cur_call->dir == DIALOUT) &&
|
||||
(cur_call->duration > 0) &&
|
||||
*cur_call->num[1] &&
|
||||
strcmp(cur_call->version, LOG_VERSION))
|
||||
*cur_call->num[1]
|
||||
)
|
||||
repair(cur_call);
|
||||
#endif
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
@ -3003,35 +2930,38 @@ static time_t get_time(char *String, int TimeStatus)
|
|||
&(TimeStruct->tm_mday),
|
||||
&(TimeStruct->tm_hour),
|
||||
&(TimeStruct->tm_min),
|
||||
&Year ) > 4)
|
||||
&Year ) > 4) {
|
||||
/* if (Year > 99) */
|
||||
if (Year >= 1900)
|
||||
TimeStruct->tm_year = ((Year / 100) - 19) * 100 + (Year%100);
|
||||
else
|
||||
else {
|
||||
if (Year < 70)
|
||||
TimeStruct->tm_year = Year + 100;
|
||||
else
|
||||
TimeStruct->tm_year = Year;
|
||||
|
||||
}
|
||||
}
|
||||
TimeStruct->tm_mon--;
|
||||
break;
|
||||
}
|
||||
|
||||
if (TimeStatus == END_TIME)
|
||||
if (TimeStatus == END_TIME) {
|
||||
if (TimeStruct->tm_sec == 0 &&
|
||||
TimeStruct->tm_min == 0 &&
|
||||
TimeStruct->tm_hour== 0 )
|
||||
TimeStruct->tm_mday++;
|
||||
else
|
||||
if (TimeStruct->tm_sec == 0 &&
|
||||
else {
|
||||
if (TimeStruct->tm_sec == 0 &&
|
||||
TimeStruct->tm_min == 0 )
|
||||
TimeStruct->tm_hour++;
|
||||
else
|
||||
if (TimeStruct->tm_sec == 0 )
|
||||
TimeStruct->tm_min++;
|
||||
else
|
||||
TimeStruct->tm_sec++;
|
||||
|
||||
TimeStruct->tm_hour++;
|
||||
else {
|
||||
if (TimeStruct->tm_sec == 0 )
|
||||
TimeStruct->tm_min++;
|
||||
else
|
||||
TimeStruct->tm_sec++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mktime(TimeStruct);
|
||||
}
|
||||
|
||||
|
@ -3183,10 +3113,6 @@ static int add_one_call(sum_calls *s1, one_call *s2, double units)
|
|||
|
||||
s1->ibytes += s2->ibytes;
|
||||
s1->obytes += s2->obytes;
|
||||
#ifdef ISDN_NL /* Fixme: never defined! */
|
||||
s1->pay += 0.0825; /* add call setup charge */
|
||||
s2->pay += 0.0825;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
9781
isdnlog/rate-de.dat
9781
isdnlog/rate-de.dat
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,39 @@
|
|||
# exapmle of /etc/isdn/isdn.conf
|
||||
# copy this file to /etc/isdn/isdn.conf and edit
|
||||
#
|
||||
# More information: /usr/doc/packages/i4l/isdnlog/README
|
||||
|
||||
|
||||
[GLOBAL]
|
||||
COUNTRYPREFIX = +
|
||||
COUNTRYCODE = 43
|
||||
AREAPREFIX = 0
|
||||
|
||||
# EDIT THIS LINE:
|
||||
AREACODE = 02555
|
||||
|
||||
[VARIABLES]
|
||||
|
||||
[ISDNLOG]
|
||||
LOGFILE = /var/log/isdn.log
|
||||
ILABEL = %b %e %T %ICall to tei %t from %N2 on %n2
|
||||
OLABEL = %b %e %T %Itei %t calling %N2 with '%n0'
|
||||
REPFMTWWW = "%X %D %17.17H %T %-17.17F %-20.20l SI: %S %9u %U %I %O"
|
||||
REPFMTSHORT = "%X%D %8.8H %T %-14.14F%U%I %O"
|
||||
REPFMT = " %X %D %15.15H %T %-15.15F %7u %U %I %O"
|
||||
CHARGEMAX = 50.00
|
||||
CURRENCY = 1.056,ATS
|
||||
|
||||
COUNTRYFILE = /usr/lib/isdn/country.dat
|
||||
#COUNTRYFILE = /usr/lib/isdn/country-de.dat
|
||||
RATECONF= /etc/isdn/rate.conf
|
||||
#RATEFILE= /usr/lib/isdn/rate-at.dat
|
||||
RATEFILE= /usr/lib/isdn/r.dat
|
||||
HOLIDAYS= /usr/lib/isdn/holiday-at.dat
|
||||
ZONEFILE= /usr/lib/isdn/zone-at-%s.gdbm
|
||||
DESTFILE= /usr/lib/isdn/dest.gdbm
|
||||
|
||||
# providerselect
|
||||
VBN = 10
|
||||
VBNLEN = 2
|
||||
PRESELECTED=1
|
|
@ -0,0 +1,37 @@
|
|||
# exapmle of /etc/isdn/isdn.conf
|
||||
# copy this file to /etc/isdn/isdn.conf and edit
|
||||
#
|
||||
# More information: /usr/doc/packages/i4l/isdnlog/README
|
||||
|
||||
|
||||
[GLOBAL]
|
||||
COUNTRYPREFIX = +
|
||||
COUNTRYCODE = 49
|
||||
AREAPREFIX = 0
|
||||
|
||||
# EDIT THIS LINE:
|
||||
AREACODE = 030
|
||||
|
||||
[VARIABLES]
|
||||
|
||||
[ISDNLOG]
|
||||
LOGFILE = /var/log/isdn.log
|
||||
ILABEL = %b %e %T %ICall to tei %t from %N2 on %n2
|
||||
OLABEL = %b %e %T %Itei %t calling %N2 with %n2
|
||||
REPFMTWWW = "%X %D %17.17H %T %-17.17F %-20.20l SI: %S %9u %U %I %O"
|
||||
REPFMTSHORT = "%X%D %8.8H %T %-14.14F%U%I %O"
|
||||
REPFMT = " %X %D %15.15H %T %-15.15F %7u %U %I %O"
|
||||
CHARGEMAX = 50.00
|
||||
CURRENCY = 1.056,DEM
|
||||
|
||||
COUNTRYFILE = /usr/lib/isdn/country-de.dat
|
||||
RATECONF= /etc/isdn/rate.conf
|
||||
RATEFILE= /usr/lib/isdn/rate-de.dat
|
||||
HOLIDAYS= /usr/lib/isdn/holiday-de.dat
|
||||
ZONEFILE= /usr/lib/isdn/zone-de-%s.gdbm
|
||||
DESTFILE= /usr/lib/isdn/dest.gdbm
|
||||
|
||||
# providerselect
|
||||
VBN = 010
|
||||
VBNLEN = 2:3
|
||||
PRESELECTED=33
|
|
@ -0,0 +1,38 @@
|
|||
# exapmle of /etc/isdn/isdn.conf
|
||||
# copy this file to /etc/isdn/isdn.conf and edit
|
||||
#
|
||||
# More information: /usr/doc/packages/i4l/isdnlog/README
|
||||
|
||||
|
||||
[GLOBAL]
|
||||
COUNTRYPREFIX = +
|
||||
COUNTRYCODE = 31
|
||||
AREAPREFIX = 0
|
||||
|
||||
# EDIT THIS LINE:
|
||||
AREACODE = 020
|
||||
|
||||
[VARIABLES]
|
||||
|
||||
[ISDNLOG]
|
||||
LOGFILE = /var/log/isdn.log
|
||||
ILABEL = %b %e %T %ICall to tei %t from %N2 on %n2
|
||||
OLABEL = %b %e %T %Itei %t calling %N2 with %n2
|
||||
REPFMTWWW = "%X %D %17.17H %T %-17.17F %-20.20l SI: %S %9u %U %I %O"
|
||||
REPFMTSHORT = "%X%D %8.8H %T %-14.14F%U%I %O"
|
||||
REPFMT = " %X %D %15.15H %T %-15.15F %7u %U %I %O"
|
||||
CHARGEMAX = 50.00
|
||||
CURRENCY = 1.056,NLG
|
||||
|
||||
COUNTRYFILE = /usr/lib/isdn/country-de.dat
|
||||
RATECONF= /etc/isdn/rate.conf
|
||||
RATEFILE= /usr/lib/isdn/rate-nl.dat
|
||||
HOLIDAYS= /usr/lib/isdn/holiday-nl.dat
|
||||
ZONEFILE= /usr/lib/isdn/zone-nl-%s.gdbm
|
||||
DESTFILE= /usr/lib/isdn/dest.gdbm
|
||||
|
||||
# providerselect
|
||||
VBN = 16:17
|
||||
# Paul ?? Len of digits after 16 or 17
|
||||
VBNLEN = 2
|
||||
PRESELECTED=999
|
|
@ -1,12 +1,22 @@
|
|||
CC=gcc -m486 -O0 -g -Wall -DSTANDALONE -I. -I.. -I../isdnlog
|
||||
CC=gcc -m486 -O2 -Wall -DSTANDALONE -I. -I.. -I../isdnlog -I../connect -I../../lib -DUSE_DESTINATION
|
||||
#CC=gcc -m486 -O2 -g -pg -Wall -DSTANDALONE -I. -I.. -I../isdnlog
|
||||
|
||||
all: rate zone.exe country holiday rate-at
|
||||
all: rate-at
|
||||
|
||||
rate: rate.u zone.u country.u holiday.u
|
||||
${CC} -lgdbm -lm -o rate rate.u zone.u country.u holiday.u
|
||||
|
||||
zone.exe: zone.c zone.h
|
||||
${CC} -DZONETEST -lgdbm -o zone.exe zone.c
|
||||
rate: rate.u zone.u country.u holiday.u dest.u telnum.u
|
||||
${CC} -lgdbm -o rate rate.u zone.u dest.u holiday.u telnum.u
|
||||
|
||||
telnum: rate.u zone.u country.u holiday.u dest.u telnum.o1
|
||||
${CC} -lgdbm -o rate rate.u zone.u dest.u holiday.u telnum.o1
|
||||
|
||||
AT: rate-at
|
||||
./rate-at > rate-at.dat
|
||||
(cd dest;pp_rate ../rate-at.dat ../../rate-at.dat)
|
||||
rm rate-at.dat
|
||||
|
||||
#zone.exe: zone.c zone.h
|
||||
# ${CC} -DZONETEST -lgdbm -o zone.exe zone.c
|
||||
# this is built in tools/zone
|
||||
|
||||
country: country.c country.h
|
||||
${CC} -DCOUNTRYTEST -o country country.c
|
||||
|
@ -26,8 +36,17 @@ zone.u: zone.c zone.h
|
|||
country.u: country.c country.h
|
||||
${CC} -c -o country.u country.c
|
||||
|
||||
dest.u: dest.c dest.h
|
||||
${CC} -c -o dest.u dest.c
|
||||
|
||||
telnum.u: telnum.c telnum.h
|
||||
${CC} -c -o telnum.u telnum.c
|
||||
|
||||
telnum.o1: telnum.c telnum.h
|
||||
${CC} -DTEST_TELNUM -c -o telnum.u telnum.o1
|
||||
|
||||
holiday.u: holiday.c holiday.h
|
||||
${CC} -c -o holiday.u holiday.c
|
||||
|
||||
clean:
|
||||
rm -f rate holiday *.u *~
|
||||
rm -f rate holiday *.u *~ rate-at
|
||||
|
|
|
@ -1,5 +1,29 @@
|
|||
NEWS betreffend tools, (rate, isdnrate)
|
||||
|
||||
1999.10.21
|
||||
Destination DB runs with isdnrate / isdnlog
|
||||
Removed a lot of country-specific stuff in various files
|
||||
|
||||
all
|
||||
new entries in isdn.conf section
|
||||
[ISDNLOG]
|
||||
DESTFILE=/usr/lib/isdn/dest.gdbm
|
||||
VBN=Providerselection-Prefix (DE 010, AT 10, NL 16:17)
|
||||
VBNLEN=Number of digits following VBN (DE 2:3, AT 2, NL 1 ??, FR 1)
|
||||
PRESELECTED=provider# (DE 33, AT 1, NL 999)
|
||||
s. isdnlog/samples or isdnlog/README
|
||||
|
||||
isdnrep.c
|
||||
shows now zone names from rate-CC.dat
|
||||
|
||||
isdnrate.c
|
||||
new option -N
|
||||
show info about number parsing
|
||||
e.g. isdnrate -N 1234 01234 001234 Dubai
|
||||
|
||||
1999.10.08
|
||||
started with tools/dest
|
||||
|
||||
1999.09.15
|
||||
isdnrate.c
|
||||
neue Varianten
|
||||
|
|
|
@ -0,0 +1,432 @@
|
|||
/*
|
||||
* Destination handling
|
||||
*
|
||||
* Copyright 1999 by Leopold Toetsch <lt@toetsch.at>
|
||||
*
|
||||
* 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, 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.
|
||||
*
|
||||
* Changes:
|
||||
*
|
||||
* 1.00 08.10.1999 lt Initial Version
|
||||
*/
|
||||
|
||||
/* #define DEBUG */
|
||||
|
||||
#define _DEST_C_
|
||||
|
||||
#ifdef STANDALONE
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#ifndef __GLIBC__
|
||||
extern const char *basename(const char *name);
|
||||
|
||||
#endif
|
||||
#else
|
||||
#include "isdnlog.h"
|
||||
#include "tools.h"
|
||||
#endif
|
||||
|
||||
#include "dest.h"
|
||||
#include "zone/config.h"
|
||||
#include "zone/common.h"
|
||||
|
||||
#ifndef LENGTH
|
||||
#define LENGTH 256
|
||||
#endif
|
||||
#ifndef UNKNOWN
|
||||
#define UNKNOWN -1
|
||||
#endif
|
||||
#ifdef DESTTEST
|
||||
char *Strncpy(char *dest, const char *src, int len);
|
||||
char *Strncat(char *dest, const char *src, int len);
|
||||
#endif
|
||||
|
||||
#ifndef min
|
||||
#define min(x,y) (x)<(y)?(x):(y)
|
||||
#endif
|
||||
|
||||
static char version[] = "1.00";
|
||||
static _DB db; /* our dest.db */
|
||||
static int init_ok=0;
|
||||
|
||||
typedef struct {
|
||||
char number[TN_MAX_NUM_LEN];
|
||||
TELNUM num;
|
||||
int lru;
|
||||
} num_cache_t;
|
||||
|
||||
#define CACHE_SIZE 10
|
||||
static num_cache_t num_cache[CACHE_SIZE];
|
||||
|
||||
static void add_cache(char *number, TELNUM *num) {
|
||||
int i, mlru,m;
|
||||
mlru=9999;
|
||||
m=0;
|
||||
for (i=0; i<CACHE_SIZE; i++) {
|
||||
if(!*num_cache[i].number) {
|
||||
Strncpy(num_cache[i].number, number, TN_MAX_NUM_LEN);
|
||||
memcpy(&num_cache[i].num, num, sizeof(TELNUM));
|
||||
break;
|
||||
}
|
||||
if(num_cache[i].lru<mlru) {
|
||||
m=i;
|
||||
mlru=num_cache[i].lru;
|
||||
}
|
||||
}
|
||||
if(i==CACHE_SIZE) {
|
||||
Strncpy(num_cache[m].number, number, TN_MAX_NUM_LEN);
|
||||
memcpy(&num_cache[m].num, num, sizeof(TELNUM));
|
||||
num_cache[m].lru=1;
|
||||
}
|
||||
}
|
||||
|
||||
static int get_cache(char *number, TELNUM *num) {
|
||||
int i;
|
||||
for (i=0; i<CACHE_SIZE; i++) {
|
||||
if (!num_cache[i].number)
|
||||
break;
|
||||
num_cache[i].lru--;
|
||||
if(strcmp(num_cache[i].number, number) == 0) {
|
||||
num_cache[i].lru++;
|
||||
memcpy((char*)num+offsetof(TELNUM,scountry),
|
||||
(char*)&num_cache[i].num+offsetof(TELNUM,scountry),
|
||||
sizeof(TELNUM)-offsetof(TELNUM,scountry));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void warning(char *fmt,...)
|
||||
{
|
||||
va_list ap;
|
||||
char msg[BUFSIZ];
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(msg, BUFSIZ, fmt, ap);
|
||||
va_end(ap);
|
||||
#ifdef STANDALONE
|
||||
fprintf(stderr, "WARNING: %s\n", msg);
|
||||
#else
|
||||
print_msg(PRT_NORMAL, "WARNING: %s\n", msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
void exitDest(void)
|
||||
{
|
||||
CLOSE(db);
|
||||
init_ok=0;
|
||||
}
|
||||
|
||||
int initDest(char *path, char **msg)
|
||||
{
|
||||
static char message[LENGTH];
|
||||
char vinfo[] = "vErSiO";
|
||||
datum key, value;
|
||||
|
||||
if (msg)
|
||||
*(*msg = message) = '\0';
|
||||
if (init_ok == 1)
|
||||
return 0;
|
||||
else if(init_ok == -1)
|
||||
return -1;
|
||||
if (!path || !*path) {
|
||||
if (msg)
|
||||
snprintf(message, LENGTH,
|
||||
"Dest V%s: Error: no destination database specified!", version);
|
||||
return init_ok = -1;
|
||||
}
|
||||
if ((db = OPEN(path, READ)) == 0) {
|
||||
if (msg)
|
||||
snprintf(message, LENGTH,
|
||||
"Dest V%s: Error: gdbm_open '%s': '%s'",
|
||||
version, path, GET_ERR);
|
||||
}
|
||||
/* read info */
|
||||
key.dptr = vinfo;
|
||||
key.dsize = 7;
|
||||
value = FETCH(db, key);
|
||||
if (value.dptr == 0) {
|
||||
if (msg)
|
||||
snprintf(message, LENGTH,
|
||||
"Dest V%s: Error: File '%s': no Vinfo",
|
||||
version, path);
|
||||
exitDest();
|
||||
return init_ok = -1;
|
||||
}
|
||||
if (msg)
|
||||
snprintf(message, LENGTH,
|
||||
"Dest V%s: File '%s' opened fine - %s", version, path, value.dptr);
|
||||
|
||||
if (*dbv == 'G')
|
||||
free(value.dptr);
|
||||
init_ok = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void append(char *dest, char *what)
|
||||
{
|
||||
if (!what || !*what)
|
||||
return;
|
||||
if (strcmp(dest, what)) {
|
||||
if(*dest)
|
||||
Strncat(dest, "/", TN_MAX_SAREA_LEN);
|
||||
Strncat(dest, what, TN_MAX_SAREA_LEN);
|
||||
}
|
||||
}
|
||||
|
||||
static bool isKey(const char *p)
|
||||
{
|
||||
bool key = true;
|
||||
|
||||
for (; *p; p++)
|
||||
if (*p != '_' && (!isalpha(*p) || !isupper(*p))) {
|
||||
key = false;
|
||||
break;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
int getDest(char *onumber, TELNUM * num)
|
||||
{
|
||||
bool first = true;
|
||||
size_t len;
|
||||
datum key, value, nvalue;
|
||||
static char unknown[] = "Unknown";
|
||||
char *p, *q, *city = 0, *s, *name;
|
||||
int arealen, countrylen, prefixlen;
|
||||
char *number = strdup(onumber);
|
||||
char tld[3];
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("getD. %s\n", number);
|
||||
#endif
|
||||
*tld = '\0';
|
||||
if (get_cache(number, num)) {
|
||||
#ifdef DEBUG
|
||||
printf("getD (cache). %s %s\n", number, formatNumber("%f",num));
|
||||
#endif
|
||||
free(number);
|
||||
return 0;
|
||||
}
|
||||
len = strlen(number);
|
||||
if (isdigit(*number)) {
|
||||
warning("getDest called with local number '%s'", number);
|
||||
add_cache(number, num);
|
||||
return UNKNOWN;
|
||||
}
|
||||
countrylen = arealen = prefixlen = 0;
|
||||
num->ncountry = 0;
|
||||
num->narea = 0;
|
||||
*num->area = '\0';
|
||||
*num->sarea = '\0';
|
||||
*num->scountry = '\0';
|
||||
*num->country = '\0';
|
||||
*num->msn = '\0';
|
||||
*num->keys = '\0';
|
||||
if (len > 1 && !isdigit(number[1]) && !isKey(number))
|
||||
city = strdup(number);
|
||||
again:
|
||||
key.dptr = number;
|
||||
key.dsize = len;
|
||||
value = FETCH(db, key);
|
||||
again2:
|
||||
if (value.dptr != 0) {
|
||||
/* we have a value:
|
||||
* it could be
|
||||
* :RKEY ... pointer to a KEY
|
||||
* :city ... pointer to a city
|
||||
* name;code ... top level entry i.e country
|
||||
* name;codes[;:KEY] ... region
|
||||
* [#len];code;:KEY ... city
|
||||
*/
|
||||
while (value.dptr && *value.dptr == ':') {
|
||||
/* check for city, i.e. lowercase chars */
|
||||
if (!isKey(value.dptr + 1)) {
|
||||
city = strdup(value.dptr + 1);
|
||||
#ifdef DEBUG
|
||||
printf("C. %s\n", city);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
append(num->keys, value.dptr + 1);
|
||||
Strncpy(tld,value.dptr+1,3);
|
||||
}
|
||||
key.dptr = value.dptr + 1;
|
||||
key.dsize = value.dsize - 2; /* w/o : and \x0 */
|
||||
nvalue = FETCH(db, key);
|
||||
if (*dbv == 'G')
|
||||
free(value.dptr);
|
||||
value = nvalue;
|
||||
}
|
||||
/* do we have something valid */
|
||||
if (value.dptr == 0 && first) {
|
||||
strcpy(num->scountry, unknown);
|
||||
strcpy(num->sarea, unknown);
|
||||
Strncpy(num->msn, number, TN_MAX_MSN_LEN);
|
||||
free(number);
|
||||
if (city)
|
||||
free(city);
|
||||
return 0;
|
||||
}
|
||||
/* now we must have a name or city */
|
||||
first = false;
|
||||
s = value.dptr;
|
||||
p = strsep(&s, ";");
|
||||
/* name or #len or empty */
|
||||
name = 0;
|
||||
#ifdef DEBUG
|
||||
printf("1. %s\n", p);
|
||||
#endif
|
||||
if (p && *p) {
|
||||
if (*p == '#')
|
||||
prefixlen = atoi(p + 1);
|
||||
else
|
||||
name = strdup(p);
|
||||
}
|
||||
|
||||
p = strsep(&s, ";");
|
||||
/* codes or empty */
|
||||
#ifdef DEBUG
|
||||
printf("2. %s\n", p);
|
||||
#endif
|
||||
if (p && *p) {
|
||||
q = strtok(p, ","); /* we could have multiple codes */
|
||||
if(*number!='+') {
|
||||
if (arealen == 0) { /* first one must be city */
|
||||
arealen = strlen(q);
|
||||
Strncpy(num->area, q, TN_MAX_AREA_LEN);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (arealen == 0) { /* we take the orig number */
|
||||
arealen = strlen(number);
|
||||
Strncpy(num->area, number, TN_MAX_AREA_LEN);
|
||||
}
|
||||
}
|
||||
if (strstr(num->area, q)) /* only if new number has same prefix */
|
||||
countrylen = strlen(q); /* last one must be country */
|
||||
}
|
||||
|
||||
p = strsep(&s, ";");
|
||||
/* :KEY or empty */
|
||||
#ifdef DEBUG
|
||||
printf("3. %s\n", p);
|
||||
#endif
|
||||
/* we should be at toplevel i.e country */
|
||||
if (!p) {
|
||||
char cc[TN_MAX_AREA_LEN];
|
||||
|
||||
append(num->scountry, name);
|
||||
if (countrylen && (arealen || prefixlen)) {
|
||||
append(num->sarea, city);
|
||||
Strncpy(cc, num->area + 1, countrylen);
|
||||
Strncpy(num->country, num->area, countrylen+1);
|
||||
num->ncountry = atoi(cc);
|
||||
strcpy(num->tld,tld);
|
||||
p = num->area + countrylen;
|
||||
arealen -= countrylen;
|
||||
Strncpy(num->area, p, 1 + (prefixlen ? prefixlen : arealen));
|
||||
num->narea = atoi(num->area);
|
||||
if (*onumber == '+' && strlen(onumber) > arealen + countrylen)
|
||||
Strncpy(num->msn, onumber + arealen + countrylen, TN_MAX_MSN_LEN);
|
||||
add_cache(onumber, num);
|
||||
}
|
||||
}
|
||||
else if (p && *p == ':') {
|
||||
/* do we have a code */
|
||||
append(num->sarea, name);
|
||||
append(num->keys, p + 1);
|
||||
Strncpy(tld,p+1,3);
|
||||
key.dptr = p + 1;
|
||||
key.dsize = strlen(p + 1);
|
||||
nvalue = FETCH(db, key);
|
||||
if (*dbv == 'G')
|
||||
free(value.dptr);
|
||||
value = nvalue;
|
||||
goto again2;
|
||||
}
|
||||
if (*dbv == 'G')
|
||||
free(value.dptr);
|
||||
free(number);
|
||||
if (city)
|
||||
free(city);
|
||||
return 0;
|
||||
} /* if value */
|
||||
else if (first && len && *number == '+') { /* try shorter nums */
|
||||
number[--len] = '\0';
|
||||
goto again; /* I like it */
|
||||
}
|
||||
free(number);
|
||||
if (city)
|
||||
free(city);
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
#ifdef STANDALONE
|
||||
char *Strncpy(char *dest, const char *src, int len)
|
||||
{
|
||||
int l = strlen(src);
|
||||
|
||||
if (l > len - 1)
|
||||
l = len - 1;
|
||||
strncpy(dest, src, l);
|
||||
dest[l] = '\0';
|
||||
return dest;
|
||||
}
|
||||
char *Strncat(char *dest, const char *src, int len)
|
||||
{
|
||||
int destlen = strlen(dest);
|
||||
|
||||
return Strncpy(dest + destlen, src, len - destlen);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef DESTTEST
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char *msg;
|
||||
TELNUM num;
|
||||
int i = 1, res;
|
||||
|
||||
if (initDest("./dest.gdbm", &msg)) {
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
if (argc == 1) {
|
||||
fprintf(stderr, "Usage:\n\t%s number|name ...", basename(argv[0]));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
memset(&num, 0, sizeof(num));
|
||||
while (--argc) {
|
||||
res = getDest(argv[i++], &num);
|
||||
printf("%s %s(%d) %s(%s) %s - %s\n",
|
||||
res == 0 ? "Ok." : "Err", num.country, num.ncountry, num.sarea, num.area,
|
||||
num.msn, num.keys);
|
||||
}
|
||||
exitDest();
|
||||
return (EXIT_SUCCESS);
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Destination database
|
||||
*
|
||||
* Copyright 1999 by Leo Tötsch <lt@toetsch.at>
|
||||
*
|
||||
* 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, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _DEST_H_
|
||||
#define _DEST_H_
|
||||
|
||||
#include "telnum.h"
|
||||
int initDest (char *path, char **msg);
|
||||
void exitDest (void);
|
||||
int getDest (char *number, TELNUM * num);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,90 @@
|
|||
#
|
||||
# Makefile for dest (parts borrowed from ../zone)
|
||||
#
|
||||
# (C) 1999 l.toetsch <lt@toetsch.at>
|
||||
#
|
||||
BZIP2 = @BZIP2@
|
||||
SHELL = /bin/sh
|
||||
CFLAGS = -Wall -g
|
||||
DEFS = -DUSE_DESTINATION
|
||||
INCLUDES =
|
||||
LDFLAGS = @DBMLIB@
|
||||
DBEXT = @DBEXT@
|
||||
RDBEXT = @RDBEXT@
|
||||
PROGRAM = dest
|
||||
MODULES = $(PROGRAM).o
|
||||
MANPAGE = $(PROGRAM).8
|
||||
HEADERS = ../zone/common.h ../zone/config.h
|
||||
MANDIR = @CONFIG_MANDIR@
|
||||
SBINDIR = @CONFIG_SBINDIR@
|
||||
MAN8DIR = $(MANDIR)/man8
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = $(INSTALL) -o 0 -g 0 -m 0750
|
||||
INSTALL_MAN = $(INSTALL) -o 0 -g 0 -m 0644
|
||||
INSTALL_DATA = $(INSTALL) -o 0 -g 0 -m 0644
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
DATADIR = @datadir@
|
||||
#CC = @CC@ -V2.7.2.3
|
||||
CC = @CC@
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o
|
||||
|
||||
.PHONY: all config distclean dist install uninstall data
|
||||
|
||||
%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(DEFS) $(INCLUDES) -c -o $@ $<
|
||||
|
||||
all: $(PROGRAM) ../zone/config.h data
|
||||
|
||||
# be sure this is already built
|
||||
../zone/config.h:
|
||||
(cd ../zone ; @./configure)
|
||||
|
||||
config:
|
||||
@./configure
|
||||
|
||||
Makefile: Makefile.in config.status
|
||||
./config.status
|
||||
|
||||
config.status: configure
|
||||
./config.status --recheck
|
||||
|
||||
dest: ../dest.c $(HEADERS) Makefile
|
||||
$(CC) -DSTANDALONE -DDESTTEST $(DEFS) $(CFLAGS) ../dest.c $(LDFLAGS) -o $@
|
||||
|
||||
#install-man: $(PROGRAM).man
|
||||
# mkdir -p $(DESTDIR)$(MAN8DIR)
|
||||
# $(INSTALL_MAN) $< $(DESTDIR)$(MAN8DIR)/$(MANPAGE)
|
||||
|
||||
install: data
|
||||
# $(INSTALL_DATA) dest.gdbm $(DESTDIR)$(DATADIR)
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(DATADIR)/dest.gdbm
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ $(PROGRAM) *.db *.gdbm
|
||||
|
||||
distclean: clean
|
||||
rm -f config.status config.cache config.log *.man Makefile
|
||||
|
||||
#
|
||||
#
|
||||
ifeq ($(CONFIG_ISDN_LOG_CC_EN),y)
|
||||
LANG= -en
|
||||
endif
|
||||
|
||||
data:
|
||||
./makedest $(LANG) -v
|
||||
./makedest $(LANG) -v -a -gcities.dat
|
||||
ifeq ($(CONFIG_ISDN_LOG_DEST_AT),y)
|
||||
./makedest -v -a at
|
||||
endif
|
||||
ifeq ($(CONFIG_ISDN_LOG_DEST_DE),y)
|
||||
./makedest -v -a de
|
||||
endif
|
||||
ifeq ($(CONFIG_ISDN_LOG_DEST_NL),y)
|
||||
./makedest -v -a nl
|
||||
endif
|
|
@ -0,0 +1,5 @@
|
|||
airports.dat
|
||||
was built using the list from http://www.TravelDesk.com/airports.html
|
||||
converting it with cvap and sorting.
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
makedest makes a destination database
|
||||
|
||||
usage:
|
||||
makedest [-en] [-a] [-v[2]] [cc ...] [ -cCC file|-]
|
||||
eg.
|
||||
$ makedest at de nl
|
||||
which is the same as
|
||||
$ makedest
|
||||
$ makedest -a at de nl
|
||||
$ makedest -a -c43 somecodes
|
||||
|
||||
-a ... append country cc to database
|
||||
-en .. write english names for countries
|
||||
-v ... verbose, -v2 warns also for duplicate city names, which can be many
|
||||
-c ... appends file or stdin to country CC (CC may be number or isocode)
|
||||
|
||||
input files:
|
||||
global (de/en) /usr/lib/isdn/country-de.dat
|
||||
|
||||
code-files /usr/lib/isdn/code-CC.dat or ../zone/CC/code
|
||||
where CC is the given countrycode
|
||||
code-files (and input for stdin) consists of lines
|
||||
number\tcity[\tlen of prefix]
|
||||
|
||||
outputfile dest.gdbm is written to current directory and shoud be
|
||||
installed to desired destination
|
||||
|
||||
Author: Leopold Toetsch <lt@toetsch.at>
|
||||
Licence: GPL
|
|
@ -0,0 +1,13 @@
|
|||
pp_rate is the rate-files preprocessor
|
||||
It take a rate-file and converts countriy / city names in A:tag to their codes.
|
||||
|
||||
usage
|
||||
|
||||
pp_rate [infile [outfile]]
|
||||
|
||||
If infile is not given /usr/lib/isdn/rate-at.dat is used.
|
||||
If outfile is not given .new is appended to infile.
|
||||
|
||||
|
||||
After the first run aliases, which were given interactively are rememberd
|
||||
in ~/country-alias.
|
|
@ -0,0 +1,8 @@
|
|||
testdest tests dest-data files or dumps them to stdout
|
||||
|
||||
usage:
|
||||
testdest number|name ...
|
||||
testdest -d | sort > destdatadumped
|
||||
|
||||
Author: Leopold Toetsch <lt@toetsch.at>
|
||||
Licence: GPL
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,37 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(makedest)
|
||||
AC_PREFIX_DEFAULT(/usr)
|
||||
|
||||
CONFIG_MANDIR=`eval echo ${CONFIG_MANDIR:-"/usr/man"}`
|
||||
CONFIG_SBINDIR=`eval echo ${CONFIG_SBINDIR:-"/sbin"}`
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_CHECK_PROGS(BZIP2, bzip2)
|
||||
|
||||
dnl Checks for libraries.
|
||||
dnl Berkeley DB appends RDBEXT
|
||||
AC_CHECK_LIB(gdbm, gdbm_open, DBMLIB=-lgdbm;DBEXT=".gdbm";RDBEXT=".gdbm"; AC_DEFINE(HAVE_LIBGDBM),
|
||||
AC_CHECK_LIB(dbm, dbm_open, DBMLIB=-ldbm;RDBEXT=".db"; AC_DEFINE(HAVE_LIBDBM),
|
||||
AC_CHECK_LIB(db, dbm_open, DBMLIB=-ldb;RDBEXT=".db"; AC_DEFINE(HAVE_LIBDB),
|
||||
AC_MSG_ERROR("No db found"))))
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(unistd.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_TYPE_SIZE_T
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_CHECK_FUNCS(strdup strtoul)
|
||||
|
||||
AC_SUBST(DBMLIB)
|
||||
AC_SUBST(DBEXT)
|
||||
AC_SUBST(RDBEXT)
|
||||
AC_SUBST(CC)
|
||||
AC_SUBST(INSTALL)
|
||||
AC_SUBST(CONFIG_SBINDIR)
|
||||
AC_SUBST(CONFIG_MANDIR)
|
||||
AC_OUTPUT(Makefile)
|
|
@ -0,0 +1,35 @@
|
|||
#! /usr/bin/perl
|
||||
|
||||
open(IN,'airports.txt') || die("Can't read");
|
||||
open(OUT,'>airports.dat') || die('Write');
|
||||
|
||||
while (<IN>) {
|
||||
if (/^#/) {
|
||||
print OUT;
|
||||
next;
|
||||
}
|
||||
chomp;
|
||||
($c,$rest)=split(/\t/);
|
||||
@a=split(/,\s+/, $rest);
|
||||
$cou = $a[$#a];
|
||||
$rest='';
|
||||
if ($a[0] =~ s/\s(\[.*?\])//) {
|
||||
$rest=$1;
|
||||
}
|
||||
if ($a[0] =~ s/\s(\(.*?\))//) { # alternate spelling
|
||||
$t = $1;
|
||||
$t =~ s/[()]//g;
|
||||
print OUT "$t\t$c\t$a[$#a]\t# ";
|
||||
for $i (1..$#a-1) {
|
||||
print OUT $a[$i];
|
||||
}
|
||||
print OUT " $rest\n";
|
||||
}
|
||||
print OUT "$a[0]\t$c\t$a[$#a]\t# ";
|
||||
for $i (1..$#a-1) {
|
||||
print OUT $a[$i];
|
||||
}
|
||||
print OUT " $rest\n";
|
||||
}
|
||||
close IN;
|
||||
close OUT;
|
|
@ -0,0 +1,253 @@
|
|||
#! /usr/bin/perl
|
||||
|
||||
# make dest.gdbm
|
||||
# necessary parts: /usr/lib/isdn/country-de.dat
|
||||
# optional parts: zone/CC/code
|
||||
#
|
||||
# usage:
|
||||
# makedest [-en] [-v] [-a] [cc ...] [-cCC file...] [-gFile]
|
||||
#
|
||||
# these entries are written as 0-terminated strings
|
||||
# vErSiO\0 => 1.0 int[ cc...]
|
||||
#
|
||||
# for countrys
|
||||
# KEY => name ; +numbers [ ; :RKEY ]
|
||||
# name => :KEY
|
||||
# +number => :KEY
|
||||
#
|
||||
# for cities from zone/CC/code
|
||||
# name => [#len]; +numbers ; :CC
|
||||
# number => :name
|
||||
|
||||
use wld;
|
||||
BEGIN { @AnyDBM_File::ISA = qw(GDBM_File NDBM_File DB_File ) }
|
||||
use AnyDBM_File;
|
||||
use POSIX;
|
||||
use strict;
|
||||
$|=1;
|
||||
my $co_dat = '/usr/lib/isdn/country-de.dat';
|
||||
my $dest_gdbm = './dest.gdbm';
|
||||
my ($vers) = "vErSiO\x0";
|
||||
my $VERSION='1.0';
|
||||
|
||||
|
||||
my(%db,$N,$A,$T,$E,$C,$R, $lang,$append,$verbose,$i, $cc, $file, $tied);
|
||||
while ($ARGV[0] =~ /^-(.)(\S*)/) {
|
||||
shift(@ARGV);
|
||||
$append=1,next if ($1 eq 'a');
|
||||
$lang='en',next if ("$1$2" eq 'en');
|
||||
$verbose=$1,next if($1 eq 'v');
|
||||
if ($1 eq 'c') {
|
||||
$cc=$2;
|
||||
$file = shift(@ARGV);
|
||||
if(!$append) {
|
||||
print("Only with append -a ... ignoring $cc\n");
|
||||
next;
|
||||
}
|
||||
if (!$tied) {
|
||||
tie(%db, 'AnyDBM_File',$dest_gdbm, O_RDWR ,0644); # write
|
||||
$tied=1;
|
||||
}
|
||||
&write_cc($cc, $file);
|
||||
next;
|
||||
}
|
||||
if ($1 eq 'g') { # -gFile
|
||||
if (!$tied) {
|
||||
tie(%db, 'AnyDBM_File',$dest_gdbm, O_RDWR ,0644); # write
|
||||
$tied=1;
|
||||
}
|
||||
$file=$2;
|
||||
my $value=$db{$vers};
|
||||
chop $value;
|
||||
$value =~s / \((\d+)\)//;
|
||||
$i=$1;
|
||||
$i++;
|
||||
$value .= " (+$i)\x00";
|
||||
$db{$vers}=$value;
|
||||
write_global($file);
|
||||
next;
|
||||
}
|
||||
}
|
||||
if (!$tied) {
|
||||
unlink $dest_gdbm unless($append);
|
||||
tie(%db, 'AnyDBM_File',$dest_gdbm, $append ? O_RDWR : O_CREAT, 0644); # make new
|
||||
}
|
||||
|
||||
unless($append) {
|
||||
$db{$vers}="Dest $VERSION int\x00";
|
||||
write_global($co_dat);
|
||||
}
|
||||
|
||||
foreach $C (@ARGV) {
|
||||
&write_cc($C);
|
||||
}
|
||||
untie(%db);
|
||||
|
||||
print "End.\n" if($verbose);
|
||||
sub write_global {
|
||||
my($co_dat) = $_[0];
|
||||
print "Adding global $co_dat...\n" if($verbose);
|
||||
open(IN, '../../country-de.dat') ||
|
||||
open(IN, $co_dat) ||
|
||||
die("Cant find country-de.dat");
|
||||
$i=0;
|
||||
while (<IN>) {
|
||||
print "$i\r" if (++$i % 10==0 && $verbose);
|
||||
s/\s*#.*$//; # kill comments
|
||||
next if /^$/; # skip empty
|
||||
if (/^N:(.*)/) {
|
||||
&write1 if($N);
|
||||
$A=$C=$E=$T=$R='';
|
||||
$N=$1;
|
||||
}
|
||||
elsif (/^A:(.*)/) {
|
||||
$A = $A ? "$A, $1" : $1; # append aliases
|
||||
}
|
||||
elsif (/^C:(.*)/) {
|
||||
$C = $C ? "$C, $1" : $1; # append codes
|
||||
}
|
||||
elsif (/^T:(.*)/) {
|
||||
if($T) { # duplicate
|
||||
print "Duplicate entry T:$T/$1 for $N\n";
|
||||
}
|
||||
elsif ($1 ne uc $1) {
|
||||
print "Key $1 for $N not uppercase\n";
|
||||
}
|
||||
else {
|
||||
$T=$1;
|
||||
}
|
||||
}
|
||||
elsif (/^E:(.*)/) {
|
||||
if($E) { # duplicate
|
||||
print "Duplicate entry E:$E/$1 for $N\n";
|
||||
}
|
||||
else {
|
||||
$E=$1;
|
||||
}
|
||||
}
|
||||
elsif (/^R:(.*)/) {
|
||||
if($R) { # duplicate
|
||||
print "Duplicate entry R:$R/$1 for $N\n";
|
||||
}
|
||||
else {
|
||||
$R=$1;
|
||||
}
|
||||
}
|
||||
}
|
||||
&write1; # last
|
||||
close(IN);
|
||||
} # global
|
||||
|
||||
my($Terr);
|
||||
sub write1 {
|
||||
my ($name, $value, @C);
|
||||
if(!$T) {
|
||||
print "No uniq code T: defined for $N ... ignored\n";
|
||||
if (++$Terr > 15) {
|
||||
print "You are sure you have the right country-file?\n";
|
||||
exit;
|
||||
}
|
||||
return;
|
||||
}
|
||||
$name = $lang eq 'en' && $E ? $E : $N;
|
||||
$C =~ s/\s//g;
|
||||
$name=~s/;//g; # be sure
|
||||
$name=~s/^://; # be sure
|
||||
$value="$name;$C";
|
||||
if($R) {
|
||||
$value .= ";:$R";
|
||||
}
|
||||
$value .= "\x00";
|
||||
$db{$T}=$value;
|
||||
@C=split(/,/,$C);
|
||||
foreach $C (@C) {
|
||||
$db{$C}=":$T\x00";
|
||||
}
|
||||
$db{$name}=":$T\x00";
|
||||
}
|
||||
|
||||
sub write_cc {
|
||||
my($cc, $file) = @_;
|
||||
if ($cc =~ /-c(\S+)/) {
|
||||
$cc=$1;
|
||||
$file = shift(@ARGV);
|
||||
}
|
||||
my $value;
|
||||
my($nam,$cods,$r);
|
||||
if ($cc =~ /[a-z][a-z]/) { # a iso country code
|
||||
$value=$db{uc $cc};
|
||||
chop $value;
|
||||
($nam,$cods,$r) = split(/;/,$value);
|
||||
print "Adding $cc...\n" if($verbose);
|
||||
unless($cods) {
|
||||
print "Unknown Country-code $cc ... ignored\n";
|
||||
return;
|
||||
}
|
||||
if ((split(/,/,$cods))>1) {
|
||||
print "Multiple Country-codes '$cods' for $cc ... ignored\n";
|
||||
return;
|
||||
}
|
||||
if ($r) {
|
||||
print "Country $cc seems not to be top level - has R:$r ... ignored\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
elsif ($cc =~ /(\d+)/) { # a numeric code w/o +
|
||||
$cc="+$1";
|
||||
}
|
||||
if ($cc =~ /^\+\d+$/) { # a numeric code
|
||||
$cods=$cc;
|
||||
$cc = $db{$cods};
|
||||
chop $cc;
|
||||
$cc =~ s/^://;
|
||||
if(!$cc || $cc !~ /^[A-Z][A-Z]$/) {
|
||||
print("Can't find country for $cods ($cc)\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!$cc || !$cods) {
|
||||
print "CC: '$cc' Cod '$cods' ???\n";
|
||||
return;
|
||||
}
|
||||
if ($file) {
|
||||
open(IN,$file) || die("Can't find $file");
|
||||
print("Enter num<TAB>city[<TAB>len]<CR>...^D\n") if($verbose&&$file eq '-');
|
||||
}
|
||||
else {
|
||||
open(IN,"/usr/lib/isdn/code-$cc.dat") ||
|
||||
open(IN,"../zone/$cc/code") ||
|
||||
die("Can't find code file in ../zone/$cc or /usr/lib/idsn");
|
||||
}
|
||||
$cc = uc $cc;
|
||||
$value=$db{$vers};
|
||||
chop $value;
|
||||
if($file) {
|
||||
$value =~s / \((\d+)\)//;
|
||||
$i=$1;
|
||||
$i++;
|
||||
$value .= " (+$i)\x00";
|
||||
}
|
||||
else {
|
||||
$value .= " $cc\x00";
|
||||
}
|
||||
$db{$vers}=$value;
|
||||
$i=0;
|
||||
while (<IN>) {
|
||||
print "$i\r" if (++$i % 10==0 && $verbose);
|
||||
s/\s*#.*$//; # kill comments
|
||||
next if /^$/; # skip empty
|
||||
my ($num, $ort, $len);
|
||||
chomp;
|
||||
($num, $ort, $len) =split(/\t/);
|
||||
$db{"$cods$num"}=":$ort\x00" unless defined $db{"$cods$num"};
|
||||
if (defined $db{$ort}) {
|
||||
print "Duplicate city '$ort' ... ignored\n" if($verbose >1);
|
||||
next;
|
||||
}
|
||||
if ($len) {
|
||||
$len="#$len";
|
||||
}
|
||||
$db{$ort}="$len;$cods$num;:$cc\x00";
|
||||
}
|
||||
close(IN) unless($file eq '-');
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
#! /usr/bin/perl
|
||||
|
||||
use wld;
|
||||
use strict;
|
||||
$|=1;
|
||||
use vars qw( %names $COUNTRY %myalias );
|
||||
$COUNTRY = '/usr/src/isdn4k-utils/isdnlog/tools/country';
|
||||
|
||||
&get_country;
|
||||
&get_alias;
|
||||
&prep_rate;
|
||||
1;
|
||||
|
||||
sub get_country {
|
||||
my ($name, $alias, $key, $nn, $na);
|
||||
sub add1 {
|
||||
my (@all, $a);
|
||||
$names{lc $name}=$key;
|
||||
$nn++;
|
||||
@all=split(/\s*,\s*/, $alias);
|
||||
foreach $a (@all) {
|
||||
$na++;
|
||||
$names{lc $a}=$key;
|
||||
}
|
||||
}
|
||||
my $co_dat = '/usr/lib/isdn/country-de.dat';
|
||||
open(IN,$co_dat) || die("Cant read $co_dat");
|
||||
while (<IN>) {
|
||||
chomp;
|
||||
s/\s*#.*$//;
|
||||
s/\s+$//;
|
||||
if (/^N:(.*)/) {
|
||||
&add1;
|
||||
$alias='';
|
||||
$name=$1;
|
||||
}
|
||||
elsif (/^[AE]:(.*)/) {
|
||||
$alias = $alias ne '' ? "$alias,$1" : $1;
|
||||
}
|
||||
elsif (/^T:(.*)/) {
|
||||
$key=$1;
|
||||
}
|
||||
}
|
||||
&add1;
|
||||
close IN;
|
||||
print "$nn Countrys $na Aliases loaded\n";
|
||||
}
|
||||
|
||||
sub get_alias {
|
||||
`cp ~/.country-alias .country-alias`;
|
||||
open(IN, ".country-alias");
|
||||
while (<IN>) {
|
||||
chomp;
|
||||
my($c,$a) = split(/\t/);
|
||||
$myalias{$c}=$a;
|
||||
}
|
||||
close(IN);
|
||||
}
|
||||
|
||||
sub prep_rate {
|
||||
my ($l, $infile, $outfile);
|
||||
$infile = $ARGV[0] || '/usr/lib/isdn/rate-at.dat';
|
||||
$outfile = $ARGV[1] || "$infile.new";
|
||||
open(IN,$infile) || die("Can't read $infile");
|
||||
open(OUT,">$outfile") || die("Cant write $outfile");
|
||||
$l=0;
|
||||
while (<IN>) {
|
||||
my($a,@a, $c, $oc, $r, $d, @keys, $name, $m, $tf);
|
||||
$l++;
|
||||
print "\r$l" if $l % 10 == 0;
|
||||
if (/^A:(.*)/) {
|
||||
$a=$1;
|
||||
$a =~ s/\s*#.*$//;
|
||||
$a =~ s/[,\s]+$//;
|
||||
@a=split(/\s*,\s*/, $a);
|
||||
foreach $c (@a) {
|
||||
next if ($c eq '');
|
||||
$c = lc $c;
|
||||
ok:
|
||||
if ($c =~ /^\+?\d+/ || $c eq '+') {
|
||||
push(@keys,$c);
|
||||
}
|
||||
elsif ($d=$names{$c}) {
|
||||
push(@keys,$d);
|
||||
}
|
||||
elsif ($d=$names{$myalias{$c}}) {
|
||||
push(@keys,$d);
|
||||
}
|
||||
else {
|
||||
$oc = $c;
|
||||
again:
|
||||
print "'$c'";
|
||||
$m=99; $tf='';
|
||||
if ($COUNTRY) {
|
||||
my $cc = `$COUNTRY "$c"`;
|
||||
($tf, $m) = $cc =~ /<.*?>=<(.*?)>\sd=(\d+)/;
|
||||
$m=99 if ($cc =~/unknown/);
|
||||
$tf = lc $tf;
|
||||
}
|
||||
else {
|
||||
foreach $name (keys(%names)) {
|
||||
if (($r=wld($name,$c)) < $m) {
|
||||
$m=$r; $tf=$name;
|
||||
last if($m==0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($tf && $m<=1) {
|
||||
push(@keys,$names{$tf});
|
||||
$names{$oc}=$names{$tf};
|
||||
$myalias{$oc}=$tf;
|
||||
print " -> $tf\n";
|
||||
}
|
||||
else {
|
||||
my($x);
|
||||
print "\nLine $l: $c => $tf ($m)\n ? [j,[+|=]...,/] : ";
|
||||
$x = <STDIN>;
|
||||
chomp($x);
|
||||
if ($x =~ /^=(.*)/) {
|
||||
$c = $1 if($1 ne '');
|
||||
goto again;
|
||||
}
|
||||
elsif ($x =~ /^\+(.*)/) {
|
||||
$c = $oc . $1;
|
||||
goto again;
|
||||
}
|
||||
elsif ($x =~ /^\/(.*)/) {
|
||||
print `grep -3 -i $1 /usr/lib/isdn/country-de.dat`;
|
||||
goto again;
|
||||
}
|
||||
if ($x eq 'j') {
|
||||
$c = $tf;
|
||||
$myalias{$oc}=$tf;
|
||||
$names{$oc}=$names{$tf};
|
||||
goto ok;
|
||||
}
|
||||
elsif ($x eq 'h') {
|
||||
print "j => Vorschlag annehmen";
|
||||
print "n => unbekannt ignorieren (gilt dann fuer die gesamte Datei)";
|
||||
print "+xx => xx an unbekannt anhaengen";
|
||||
print "= SO => SO uebernehmen";
|
||||
print "= => unbekannt uebernehmen";
|
||||
print "/xx => in country-de.dat nach xx greppen";
|
||||
print "xx => xx ausprobieren";
|
||||
goto again;
|
||||
}
|
||||
else {
|
||||
$c = $x;
|
||||
}
|
||||
goto again;
|
||||
}
|
||||
} # else found
|
||||
} # foreach
|
||||
print OUT "A:", join(',',@keys),"\n";
|
||||
} # if A
|
||||
else {
|
||||
print OUT $_;
|
||||
}
|
||||
} # while IN
|
||||
close(IN);
|
||||
close(OUT);
|
||||
open(OUT, ">.country-alias") || die("Can't write .country-alias");
|
||||
foreach my $c (sort(keys(%myalias))) {
|
||||
print OUT "$c\t",$myalias{$c},"\n";
|
||||
}
|
||||
close(OUT);
|
||||
`mv .country-alias ~/.country-alias`;
|
||||
print "\nOk.\n";
|
||||
} # prep_rate
|
|
@ -0,0 +1,56 @@
|
|||
#! /usr/bin/perl
|
||||
|
||||
# test dest.gdbm
|
||||
|
||||
BEGIN { @AnyDBM_File::ISA = qw(GDBM_File NDBM_File DB_File ) }
|
||||
use AnyDBM_File;
|
||||
use POSIX;
|
||||
use strict;
|
||||
if (!@ARGV) {
|
||||
print "usage:\n\ttestdest name | num ...\ttestdest -d | sort >destdump\n";
|
||||
exit;
|
||||
}
|
||||
$|=1;
|
||||
my $dest_gdbm = './dest.gdbm';
|
||||
my $dump=@ARGV[0] eq '-d';
|
||||
my(%db,$value,@answers,$r,$nam,$cod,$or,$first);
|
||||
tie(%db, 'AnyDBM_File',$dest_gdbm, O_RDONLY ,644);
|
||||
if($dump) {
|
||||
while (($r,$value) = each(%db)) {
|
||||
chop $value; # x\00
|
||||
print "$r=>$value\n"
|
||||
}
|
||||
untie(%db);
|
||||
exit;
|
||||
}
|
||||
|
||||
foreach $r (@ARGV) {
|
||||
$or=$r;
|
||||
$first=1;
|
||||
@answers=();
|
||||
again:
|
||||
if ($value=$db{$r}) {
|
||||
$first=0;
|
||||
chop $value; # 0x00
|
||||
push(@answers,$value);
|
||||
while ($value =~ s/^://) {
|
||||
$value=$db{$value} || 'Unknown1';
|
||||
chop $value; # 0x00
|
||||
push(@answers,$value);
|
||||
}
|
||||
($nam,$cod,$r) = split(/;/,$value); # split last
|
||||
if ($r && $r =~ s/^://) {
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if($first && length($r)) {
|
||||
$r=substr($r,0,length($r)-1);
|
||||
goto again;
|
||||
}
|
||||
push(@answers,'Unknown2');
|
||||
}
|
||||
print "$or = ",join(' - ',@answers), "\n";
|
||||
}
|
||||
untie(%db);
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package wld;
|
||||
use strict;
|
||||
use vars qw($VERSION @ISA @EXPORT);
|
||||
$VERSION=1.0;
|
||||
require Exporter;
|
||||
@ISA=qw(Exporter);
|
||||
@EXPORT=qw(wld);
|
||||
sub min3 {
|
||||
my ($x, $y, $z)=@_;
|
||||
$y = $x if ($x lt $y);
|
||||
$z = $y if ($y lt $z);
|
||||
$z;
|
||||
}
|
||||
|
||||
sub wld { #/* weighted Levenshtein distance */
|
||||
my ($needle, $haystack) = @_;
|
||||
my($i, $j);
|
||||
my $l1 = length($needle);
|
||||
my $l2 = length($haystack);
|
||||
my @dw;
|
||||
my ($WMAX,$P,$Q,$R);
|
||||
$WMAX=$l1>$l2?$l1:$l2;
|
||||
$P=1;
|
||||
$Q=1;
|
||||
$R=1;
|
||||
|
||||
$dw[0][0]=0;
|
||||
for ($j=1; $j<=$WMAX; $j++) {
|
||||
$dw[0][$j]=$dw[0][$j-1]+$Q;
|
||||
}
|
||||
for ($i=1; $i<=$WMAX; $i++) {
|
||||
$dw[$i][0]=$dw[$i-1][0]+$R;
|
||||
}
|
||||
for ($i=1; $i<=$l1; $i++) {
|
||||
for($j=1; $j<=$l2; $j++) {
|
||||
$dw[$i][$j]=&min3($dw[$i-1][$j-1]+((substr($needle,$i-1,1) eq
|
||||
substr($haystack,$j-1,1))?0:$P),$dw[$i][$j-1]+$Q,$dw[$i-1][$j]+$R);
|
||||
}
|
||||
}
|
||||
return($dw[$l1][$l2]);
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: isdnconf.c,v 1.29 1999/06/15 20:05:08 akool Exp $
|
||||
/* $Id: isdnconf.c,v 1.30 1999/10/25 18:30:03 akool Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux. (Utilities)
|
||||
*
|
||||
|
@ -20,6 +20,11 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: isdnconf.c,v $
|
||||
* Revision 1.30 1999/10/25 18:30:03 akool
|
||||
* isdnlog-3.57
|
||||
* WARNING: Experimental version!
|
||||
* Please use isdnlog-3.56 for production systems!
|
||||
*
|
||||
* Revision 1.29 1999/06/15 20:05:08 akool
|
||||
* isdnlog Version 3.33
|
||||
* - big step in using the new zone files
|
||||
|
@ -729,6 +734,7 @@ static section* writeglobal(section *SPtr)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0 /* Fixme: remove */
|
||||
if (CityWeekend != 0)
|
||||
{
|
||||
strcpy(s, CONF_ENT_CW);
|
||||
|
@ -739,7 +745,7 @@ static section* writeglobal(section *SPtr)
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
if (chargemax != 0)
|
||||
{
|
||||
strcpy(s, CONF_ENT_CHARGE);
|
||||
|
@ -1062,7 +1068,9 @@ static int _readconfig(char *_myname)
|
|||
mycountry = "";
|
||||
myarea = "";
|
||||
currency = NULL;
|
||||
#if 0 /* Fixme: remove */
|
||||
CityWeekend = 0;
|
||||
#endif
|
||||
chargemax = 0.0;
|
||||
connectmax = 0;
|
||||
connectmaxmode = 0;
|
||||
|
@ -1235,12 +1243,24 @@ static int Set_Globals(section *SPtr)
|
|||
if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_RATEFILE)) != NULL)
|
||||
ratefile = CEPtr->value;
|
||||
|
||||
if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_DESTFILE)) != NULL)
|
||||
destfile = CEPtr->value;
|
||||
|
||||
if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_PRESELECT)) != NULL)
|
||||
preselect = atoi(CEPtr->value);
|
||||
|
||||
if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_VBN)) != NULL)
|
||||
vbn = CEPtr->value;
|
||||
if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_VBNLEN)) != NULL)
|
||||
vbnlen = CEPtr->value;
|
||||
|
||||
if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_LCDFILE)) != NULL)
|
||||
lcdfile = CEPtr->value;
|
||||
|
||||
#if 0 /* Fixme: remove */
|
||||
if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_CW)) != NULL)
|
||||
CityWeekend = toupper(*(CEPtr->value)) == 'Y'?1:0;
|
||||
|
||||
#endif
|
||||
if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_CHARGE)) != NULL)
|
||||
chargemax = strtod(CEPtr->value,NULL);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: isdnrate.c,v 1.20 1999/09/19 14:16:27 akool Exp $
|
||||
/* $Id: isdnrate.c,v 1.21 1999/10/25 18:30:03 akool Exp $
|
||||
|
||||
* ISDN accounting for isdn4linux. (rate evaluation)
|
||||
*
|
||||
|
@ -19,6 +19,11 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: isdnrate.c,v $
|
||||
* Revision 1.21 1999/10/25 18:30:03 akool
|
||||
* isdnlog-3.57
|
||||
* WARNING: Experimental version!
|
||||
* Please use isdnlog-3.56 for production systems!
|
||||
*
|
||||
* Revision 1.20 1999/09/19 14:16:27 akool
|
||||
* isdnlog-3.53
|
||||
*
|
||||
|
@ -95,7 +100,11 @@
|
|||
#include "isdnlog.h"
|
||||
#include "tools/zone.h"
|
||||
#include <unistd.h>
|
||||
#ifdef USE_DESTINATION
|
||||
#include "dest.h"
|
||||
#else
|
||||
#include "telnum.h"
|
||||
#endif
|
||||
|
||||
#define WIDTH 19
|
||||
#define _MAXLAST 20 /* the real max */
|
||||
|
@ -105,7 +114,7 @@
|
|||
static void print_header(void);
|
||||
|
||||
static char *myname, *myshortname;
|
||||
static char options[] = "b:d:f:h:l:p:t:v::x:CD::G:HLS:TUVX::";
|
||||
static char options[] = "b:d:f:h:l:p:t:v::x:CD::G:HLNS:TUVX::";
|
||||
static char usage[] = "%s: usage: %s [ -%s ] Destination ...\n";
|
||||
|
||||
static int header = 0, best = MAXPROVIDER, table = 0,
|
||||
|
@ -190,9 +199,11 @@ static void init()
|
|||
|
||||
if (verbose && *version)
|
||||
print_msg(PRT_V, "%s\n", version);
|
||||
|
||||
#ifdef USE_DESTINATION
|
||||
initDest(destfile, message);
|
||||
#else
|
||||
initCountry(countryfile, message);
|
||||
|
||||
#endif
|
||||
if (verbose && *version)
|
||||
print_msg(PRT_V, "%s\n", version);
|
||||
|
||||
|
@ -207,7 +218,11 @@ static void init()
|
|||
static void deinit(void)
|
||||
{
|
||||
exitRate();
|
||||
#ifdef USE_DESTINATION
|
||||
exitDest();
|
||||
#else
|
||||
exitCountry();
|
||||
#endif
|
||||
exitHoliday();
|
||||
}
|
||||
/* calc a day/time W | E | H */
|
||||
|
@ -404,6 +419,9 @@ static int opts(int argc, char *argv[])
|
|||
list++;
|
||||
explain = 9;
|
||||
break;
|
||||
case 'N':
|
||||
explain = 55;
|
||||
break;
|
||||
case 'S':
|
||||
sortby = *optarg;
|
||||
break;
|
||||
|
@ -579,7 +597,7 @@ static char *Provider(int prefix)
|
|||
|
||||
l = max(WIDTH, strlen(p)) - strlen(p);
|
||||
|
||||
p1 = prefix2provider(prefix, prov, &destnum);
|
||||
p1 = prefix2provider(prefix, prov);
|
||||
|
||||
l += (6 - strlen(p1));
|
||||
|
||||
|
@ -618,7 +636,6 @@ static int compute(char *num)
|
|||
auto char s[BUFSIZ];
|
||||
struct tm *tm;
|
||||
char prov[TN_MAX_PROVIDER_LEN];
|
||||
int oldprov;
|
||||
int first = 1;
|
||||
static char BUSINESS[] = "Business"; /* in C:GT:Tag */
|
||||
|
||||
|
@ -688,20 +705,25 @@ static int compute(char *num)
|
|||
continue;
|
||||
}
|
||||
clearRate(&Rate);
|
||||
#ifdef USE_DESTINATION
|
||||
Rate.src[0] = srcnum.country;
|
||||
#else
|
||||
Rate.src[0] = srcnum.country ? srcnum.country->Code[0] : "";
|
||||
#endif
|
||||
Rate.src[1] = srcnum.area;
|
||||
Rate.src[2] = "";
|
||||
|
||||
oldprov = destnum.nprovider;
|
||||
if (destnum.nprovider == UNKNOWN)
|
||||
destnum.nprovider = i;
|
||||
if (normalizeNumber(num, &destnum, TN_ALL) == UNKNOWN) {
|
||||
destnum.nprovider = oldprov;
|
||||
destnum.nprovider = i;
|
||||
Strncpy(destnum.provider,getProvider(i),TN_MAX_PROVIDER_LEN);
|
||||
if (normalizeNumber(num, &destnum, TN_NO_PROVIDER) == UNKNOWN) {
|
||||
continue;
|
||||
}
|
||||
destnum.nprovider = oldprov;
|
||||
|
||||
#ifdef USE_DESTINATION
|
||||
Rate.dst[0] = destnum.country;
|
||||
#else
|
||||
Rate.dst[0] = destnum.country ? destnum.country->Code[0] : "";
|
||||
#endif
|
||||
Rate.dst[1] = destnum.area;
|
||||
Rate.dst[2] = destnum.msn;
|
||||
print_msg(PRT_V, "Rate dst0='%s' dst1='%s' dst2='%s'\n", Rate.dst[0], Rate.dst[1], Rate.dst[2]);
|
||||
|
@ -718,7 +740,7 @@ static int compute(char *num)
|
|||
if (first && header)
|
||||
print_header();
|
||||
first = 0;
|
||||
printf("@ %s\n", prefix2provider(Rate.prefix, prov, &destnum));
|
||||
printf("@ %s\n", prefix2provider(Rate.prefix, prov));
|
||||
Rate.now = start + 1;
|
||||
for (j = 1; j < duration; j++) {
|
||||
if (!getRate(&Rate, NULL) && (Rate.Price != 99.99)) {
|
||||
|
@ -741,7 +763,7 @@ static int compute(char *num)
|
|||
if (first && header)
|
||||
print_header();
|
||||
first = 0;
|
||||
printf("@ %s\n", prefix2provider(Rate.prefix, prov, &destnum));
|
||||
printf("@ %s\n", prefix2provider(Rate.prefix, prov));
|
||||
for (j = 0; j < (explain == 98 ? 7 * 24 : 24); j++) {
|
||||
if (!getRate(&Rate, NULL) && (Rate.Price != 99.99)) {
|
||||
printf("%d %.4f\n", j, Rate.Charge);
|
||||
|
@ -760,7 +782,7 @@ static int compute(char *num)
|
|||
double cpm = Rate.Duration > 0 ? 60 * Rate.Price / Rate.Duration : 99.99;
|
||||
fi=0;
|
||||
if (Rate.Price != 99.99)
|
||||
printf("%s%c%s%c%s%c%.2f%c%.2f%c%s\n", prefix2provider(Rate.prefix, prov, &destnum), DEL,
|
||||
printf("%s%c%s%c%s%c%.2f%c%.2f%c%s\n", prefix2provider(Rate.prefix, prov), DEL,
|
||||
Rate.Provider,DEL,currency,DEL,Rate.Charge,DEL,cpm,DEL,
|
||||
P_EMPTY(Rate.Country));
|
||||
free(Rate.Country);
|
||||
|
@ -795,7 +817,7 @@ static int compute(char *num)
|
|||
"%s%c"
|
||||
"%.3f%c%.4f%c%.4f%c%.2f%c%.3f%c"
|
||||
"%s%c%.2f",
|
||||
prefix2provider(Rate.prefix, prov, &destnum), DEL,
|
||||
prefix2provider(Rate.prefix, prov), DEL,
|
||||
Rate.Provider, DEL, P_EMPTY(Rate.Zone), DEL, P_EMPTY(Rate.Day), DEL, P_EMPTY(Rate.Hour), DEL,
|
||||
currency, DEL, /* Fixme: global or per
|
||||
Provider?? wg. EURO */
|
||||
|
@ -1136,7 +1158,8 @@ static void viacode(char *target, TELNUM *destnum)
|
|||
static void doit(int i, int argc, char *argv[])
|
||||
{
|
||||
int n;
|
||||
|
||||
int prefix;
|
||||
|
||||
post_init();
|
||||
memset(ignore, 0, sizeof(ignore));
|
||||
if (!need_dest && i==0) {
|
||||
|
@ -1144,8 +1167,21 @@ static void doit(int i, int argc, char *argv[])
|
|||
argv[0]="2345";
|
||||
}
|
||||
while (i < argc) {
|
||||
if (explain == 55) {
|
||||
if(n_providers) {
|
||||
destnum.nprovider=providers[0];
|
||||
Strncpy(destnum.provider,getProvider(providers[0]),TN_MAX_PROVIDER_LEN);
|
||||
normalizeNumber(argv[i], &destnum, TN_NO_PROVIDER);
|
||||
}
|
||||
else
|
||||
normalizeNumber(argv[i], &destnum, TN_ALL);
|
||||
printf("%s => %s \n",argv[i],formatNumber("%l - %p",&destnum));
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
destnum.nprovider = UNKNOWN;
|
||||
normalizeNumber(argv[i], &destnum, TN_PROVIDER);
|
||||
if(provider2prefix(argv[i], &prefix)) /* set provider if it is in number */
|
||||
normalizeNumber(argv[i], &destnum, TN_PROVIDER);
|
||||
#if 0
|
||||
if (isalpha(*destnum.msn))
|
||||
viacode(argv[i], &destnum);
|
||||
|
@ -1450,6 +1486,7 @@ int main(int argc, char *argv[], char *envp[])
|
|||
print_msg(PRT_A, "\t-G which\tshow raw data\n");
|
||||
print_msg(PRT_A, "\t-H\tshow a header\n");
|
||||
print_msg(PRT_A, "\t-L\tshow a detailed list\n");
|
||||
print_msg(PRT_A, "\t-N\tparse the given telefon numbers\n");
|
||||
print_msg(PRT_A, "\t-S[v|n]\tsort by v=VBN, n=Name, default=Charge\n");
|
||||
print_msg(PRT_A, "\t-T\tshow a table of day/night week/weekend\n");
|
||||
print_msg(PRT_A, "\t-U\tshow usage stats for table\n");
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
/* $Id: rate.c,v 1.49 1999/10/22 19:57:59 akool Exp $
|
||||
/* $Id: rate.c,v 1.50 1999/10/25 18:30:03 akool Exp $
|
||||
*
|
||||
* Tarifdatenbank
|
||||
*
|
||||
|
@ -19,6 +19,11 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: rate.c,v $
|
||||
* Revision 1.50 1999/10/25 18:30:03 akool
|
||||
* isdnlog-3.57
|
||||
* WARNING: Experimental version!
|
||||
* Please use isdnlog-3.56 for production systems!
|
||||
*
|
||||
* Revision 1.49 1999/10/22 19:57:59 akool
|
||||
* isdnlog-3.56 (for Karsten)
|
||||
*
|
||||
|
@ -367,7 +372,11 @@ extern const char *basename (const char *name);
|
|||
|
||||
#include "holiday.h"
|
||||
#include "zone.h"
|
||||
#include "country.h"
|
||||
#ifdef USE_DESTINATION
|
||||
#include "dest.h"
|
||||
#else
|
||||
#include "telnum.h"
|
||||
#endif
|
||||
#include "rate.h"
|
||||
|
||||
#define LENGTH 1024 /* max length of lines in data file */
|
||||
|
@ -461,7 +470,7 @@ static void notice (char *fmt, ...)
|
|||
#ifdef STANDALONE
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
#else
|
||||
print_msg(PRT_ERR, "%s\n", msg);
|
||||
print_msg(PRT_NORMAL, "%s\n", msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -473,7 +482,26 @@ static void warning (char *file, char *fmt, ...)
|
|||
va_start (ap, fmt);
|
||||
vsnprintf (msg, BUFSIZ, fmt, ap);
|
||||
va_end (ap);
|
||||
notice ("WARNING: %s line %3d: %s", basename(file), line, msg);
|
||||
#ifdef STANDALONE
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
#else
|
||||
print_msg(PRT_WARN, "%s\n", msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void error (char *file, char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char msg[BUFSIZ];
|
||||
|
||||
va_start (ap, fmt);
|
||||
vsnprintf (msg, BUFSIZ, fmt, ap);
|
||||
va_end (ap);
|
||||
#ifdef STANDALONE
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
#else
|
||||
print_msg(PRT_ERR, "%s\n", msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void whimper (char *file, char *fmt, ...)
|
||||
|
@ -626,7 +654,10 @@ int initRate(char *conf, char *dat, char *dom, char **msg)
|
|||
{
|
||||
static char message[LENGTH];
|
||||
FILE *stream;
|
||||
#ifndef USE_DESTINATION
|
||||
COUNTRY *Country;
|
||||
int d;
|
||||
#endif
|
||||
bitfield day, hour;
|
||||
double price, divider, duration;
|
||||
char buffer[LENGTH], path[LENGTH], Version[LENGTH]="";
|
||||
|
@ -636,7 +667,7 @@ int initRate(char *conf, char *dat, char *dom, char **msg)
|
|||
int ignore=0, where=0, prefix=UNKNOWN;
|
||||
int zone, zone1, zone2, day1, day2, hour1, hour2, freeze, delay;
|
||||
int *number, numbers;
|
||||
int d, i, n, t, u, v, z;
|
||||
int i, n, t, u, v, z;
|
||||
|
||||
|
||||
if (msg)
|
||||
|
@ -854,7 +885,7 @@ int initRate(char *conf, char *dat, char *dom, char **msg)
|
|||
if (initZone(prefix, path, &c)==0) {
|
||||
if (msg && *c) notice ("%s", c);
|
||||
} else {
|
||||
warning (dat, c);
|
||||
error (dat, c);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -959,6 +990,7 @@ int initRate(char *conf, char *dat, char *dom, char **msg)
|
|||
s+=2;
|
||||
while(1) {
|
||||
if (*(c=strip(str2list(&s)))) {
|
||||
#ifndef USE_DESTINATION
|
||||
if (!isdigit(*c) && (d=getCountry(c, &Country)) != UNKNOWN) {
|
||||
if (*c=='+') {
|
||||
Areas += appendArea (prefix, c, Country->Name, zone, &where, dat);
|
||||
|
@ -971,9 +1003,13 @@ int initRate(char *conf, char *dat, char *dom, char **msg)
|
|||
Areas += appendArea (prefix, Country->Code[i], Country->Name, zone, &where, dat);
|
||||
}
|
||||
} else { /* unknown country or Sondernummer */
|
||||
#endif
|
||||
/* append areas as they are -lt- */
|
||||
Areas += appendArea (prefix, c, NULL, zone, &where, dat);
|
||||
Specials++;
|
||||
#ifndef USE_DESTINATION
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
warning (dat, "Ignoring empty areacode");
|
||||
}
|
||||
|
@ -1310,15 +1346,12 @@ char *getProvider (int prefix)
|
|||
{
|
||||
static char s[BUFSIZ];
|
||||
|
||||
|
||||
if (prefix<0 || prefix>=nProvider || !Provider[prefix].used) {
|
||||
if (prefix < 100)
|
||||
sprintf(s, "%s%02d ???", vbn, prefix);
|
||||
else
|
||||
sprintf(s, "%s%03d ???", vbn, prefix - 100);
|
||||
|
||||
return(s);
|
||||
}
|
||||
if (prefix<0 || prefix>=nProvider || !Provider[prefix].used ||
|
||||
!Provider[prefix].Name || !*Provider[prefix].Name) {
|
||||
prefix2provider(prefix, s);
|
||||
strcat(s," ???");
|
||||
return s;
|
||||
}
|
||||
return Provider[prefix].Name;
|
||||
}
|
||||
|
||||
|
@ -1399,13 +1432,37 @@ int getRate(RATE *Rate, char **msg)
|
|||
|
||||
if (Rate->_area==UNKNOWN) {
|
||||
int a, x=0;
|
||||
TELNUM num;
|
||||
char *number=strcat3(Rate->dst);
|
||||
for (a=0; a<Provider[prefix].nArea; a++) {
|
||||
int m=strmatch(Provider[prefix].Area[a].Code, number);
|
||||
if (m>x) {
|
||||
x=m;
|
||||
Rate->_area = a;
|
||||
Rate->domestic = strcmp(Provider[prefix].Area[a].Code, mycountry)==0 || *(Rate->dst[0])=='\0';
|
||||
if (*Rate->dst[0] && getDest(number, &num) == 0 && num.keys && *num.keys) {
|
||||
char *p;
|
||||
#if 0
|
||||
printf("%s(%d) %s(%s) %s - %s\n",
|
||||
num.country, num.ncountry, num.sarea, num.area,
|
||||
num.msn, num.keys);
|
||||
#endif
|
||||
p=strtok(num.keys, "/");
|
||||
while (p) {
|
||||
for (a=0; a<Provider[prefix].nArea; a++) {
|
||||
if (strcmp(Provider[prefix].Area[a].Code, p)==0) {
|
||||
Rate->_area=a;
|
||||
Rate->domestic=atoi(mycountry+1)==num.ncountry;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(Rate->_area!=UNKNOWN)
|
||||
break;
|
||||
p=strtok(0, "/");
|
||||
}
|
||||
}
|
||||
if (Rate->_area==UNKNOWN) {
|
||||
for (a=0; a<Provider[prefix].nArea; a++) {
|
||||
int m=strmatch(Provider[prefix].Area[a].Code, number);
|
||||
if (m>x) {
|
||||
x=m;
|
||||
Rate->_area = a;
|
||||
Rate->domestic = strcmp(Provider[prefix].Area[a].Code, mycountry)==0 || *(Rate->dst[0])=='\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Rate->_area==UNKNOWN) {
|
||||
|
@ -1667,11 +1724,9 @@ char *explainRate (RATE *Rate)
|
|||
static char buffer[BUFSIZ];
|
||||
char *p=buffer;
|
||||
|
||||
if (Rate->Provider && *Rate->Provider)
|
||||
p+=sprintf (p, "%s", Rate->Provider);
|
||||
else
|
||||
p+=sprintf (p, "%s%02d", vbn, Rate->prefix);
|
||||
|
||||
strcpy(p, getProvider(Rate->prefix));
|
||||
p += strlen(p);
|
||||
|
||||
if (Rate->Zone && *Rate->Zone)
|
||||
p+=sprintf (p, ", %s", Rate->Zone);
|
||||
else
|
||||
|
@ -1709,7 +1764,11 @@ void getNumber (char *s, char *num[3])
|
|||
num[2]=strsep(&s,"-");
|
||||
}
|
||||
|
||||
void main (int argc, char *argv[])
|
||||
/* char *vbn;
|
||||
char *mycountry;
|
||||
char *myarea; */
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
char *msg;
|
||||
|
@ -1717,12 +1776,20 @@ void main (int argc, char *argv[])
|
|||
|
||||
RATE Rate, LCR;
|
||||
|
||||
// vbn="01";
|
||||
myarea="02555";
|
||||
// mycountry="+43";
|
||||
initHoliday ("../holiday-at.dat", &msg);
|
||||
printf ("%s\n", msg);
|
||||
|
||||
#ifdef USE_DESTINATION
|
||||
initDest ("dest/dest.gdbm", &msg);
|
||||
printf ("%s\n", msg);
|
||||
initTelnum();
|
||||
#else
|
||||
initCountry ("../country-de.dat", &msg);
|
||||
printf ("%s\n", msg);
|
||||
|
||||
#endif
|
||||
initRate ("/etc/isdn/rate.conf", "../rate-at.dat", "../zone-at-%s.gdbm", &msg);
|
||||
printf ("%s\n", msg);
|
||||
|
||||
|
@ -1849,5 +1916,6 @@ void main (int argc, char *argv[])
|
|||
sleep(1);
|
||||
}
|
||||
#endif
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -51,12 +51,14 @@
|
|||
* %Np .. Provider
|
||||
* %Nc .. country +49
|
||||
* %NC .. countryname
|
||||
* %Nt .. tld = 2 char isdcode for country
|
||||
* %Na .. area 89 or 089 if no country/Provider
|
||||
* %NA .. areaname
|
||||
* %Nm .. msn
|
||||
* %f .. full +49 89 12356 (Deutschland, Berlin)
|
||||
* %f .. full +49 89 12356 (Deutschland, Berlin)
|
||||
* %F .. full +49 89/12345, Berlin
|
||||
* %s .. short +48 89 123456
|
||||
* %l .. long +49 89 12356 - Berlin (DE)
|
||||
* %n .. number 004889123456
|
||||
*
|
||||
* N is number of chars to skip in format if part is not present
|
||||
|
@ -65,11 +67,11 @@
|
|||
* 123 => "123" not " 123"
|
||||
*
|
||||
*
|
||||
* char* prefix2provider(int prefix, char* provider, TELNUM *num)
|
||||
* char* prefix2provider(int prefix, char* provider)
|
||||
* --------------------------------------------------------------
|
||||
* returns formatted provider for prefix
|
||||
*
|
||||
* int provider2prefix(char* provider, int*prefix, TELNUM *num)
|
||||
* int provider2prefix(char* provider, int*prefix)
|
||||
* ------------------------------------------------------------
|
||||
* ret len of provider
|
||||
*
|
||||
|
@ -84,60 +86,46 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef USE_DESTINATION
|
||||
#include "dest.h"
|
||||
#else
|
||||
#include "telnum.h"
|
||||
#endif
|
||||
|
||||
#define DEFAULT (UNKNOWN-1)
|
||||
|
||||
#undef DEBUG
|
||||
/* #define DEBUG 1 */
|
||||
|
||||
static TELNUM defnum;
|
||||
|
||||
static void error (char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char msg[BUFSIZ];
|
||||
|
||||
va_start (ap, fmt);
|
||||
vsnprintf (msg, BUFSIZ, fmt, ap);
|
||||
va_end (ap);
|
||||
#ifdef STANDALONE
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
#else
|
||||
print_msg(PRT_ERR, "%s\n", msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void _init(void);
|
||||
|
||||
#ifdef TESTde
|
||||
#undef ISDN_AT
|
||||
#define ISDN_DE
|
||||
#endif
|
||||
#ifdef TESTnl
|
||||
#undef ISDN_AT
|
||||
#define ISDN_NL
|
||||
#endif
|
||||
|
||||
/* --------------------- ADJUST here ----------------*/
|
||||
#ifdef ISDN_AT
|
||||
void initTelNum(void)
|
||||
{
|
||||
vbn = strdup("10"); /* Fixme: VBN is defined in isdn.conf but not read yet */
|
||||
preselect=1;
|
||||
#define VBN_LEN 2 /* len of digits following vbn */
|
||||
#define VBN_GERMANY 0
|
||||
if(!vbn)
|
||||
vbn="";
|
||||
if (!vbnlen || !*vbnlen) {
|
||||
error("VBNLEN not defined.\n\tPlease read isdnlog/README\n");
|
||||
exit(1);
|
||||
}
|
||||
_init();
|
||||
} /* pre_init */
|
||||
#endif
|
||||
|
||||
#ifdef ISDN_DE
|
||||
void initTelNum(void)
|
||||
{
|
||||
vbn = strdup("010"); /* Fixme: VBN is defined in isdn.conf but not read yet */
|
||||
preselect=33;
|
||||
#define VBN_LEN 2
|
||||
#define VBN_GERMANY 1 /* vbn[3] == '0' => 3 stellig folgt */
|
||||
_init();
|
||||
} /* pre_init */
|
||||
#endif
|
||||
|
||||
#ifdef ISDN_NL
|
||||
void initTelNum()
|
||||
{
|
||||
vbn = strdup("16:17"); /* Fixme: VBN is defined in isdn.conf but not read yet */
|
||||
preselect=999;
|
||||
#define VBN_LEN 2 /* Paul: ? is this correct */
|
||||
#define VBN_GERMANY 0
|
||||
_init();
|
||||
} /* pre_init */
|
||||
#endif
|
||||
|
||||
/* ----------------- end ADJUST here ----------------*/
|
||||
|
||||
static inline int Isspace(c) {
|
||||
return isspace(c) || c == '_';
|
||||
|
@ -146,26 +134,26 @@ static inline int Isspace(c) {
|
|||
static int split_vbn(char **p, TELNUM *num) {
|
||||
int l;
|
||||
|
||||
#if DEBUG
|
||||
print_msg(PRT_V, "vbn: p(%d) '%s' ", num->nprovider,*p);
|
||||
#endif
|
||||
if ((l = provider2prefix(*p, &num->nprovider, num))) {
|
||||
if ((l = provider2prefix(*p, &num->nprovider))) {
|
||||
Strncpy(num->provider, *p, l+1);
|
||||
*p += l;
|
||||
#if DEBUG
|
||||
print_msg(PRT_V, "Provider \"%s\" %d\n", num->provider, num->nprovider);
|
||||
#endif
|
||||
return l;
|
||||
}
|
||||
#if DEBUG
|
||||
print_msg(PRT_V, "No Provider\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void clearArea(TELNUM *num, int a) {
|
||||
strcpy(num->area,a==DEFAULT?defnum.area:"");
|
||||
strcpy(num->sarea,a==DEFAULT?defnum.sarea:"?");
|
||||
num->narea= a==DEFAULT?defnum.narea:a;
|
||||
}
|
||||
|
||||
#ifndef USE_DESTINATION
|
||||
static inline void clearCountry(TELNUM *num, int c) {
|
||||
num->country=0;
|
||||
num->ncountry=c;
|
||||
}
|
||||
|
||||
static inline void setCountry(TELNUM *num) {
|
||||
num->country=defnum.country;
|
||||
num->ncountry=defnum.ncountry;
|
||||
|
@ -269,11 +257,6 @@ static int split_country(char **p, TELNUM *num) {
|
|||
return res+len;
|
||||
}
|
||||
|
||||
static void clearArea(TELNUM *num, int a) {
|
||||
strcpy(num->area,a==DEFAULT?defnum.area:"");
|
||||
strcpy(num->sarea,a==DEFAULT?defnum.sarea:"?");
|
||||
num->narea= a==DEFAULT?defnum.narea:a;
|
||||
}
|
||||
|
||||
static int split_area(char **p, TELNUM *num, int first) {
|
||||
int res=0;
|
||||
|
@ -315,6 +298,84 @@ static int split_area(char **p, TELNUM *num, int first) {
|
|||
return res+len;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_DESTINATION
|
||||
|
||||
static inline void clearCountry(TELNUM *num, int c) {
|
||||
*num->scountry='\0';
|
||||
*num->country='\0';
|
||||
num->ncountry=c;
|
||||
}
|
||||
|
||||
int normalizeNumber(char *target, TELNUM *num, int flag) {
|
||||
char *origp=strdup(target);
|
||||
char *p=origp;
|
||||
int res=0;
|
||||
char *q;
|
||||
|
||||
clearNum(num);
|
||||
#if DEBUG
|
||||
print_msg(PRT_V,"NN %s (Prov %d)=> ",target, num->nprovider);
|
||||
#endif
|
||||
if (flag & TN_PROVIDER)
|
||||
if (!split_vbn(&p, num)) {
|
||||
num->nprovider=preselect;
|
||||
Strncpy(num->provider, getProvider(preselect),TN_MAX_PROVIDER_LEN);
|
||||
}
|
||||
if (flag & TN_COUNTRY) {
|
||||
/* subst '00' => '+' */
|
||||
if (p[0]=='0' && p[1]=='0')
|
||||
*++p='+';
|
||||
if(!isdigit(*p)) {
|
||||
res=getDest(p, num);
|
||||
/* isdnrate is coming with +4319430 but this is a sondernummer */
|
||||
if (atoi(mycountry+1) == num->ncountry) {
|
||||
q = malloc(strlen(num->area)+strlen(num->msn)+1);
|
||||
strcpy(q, num->area);
|
||||
strcat(q, num->msn);
|
||||
if(getArea(num->nprovider, q)) { /* sondernummer */
|
||||
clearCountry(num, 0);
|
||||
*num->sarea='\0';
|
||||
Strncpy(num->area, q, TN_MAX_AREA_LEN);
|
||||
num->narea=atoi(num->area);
|
||||
*num->msn = '\0';
|
||||
}
|
||||
free(q);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(getArea(num->nprovider, p)) { /* sondernummer */
|
||||
clearCountry(num, 0);
|
||||
*num->sarea='\0';
|
||||
Strncpy(num->area, p, TN_MAX_AREA_LEN);
|
||||
num->narea=atoi(num->area);
|
||||
*num->msn = '\0';
|
||||
}
|
||||
else {
|
||||
clearArea(num,DEFAULT);
|
||||
if (*p == '0') { /* must be distant call in country */
|
||||
q = malloc(strlen(mycountry)+strlen(p));
|
||||
strcpy(q, mycountry);
|
||||
strcat(q, p+1);
|
||||
free(origp);
|
||||
origp=p=q;
|
||||
res=getDest(p, num);
|
||||
}
|
||||
else
|
||||
Strncpy(num->msn, p, TN_MAX_MSN_LEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
free(origp);
|
||||
#if DEBUG
|
||||
print_msg(PRT_V,"(%d) %s\n",res,formatNumber("%l Prov %p",num));
|
||||
#endif
|
||||
return(res);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int normalizeNumber(char *target, TELNUM *num, int flag) {
|
||||
int res=0;
|
||||
int first=0;
|
||||
|
@ -343,16 +404,18 @@ int normalizeNumber(char *target, TELNUM *num, int flag) {
|
|||
return 1;
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
char *prefix2provider(int prefix, char*s, TELNUM *num) {
|
||||
#define VBN_LEN (*vbnlen-'0')
|
||||
char *prefix2provider(int prefix, char*s) {
|
||||
if (prefix < 100)
|
||||
sprintf(s, "%s%0*d", num->vbn, VBN_LEN, prefix);
|
||||
sprintf(s, "%s%0*d", defnum.vbn, VBN_LEN, prefix);
|
||||
else
|
||||
sprintf(s, "%s%03d", num->vbn, prefix - 100);
|
||||
sprintf(s, "%s%03d", defnum.vbn, prefix - 100);
|
||||
return s;
|
||||
}
|
||||
|
||||
int provider2prefix(char *p, int *prefix, TELNUM *num) {
|
||||
int provider2prefix(char *p, int *prefix) {
|
||||
char prov[TN_MAX_PROVIDER_LEN];
|
||||
int l1, l2=0;
|
||||
char *q;
|
||||
|
@ -361,11 +424,11 @@ int provider2prefix(char *p, int *prefix, TELNUM *num) {
|
|||
while (q) {
|
||||
l1=strlen(vbns);
|
||||
if (!memcmp(p, q, l1)) {
|
||||
Strncpy(num->vbn, q, TN_MAX_VBN_LEN);
|
||||
/* Strncpy(num->vbn, q, TN_MAX_VBN_LEN); */
|
||||
#if DEBUG
|
||||
print_msg(PRT_V, "VBN \"%s\"\n", q);
|
||||
#endif
|
||||
if (p[l1] == '0' && VBN_GERMANY) /* dreistellige Verbindungsnetzbetreiberkennzahl? */
|
||||
if (p[l1] == '0' && strchr(vbnlen,':')) /* dreistellige Verbindungsnetzbetreiberkennzahl? */
|
||||
l2 = l1 + 3; /* 1002 is provider UTA in AT */
|
||||
else
|
||||
l2 = l1 + VBN_LEN;
|
||||
|
@ -383,8 +446,18 @@ void initNum(TELNUM *num) {
|
|||
char *s;
|
||||
if(!*num->area)
|
||||
Strncpy(num->area, myarea, TN_MAX_AREA_LEN);
|
||||
num->country=defnum.country;
|
||||
num->ncountry=defnum.ncountry;
|
||||
#ifdef USE_DESTINATION
|
||||
strcpy(num->scountry,defnum.scountry);
|
||||
strcpy(num->country,defnum.country);
|
||||
num->narea=atoi(num->area); /* 1.01 */
|
||||
s=malloc(strlen(mycountry)+strlen(num->area)+1);
|
||||
strcpy(s,mycountry);
|
||||
strcat(s,num->area);
|
||||
getDest(s, num);
|
||||
free(s);
|
||||
#else
|
||||
num->country=defnum.country;
|
||||
num->narea=atoi(num->area);
|
||||
if (getAreacode(num->ncountry, num->area, &s) != UNKNOWN) {
|
||||
Strncpy(num->sarea, s, TN_MAX_SAREA_LEN);
|
||||
|
@ -392,6 +465,7 @@ void initNum(TELNUM *num) {
|
|||
}
|
||||
else
|
||||
clearArea(num, UNKNOWN);
|
||||
#endif
|
||||
strcpy(num->vbn, defnum.vbn);
|
||||
}
|
||||
|
||||
|
@ -399,6 +473,12 @@ static void _init(void) {
|
|||
char *s;
|
||||
clearNum(&defnum);
|
||||
Strncpy(defnum.area, myarea, TN_MAX_AREA_LEN);
|
||||
#ifdef USE_DESTINATION
|
||||
s=malloc(strlen(mycountry)+strlen(myarea)+1);
|
||||
strcpy(s,mycountry);
|
||||
strcat(s,myarea);
|
||||
getDest(s, &defnum);
|
||||
#else
|
||||
if (getCountry(mycountry, &defnum.country) != UNKNOWN) {
|
||||
defnum.ncountry=atoi(defnum.country->Code[0]+1);
|
||||
if (getAreacode(defnum.ncountry, defnum.area, &s) != UNKNOWN) {
|
||||
|
@ -406,12 +486,13 @@ static void _init(void) {
|
|||
free(s);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Strncpy(defnum.vbn, vbn, TN_MAX_VBN_LEN);
|
||||
}
|
||||
|
||||
void clearNum(TELNUM *num) {
|
||||
strcpy(num->provider,"");
|
||||
/* num->nprovider=preselect; */
|
||||
/* num->nprovider=UNKNOWN;
|
||||
strcpy(num->provider,""); */
|
||||
strcpy(num->area,"");
|
||||
initNum(num);
|
||||
strcpy(num->msn,"");
|
||||
|
@ -428,7 +509,7 @@ void clearNum(TELNUM *num) {
|
|||
* %n .. number 004889123456
|
||||
* N is number of chars to skip in format if part is not present
|
||||
* e.g. "%1c %1a %m"
|
||||
* +4930123 => "+49 39 123"
|
||||
* +4930123 => "+49 30 123"
|
||||
* 123 => "123" not " 123"
|
||||
*/
|
||||
#define SKIP if(skip>0) \
|
||||
|
@ -458,28 +539,43 @@ again:
|
|||
break;
|
||||
case 'c':
|
||||
if(num->ncountry>0 && num->country) {
|
||||
#ifdef USE_DESTINATION
|
||||
q=stpcpy(q,num->country);
|
||||
#else
|
||||
q=stpcpy(q, num->country->Code[0]);
|
||||
#endif
|
||||
first=0;
|
||||
}
|
||||
else
|
||||
SKIP;
|
||||
break;
|
||||
case 'C':
|
||||
#ifdef USE_DESTINATION
|
||||
if(num->ncountry>0)
|
||||
q=stpcpy(q, num->scountry);
|
||||
#else
|
||||
if(num->ncountry>0 && num->country)
|
||||
q=stpcpy(q, num->country->Name);
|
||||
#endif
|
||||
else
|
||||
SKIP;
|
||||
break;
|
||||
case 't': /* tld */
|
||||
if(*num->tld)
|
||||
q=stpcpy(q, num->tld);
|
||||
else
|
||||
SKIP;
|
||||
break;
|
||||
case 'a':
|
||||
if(num->narea>0) {
|
||||
if(first) *q++ = '0'; /* areaprefix ?? */
|
||||
/* if(first) *q++ = '0'; / sondernummber - no country */
|
||||
q=stpcpy(q,num->area);
|
||||
}
|
||||
else
|
||||
SKIP;
|
||||
break;
|
||||
case 'A':
|
||||
if(num->narea>0)
|
||||
if(*num->sarea)
|
||||
q=stpcpy(q,num->sarea);
|
||||
else
|
||||
SKIP;
|
||||
|
@ -499,8 +595,9 @@ again:
|
|||
break;
|
||||
|
||||
case 's': q=stpcpy(q,formatNumber("%1c %1a %m", num)); break;
|
||||
case 'l': q=stpcpy(q,formatNumber("%1c %1a %1m - %1A (%t)", num)); break;
|
||||
case 'n':
|
||||
if(num->ncountry>0 && num->country) {
|
||||
if(num->ncountry>0) {
|
||||
q=stpcpy(r=++q,formatNumber("%c%a%m", num));
|
||||
r[0]=r[1]='0';
|
||||
}
|
||||
|
@ -522,3 +619,68 @@ again:
|
|||
return s;
|
||||
}
|
||||
|
||||
#ifdef TEST_TELNUM
|
||||
int verbose=0;
|
||||
static char *myshortname;
|
||||
|
||||
static void init()
|
||||
{
|
||||
auto char *version, **message;
|
||||
|
||||
if (readconfig(myshortname) < 0)
|
||||
exit(1);
|
||||
|
||||
if (verbose)
|
||||
message = &version;
|
||||
else
|
||||
message = NULL;
|
||||
|
||||
initHoliday(holifile, message);
|
||||
|
||||
if (verbose && *version)
|
||||
print_msg(PRT_V, "%s\n", version);
|
||||
#ifdef USE_DESTINATION
|
||||
initDest("/usr/lib/isdn/dest.gdbm", message); /* Fixme: */
|
||||
#else
|
||||
initCountry(countryfile, message);
|
||||
#endif
|
||||
if (verbose && *version)
|
||||
print_msg(PRT_V, "%s\n", version);
|
||||
|
||||
initRate(rateconf, ratefile, zonefile, message);
|
||||
|
||||
if (verbose && *version)
|
||||
print_msg(PRT_V, "%s\n", version);
|
||||
|
||||
initTelNum();
|
||||
} /* init */
|
||||
|
||||
static void deinit(void)
|
||||
{
|
||||
exitRate();
|
||||
#ifdef USE_DESTINATION
|
||||
exitDest();
|
||||
#else
|
||||
exitCountry();
|
||||
#endif
|
||||
exitHoliday();
|
||||
}
|
||||
int main(int argc, char *argv[], char *envp[])
|
||||
{
|
||||
register int i;
|
||||
TELNUM num;
|
||||
myname = argv[0];
|
||||
myshortname = basename(myname);
|
||||
|
||||
if(argc>1) {
|
||||
init();
|
||||
i = argc-1;
|
||||
argc++;
|
||||
while (i--) {
|
||||
normalizeNumber(argv[argc], &num);
|
||||
printf("%s => %s\n",argv[argc++], formatNumber("%l", &num);
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -3,8 +3,10 @@
|
|||
*/
|
||||
#ifndef _TELNUM_H_
|
||||
#define _TELNUM_H_
|
||||
#ifndef STANDALONE
|
||||
#include "isdnlog.h"
|
||||
#include "tools/zone.h"
|
||||
#endif
|
||||
|
||||
/* print_msg */
|
||||
#define PRT_V 17 /* verbose */
|
||||
|
@ -15,21 +17,31 @@
|
|||
#define TN_MAX_VBN_LEN 4
|
||||
#define TN_MAX_PROVIDER_LEN 8
|
||||
#define TN_MAX_COUNTRY_LEN 8
|
||||
#define TN_MAX_SCOUNTRY_LEN 40
|
||||
#define TN_MAX_COUNTRY_LEN 8
|
||||
#define TN_MAX_AREA_LEN 10
|
||||
#define TN_MAX_SAREA_LEN 40
|
||||
#define TN_MAX_MSN_LEN 10
|
||||
#define TN_MAX_NUM_LEN (TN_MAX_PROVIDER_LEN+TN_MAX_COUNTRY_LEN+TN_MAX_AREA_LEN+TN_MAX_MSN_LEN+4)
|
||||
|
||||
/* for number 1002 0043 1 2345 or 1002 01 2345 it gives */
|
||||
typedef struct {
|
||||
char vbn[TN_MAX_VBN_LEN];
|
||||
char provider[TN_MAX_PROVIDER_LEN];
|
||||
int nprovider;
|
||||
char vbn[TN_MAX_VBN_LEN]; /* "10" */
|
||||
char provider[TN_MAX_PROVIDER_LEN]; /* "UTA" */
|
||||
int nprovider; /* 2 */
|
||||
#ifdef USE_DESTINATION
|
||||
char scountry[TN_MAX_SCOUNTRY_LEN]; /* "Austria" */
|
||||
char country[TN_MAX_COUNTRY_LEN]; /* "+43" */
|
||||
char keys[TN_MAX_SCOUNTRY_LEN]; /* "VIA/AT" */
|
||||
char tld[3]; /* "AT" */
|
||||
#else
|
||||
COUNTRY *country;
|
||||
int ncountry;
|
||||
char area[TN_MAX_AREA_LEN];
|
||||
int narea;
|
||||
char sarea[TN_MAX_SAREA_LEN];
|
||||
char msn[TN_MAX_MSN_LEN];
|
||||
#endif
|
||||
int ncountry; /* 43 */
|
||||
char area[TN_MAX_AREA_LEN]; /* "1" */
|
||||
int narea; /* 1 */
|
||||
char sarea[TN_MAX_SAREA_LEN]; /* "Wien" */
|
||||
char msn[TN_MAX_MSN_LEN]; /* "2345" */
|
||||
} TELNUM;
|
||||
|
||||
/* flags */
|
||||
|
@ -44,8 +56,8 @@ typedef struct {
|
|||
void initTelNum(void);
|
||||
int normalizeNumber(char *target, TELNUM *num, int flag);
|
||||
char * formatNumber(char* format, TELNUM* num);
|
||||
char *prefix2provider(int prefix, char*prov, TELNUM *num);
|
||||
int provider2prefix(char *p, int *prefix, TELNUM *num);
|
||||
char *prefix2provider(int prefix, char*prov);
|
||||
int provider2prefix(char *p, int *prefix);
|
||||
void clearNum(TELNUM *num);
|
||||
void initNum(TELNUM *num);
|
||||
|
||||
|
|
|
@ -2084,7 +2084,7 @@ sub det {
|
|||
}
|
||||
nix:
|
||||
if ($what == 0) {
|
||||
$help=3;
|
||||
$help=1;
|
||||
print(p,hrg,p
|
||||
a({-href=>'javascript:history.back()'},'[ Zurück ]'));
|
||||
footer($pnum);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: tools.c,v 1.36 1999/09/19 14:16:27 akool Exp $
|
||||
/* $Id: tools.c,v 1.37 1999/10/25 18:30:03 akool Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux. (Utilities)
|
||||
*
|
||||
|
@ -19,6 +19,11 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: tools.c,v $
|
||||
* Revision 1.37 1999/10/25 18:30:03 akool
|
||||
* isdnlog-3.57
|
||||
* WARNING: Experimental version!
|
||||
* Please use isdnlog-3.56 for production systems!
|
||||
*
|
||||
* Revision 1.36 1999/09/19 14:16:27 akool
|
||||
* isdnlog-3.53
|
||||
*
|
||||
|
@ -717,12 +722,12 @@ char *vnum(int chan, int who)
|
|||
return(retstr[retnum]);
|
||||
}
|
||||
else {
|
||||
#ifndef USE_DESTINATION
|
||||
if (!memcmp(call[chan].num[who], countryprefix, strlen(countryprefix)) &&
|
||||
memcmp(call[chan].num[who], mycountry, strlen(mycountry))) { /* Ausland */
|
||||
register int i;
|
||||
auto char *s;
|
||||
|
||||
|
||||
if ((i = getCountrycode(call[chan].num[who], &s)) != UNKNOWN) {
|
||||
Strncpy(call[chan].areacode[who], call[chan].num[who], i + 1);
|
||||
strcpy(call[chan].rufnummer[who], call[chan].num[who] + i);
|
||||
|
@ -737,8 +742,10 @@ char *vnum(int chan, int who)
|
|||
return(retstr[retnum]);
|
||||
} /* if */
|
||||
} /* if */
|
||||
#endif
|
||||
|
||||
normalizeNumber(call[chan].num[who], &number, TN_ALL);
|
||||
/* Fixme: use number fields directly, no need to format a string -lt- */
|
||||
strcpy(s, formatNumber("%F", &number));
|
||||
|
||||
/* +49 6441/443431, Wetzlar */
|
||||
|
@ -943,19 +950,7 @@ int iprintf(char *obuf, int chan, register char *fmt, ...)
|
|||
} /* if */
|
||||
|
||||
if (c != '%') {
|
||||
if (c == '\\') {
|
||||
c = *fmt++;
|
||||
switch (c) {
|
||||
case 't':
|
||||
*op++ = '\t';
|
||||
break;
|
||||
default:
|
||||
*op++ = '\\';
|
||||
*op++ = c;
|
||||
}
|
||||
} else {
|
||||
*op++ = c;
|
||||
}
|
||||
*op++ = c;
|
||||
continue;
|
||||
} /* if */
|
||||
|
||||
|
@ -1134,7 +1129,7 @@ go: if (!ndigit)
|
|||
break;
|
||||
|
||||
case 'P' : s = sx;
|
||||
if (call[chan].provider != UNKNOWN)
|
||||
if (call[chan].provider != -1)
|
||||
sprintf(sx, " via %s", getProvider(call[chan].provider));
|
||||
else
|
||||
*sx = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: tools.h,v 1.47 1999/06/28 19:16:54 akool Exp $
|
||||
/* $Id: tools.h,v 1.48 1999/10/25 18:30:04 akool Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux.
|
||||
*
|
||||
|
@ -20,6 +20,11 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: tools.h,v $
|
||||
* Revision 1.48 1999/10/25 18:30:04 akool
|
||||
* isdnlog-3.57
|
||||
* WARNING: Experimental version!
|
||||
* Please use isdnlog-3.56 for production systems!
|
||||
*
|
||||
* Revision 1.47 1999/06/28 19:16:54 akool
|
||||
* isdnlog Version 3.38
|
||||
* - new utility "isdnrate" started
|
||||
|
@ -545,10 +550,14 @@
|
|||
#define MAXCONNECTS 50
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if 0 /* Fixme: remove */
|
||||
#define SONDERNUMMER -2 /* FIXME: set by readconfig(), but unused by now */
|
||||
#endif
|
||||
|
||||
#define INTERN 0
|
||||
#define FREECALL 0
|
||||
|
||||
#if 0 /* Fixme: remove */
|
||||
#define LOCALCALL 1
|
||||
#define CITYCALL 2
|
||||
#define REGIOCALL 3
|
||||
|
@ -565,6 +574,7 @@
|
|||
|
||||
/* Fixme: this is specific to Germany */
|
||||
#define DTAG 33
|
||||
#endif
|
||||
|
||||
#define LCR_DURATION 153
|
||||
|
||||
|
@ -645,8 +655,9 @@
|
|||
#define QUOTE 0200
|
||||
#define QMASK (QCMASK &~QUOTE)
|
||||
#define NOT '!'
|
||||
|
||||
#if 0 /* Fixme: remove */
|
||||
#define AVON "avon"
|
||||
#endif
|
||||
#define INFO "/dev/isdninfo"
|
||||
|
||||
#define BIGBUFSIZ 2048
|
||||
|
@ -728,6 +739,7 @@
|
|||
#define CONF_ENT_IGNORERR "IGNORERR"
|
||||
#define CONF_ENT_IGNORECOLP "IGNORECOLP"
|
||||
#define CONF_ENT_VBN "VBN"
|
||||
#define CONF_ENT_VBNLEN "VBNLEN"
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
@ -760,6 +772,7 @@
|
|||
#define CONF_ENT_CALLFMT "CALLFMT"
|
||||
|
||||
#define CONF_ENT_HOLIFILE "HOLIDAYS"
|
||||
#define CONF_ENT_DESTFILE "DESTFILE"
|
||||
#define CONF_ENT_COUNTRYFILE "COUNTRYFILE"
|
||||
#define CONF_ENT_ZONEFILE "ZONEFILE"
|
||||
#define CONF_ENT_RATECONF "RATECONF"
|
||||
|
@ -871,7 +884,7 @@ typedef struct {
|
|||
float cint;
|
||||
int cinth;
|
||||
int ctakt;
|
||||
int zone;
|
||||
int zone; /* Fixme: zone is in Rate : _zone */
|
||||
int uid;
|
||||
int hint;
|
||||
int tz;
|
||||
|
@ -952,7 +965,7 @@ typedef struct {
|
|||
char currency[32];
|
||||
double pay;
|
||||
int provider;
|
||||
int zone;
|
||||
int zone; /* fixme: zones may vary over time */
|
||||
} one_call;
|
||||
|
||||
/****************************************************************************/
|
||||
|
@ -1011,7 +1024,9 @@ _EXTERN CALL call[MAXCHAN];
|
|||
#ifdef Q931
|
||||
_EXTERN int q931dmp;
|
||||
#endif
|
||||
#if 0 /* Fixme: remove */
|
||||
_EXTERN int CityWeekend;
|
||||
#endif
|
||||
_EXTERN int preselect;
|
||||
_EXTERN int dual;
|
||||
_EXTERN char mlabel[BUFSIZ];
|
||||
|
@ -1020,6 +1035,7 @@ _EXTERN int ignoreRR;
|
|||
_EXTERN int ignoreCOLP;
|
||||
_EXTERN int interns0;
|
||||
_EXTERN char *vbn;
|
||||
_EXTERN char *vbnlen;
|
||||
_EXTERN char *mynum;
|
||||
_EXTERN int myicountry;
|
||||
#undef _EXTERN
|
||||
|
@ -1041,6 +1057,7 @@ _EXTERN char* logfile = LOGFILE;
|
|||
_EXTERN char* callfile = NULL;
|
||||
_EXTERN char* callfmt = NULL;
|
||||
_EXTERN char* holifile = NULL;
|
||||
_EXTERN char* destfile = NULL;
|
||||
_EXTERN char* countryfile = NULL;
|
||||
_EXTERN char* zonefile = NULL;
|
||||
_EXTERN char* rateconf = NULL;
|
||||
|
@ -1065,6 +1082,7 @@ _EXTERN char* logfile;
|
|||
_EXTERN char* callfile;
|
||||
_EXTERN char* callfmt;
|
||||
_EXTERN char* holifile;
|
||||
_EXTERN char* destfile;
|
||||
_EXTERN char* countryfile;
|
||||
_EXTERN char* zonefile;
|
||||
_EXTERN char* rateconf;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: zone.c,v 1.17 1999/10/22 19:57:59 akool Exp $
|
||||
/* $Id: zone.c,v 1.18 1999/10/25 18:30:04 akool Exp $
|
||||
*
|
||||
* Zonenberechnung
|
||||
*
|
||||
|
@ -19,6 +19,11 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: zone.c,v $
|
||||
* Revision 1.18 1999/10/25 18:30:04 akool
|
||||
* isdnlog-3.57
|
||||
* WARNING: Experimental version!
|
||||
* Please use isdnlog-3.56 for production systems!
|
||||
*
|
||||
* Revision 1.17 1999/10/22 19:57:59 akool
|
||||
* isdnlog-3.56 (for Karsten)
|
||||
*
|
||||
|
@ -152,8 +157,10 @@ struct sth {
|
|||
|
||||
static struct sth *sthp;
|
||||
static int count;
|
||||
static char version[] = "1.22";
|
||||
static char version[] = "1.23";
|
||||
#ifndef USE_DESTINATION
|
||||
static bool area_read = false;
|
||||
#endif
|
||||
|
||||
#define LINK 127
|
||||
#define INFO_LEN 80
|
||||
|
@ -233,19 +240,20 @@ int initZone(int provider, char *path, char **msg)
|
|||
{
|
||||
static char message[LENGTH];
|
||||
int res;
|
||||
#ifndef USE_DESTINATION
|
||||
char * dir;
|
||||
char * file;
|
||||
char *p;
|
||||
DIR *dp;
|
||||
struct dirent *ep;
|
||||
int len, i;
|
||||
|
||||
#endif
|
||||
if (msg)
|
||||
*(*msg=message)='\0';
|
||||
res = _initZone(provider, path, msg, ZONES);
|
||||
#ifndef USE_DESTINATION
|
||||
if (area_read || res)
|
||||
return res;
|
||||
|
||||
area_read = true;
|
||||
if ((p = strrchr(path, '/')) == 0) {
|
||||
dir = "./";
|
||||
|
@ -297,6 +305,7 @@ int initZone(int provider, char *path, char **msg)
|
|||
if(sthp[i].provider>=10000 && sthp[i].cc && strlen(message) < LENGTH-5)
|
||||
sprintf(message+strlen(message),"%d ",sthp[i].cc);
|
||||
}
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -443,12 +452,15 @@ static int _initZone(int provider, char *path, char **msg, bool area_only)
|
|||
case 'L' :
|
||||
p++;
|
||||
sthp[ocount].numlen = strtol(p, &p, 10);
|
||||
p--; /* get's incr after, so we miss 0x0*/
|
||||
break;
|
||||
#ifndef USE_DESTINATION
|
||||
case 'A' : /* this provider has the areacodes for county A */
|
||||
p++;
|
||||
sthp[ocount].cc = strtol(p, &p, 10);
|
||||
p--; /* get's incr after, so we miss 0x0*/
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
} /* for */
|
||||
if (*dbv == 'G')
|
||||
|
@ -506,12 +518,21 @@ static int _initZone(int provider, char *path, char **msg, bool area_only)
|
|||
if (*dbv == 'G')
|
||||
free(value.dptr);
|
||||
if (msg) {
|
||||
#ifdef USE_DESTINATION
|
||||
snprintf (message, LENGTH,
|
||||
"Zone V%s: Provider %d File '%s' opened fine - "
|
||||
"V%s K%d C%d N%d T%d O%d L%d",
|
||||
version, provider, path,
|
||||
dversion, sthp[ocount].pack_key, sthp[ocount].pack_table,
|
||||
csize, tsize, sthp[ocount].oz, sthp[ocount].numlen);
|
||||
#else
|
||||
snprintf (message, LENGTH,
|
||||
"Zone V%s: Provider %d File '%s' opened fine - "
|
||||
"V%s K%d C%d N%d T%d O%d L%d A%d",
|
||||
version, provider, path,
|
||||
dversion, sthp[ocount].pack_key, sthp[ocount].pack_table,
|
||||
csize, tsize, sthp[ocount].oz, sthp[ocount].numlen, sthp[ocount].cc);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -614,6 +635,8 @@ int getZone(int provider, char *from, char *to)
|
|||
return UNKNOWN;
|
||||
}
|
||||
|
||||
#ifndef USE_DESTINATION
|
||||
|
||||
static int _getAreacode(struct sth *sthp, char *from, char **text) {
|
||||
_DB fh = sthp->fh;
|
||||
datum key, value;
|
||||
|
@ -690,6 +713,8 @@ int getAreacode(int country, char *from, char **text)
|
|||
return UNKNOWN;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ZONETEST
|
||||
|
||||
static int checkZone(char *zf, char* df,int num1,int num2, bool verbose)
|
||||
|
@ -707,10 +732,13 @@ static int checkZone(char *zf, char* df,int num1,int num2, bool verbose)
|
|||
if(verbose)
|
||||
printf("%s\n", msg);
|
||||
if (num1 && num2) {
|
||||
#ifndef USE_DESTINATION
|
||||
char *ort1, *ort2;
|
||||
#endif
|
||||
snprintf(from, 9, "%d",num1);
|
||||
snprintf(to, 9, "%d",num2);
|
||||
ret = getZone(1, from, to);
|
||||
#ifndef USE_DESTINATION
|
||||
if (cc) {
|
||||
if (getAreacode(cc, from, &ort1) >0 &&
|
||||
getAreacode(cc, to, &ort2) >0) {
|
||||
|
@ -723,6 +751,7 @@ static int checkZone(char *zf, char* df,int num1,int num2, bool verbose)
|
|||
}
|
||||
else
|
||||
no_ort:
|
||||
#endif
|
||||
printf("%s %s = %d\n", from, to, ret);
|
||||
}
|
||||
else {
|
||||
|
@ -776,6 +805,8 @@ no_ort:
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifndef USE_DESTINATION
|
||||
|
||||
static int checkArea(char *df, int cc, char *from, int verbose) {
|
||||
char *msg, *text;
|
||||
int ret=0;
|
||||
|
@ -871,24 +902,34 @@ static int checkAllArea(char *df, char *cf, int cc, int verbose) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int verbose=false;
|
||||
char *df=0;
|
||||
char *zf=0;
|
||||
#ifndef USE_DESTINATION
|
||||
int cc=0;
|
||||
char *cf=0;
|
||||
#endif
|
||||
int c;
|
||||
int num1=0, num2=0;
|
||||
int cc=0;
|
||||
char snum1[LENGTH];
|
||||
#ifdef USE_DESTINATION
|
||||
while ( (c=getopt(argc, argv, "vVd:z:")) != EOF) {
|
||||
#else
|
||||
while ( (c=getopt(argc, argv, "vVd:z:a:c:")) != EOF) {
|
||||
#endif
|
||||
switch (c) {
|
||||
case 'v' : verbose = true; break;
|
||||
case 'V' : printf("%s: V%s\n", basename(argv[0]), version); exit(1);
|
||||
case 'd' : df = strdup(optarg); break;
|
||||
case 'z' : zf = strdup(optarg); break;
|
||||
#ifndef USE_DESTINATION
|
||||
case 'a' : cc = atoi(optarg); break;
|
||||
case 'c' : cf = strdup(optarg); break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
while (optind < argc) {
|
||||
|
@ -907,13 +948,19 @@ int main (int argc, char *argv[])
|
|||
}
|
||||
if (df && (zf || (num1 && num2)))
|
||||
return checkZone(zf, df, num1, num2, verbose);
|
||||
#ifndef USE_DESTINATION
|
||||
if (df && num1 && cc)
|
||||
return checkArea(df, cc, snum1, verbose);
|
||||
if (df && cf && cc)
|
||||
return checkAllArea(df, cf, cc, verbose);
|
||||
#endif
|
||||
#ifdef USE_DESTINATION
|
||||
fprintf(stderr, "Usage:\n%s -d DBfile -v -V { -z Zonefile | num1 num2 }\n", basename(argv[0]));
|
||||
#else
|
||||
fprintf(stderr, "Usage:\n%s -d DBfile -v -V { -z Zonefile | num1 num2 | -a cc num}\n", basename(argv[0]));
|
||||
fprintf(stderr, "\t-d DBfile -v -V -a CC num1 \n");
|
||||
fprintf(stderr, "\t-d DBfile -c Codefile -a CC -v -V\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
#
|
||||
BZIP2 = @BZIP2@
|
||||
SHELL = /bin/sh
|
||||
CFLAGS = -Wall -g
|
||||
CFLAGS = -Wall -g
|
||||
DEFS = -DUSE_DESTINATION
|
||||
INCLUDES =
|
||||
LDFLAGS = @DBMLIB@
|
||||
DBEXT = @DBEXT@
|
||||
|
@ -32,13 +33,24 @@ endif
|
|||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o
|
||||
|
||||
.PHONY: all config zonefiles AT DE NL distclean dist test install uninstall
|
||||
.PHONY: all config zonefiles AT DE NL distclean dist test install uninstall country
|
||||
|
||||
%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
|
||||
$(CC) $(CFLAGS) $(DEFS) $(INCLUDES) -c -o $@ $<
|
||||
|
||||
all: $(PROGRAM) country
|
||||
|
||||
country:
|
||||
ifeq ($(CONFIG_ISDN_LOG_AT),y)
|
||||
$(MAKE) AT
|
||||
endif
|
||||
ifeq ($(CONFIG_ISDN_LOG_DE),y)
|
||||
$(MAKE) DE
|
||||
endif
|
||||
ifeq ($(CONFIG_ISDN_LOG_NL),y)
|
||||
$(MAKE) NL
|
||||
endif
|
||||
|
||||
# $(ZONEFILES) should propably go to pre-install
|
||||
all: $(PROGRAM) zone $(ZONEFILES)
|
||||
|
||||
config:
|
||||
@./configure
|
||||
|
@ -74,10 +86,10 @@ uninstall:
|
|||
rm -f $(DESTDIR)$(SBINDIR)/$(PROGRAM) $(DESTDIR)$(MAN8DIR)/$(MANPAGE)
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ $(PROGRAM) *.db *.gdbm zone
|
||||
rm -f *.o *~ $(PROGRAM) *.db *.gdbm zone ../../zone*.{gdbm,db}
|
||||
|
||||
distclean: clean
|
||||
rm -f config.h config.status config.cache config.log *.man Makefile configure
|
||||
rm -f config.h config.status config.cache config.log *.man Makefile
|
||||
|
||||
test:
|
||||
$(BZIP2) -d at/pta/zred.pta.bz2
|
||||
|
@ -94,53 +106,88 @@ test:
|
|||
#
|
||||
zonefiles: AT DE NL
|
||||
|
||||
at:
|
||||
AT
|
||||
|
||||
de:
|
||||
DE
|
||||
|
||||
nl:
|
||||
NL
|
||||
|
||||
AT: AT-pta AT-1002 AT-1007 AT-1012 AT-1024 AT-1066 AT-1004 AT-1001
|
||||
.PHONY: AT-pta AT-1002 AT-1007 AT-1012 AT-1024 AT-1066 AT-1004 AT-1001
|
||||
|
||||
AT-pta:
|
||||
$(BZIP2) -d at/pta/zred.pta.bz2
|
||||
./$(PROGRAM) -d ../../zone-at-pta$(DBEXT) -r at/pta/zred.pta -c at/code -a43 -v
|
||||
$(BZIP2) -9 at/pta/zred.pta
|
||||
AT-pta:
|
||||
if [ ! -e ../../zone-at-pta$(DBEXT) ] ; then \
|
||||
$(BZIP2) -d at/pta/zred.pta.bz2; \
|
||||
./$(PROGRAM) -d ../../zone-at-pta$(DBEXT) -r at/pta/zred.pta -v; \
|
||||
$(BZIP2) -9 at/pta/zred.pta; \
|
||||
fi
|
||||
|
||||
AT-1001:
|
||||
$(BZIP2) -d at/1001/zred.bz2
|
||||
./$(PROGRAM) -d ../../zone-at-1001$(DBEXT) -r at/1001/zred -c at/code -v
|
||||
$(BZIP2) -9 at/1001/zred
|
||||
if [ ! -e ../../zone-at-1001$(DBEXT) ] ; then \
|
||||
$(BZIP2) -d at/1001/zred.bz2; \
|
||||
./$(PROGRAM) -d ../../zone-at-1001$(DBEXT) -r at/1001/zred -v; \
|
||||
$(BZIP2) -9 at/1001/zred; \
|
||||
fi
|
||||
|
||||
AT-1002:
|
||||
$(BZIP2) -d at/uta/zred.uta.bz2
|
||||
./$(PROGRAM) -d ../../zone-at-uta$(DBEXT) -r at/uta/zred.uta -c at/code -v
|
||||
$(BZIP2) -9 at/uta/zred.uta
|
||||
if [ ! -e ../../zone-at-uta$(DBEXT) ] ; then \
|
||||
$(BZIP2) -d at/uta/zred.uta.bz2; \
|
||||
./$(PROGRAM) -d ../../zone-at-uta$(DBEXT) -r at/uta/zred.uta -v; \
|
||||
$(BZIP2) -9 at/uta/zred.uta; \
|
||||
fi
|
||||
|
||||
AT-1004:
|
||||
$(BZIP2) -d at/1004/zred.bz2
|
||||
./$(PROGRAM) -d ../../zone-at-1004$(DBEXT) -r at/1004/zred -c at/code -v
|
||||
$(BZIP2) -9 at/1004/zred
|
||||
if [ ! -e ../../zone-at-1004$(DBEXT) ] ; then \
|
||||
$(BZIP2) -d at/1004/zred.bz2; \
|
||||
./$(PROGRAM) -d ../../zone-at-1004$(DBEXT) -r at/1004/zred -v; \
|
||||
$(BZIP2) -9 at/1004/zred; \
|
||||
fi
|
||||
|
||||
AT-1007:
|
||||
$(BZIP2) -d at/1007/zred.bz2
|
||||
./$(PROGRAM) -d ../../zone-at-1007$(DBEXT) -r at/1007/zred -c at/code -v
|
||||
$(BZIP2) -9 at/1007/zred
|
||||
if [ ! -e ../../zone-at-1007$(DBEXT) ] ; then \
|
||||
$(BZIP2) -d at/1007/zred.bz2; \
|
||||
./$(PROGRAM) -d ../../zone-at-1007$(DBEXT) -r at/1007/zred -v; \
|
||||
$(BZIP2) -9 at/1007/zred; \
|
||||
fi
|
||||
|
||||
AT-1012:
|
||||
./$(PROGRAM) -d ../../zone-at-1012$(DBEXT) -r at/1012/zred-at-1012 -c at/code -v -l4
|
||||
if [ ! -e ../../zone-at-1012$(DBEXT) ] ; then \
|
||||
./$(PROGRAM) -d ../../zone-at-1012$(DBEXT) -r at/1012/zred-at-1012 -v -l4; \
|
||||
fi
|
||||
|
||||
AT-1024:
|
||||
$(BZIP2) -d at/1024/zred.bz2
|
||||
./$(PROGRAM) -d ../../zone-at-1024$(DBEXT) -r at/1024/zred -c at/code -v -l4
|
||||
$(BZIP2) -9 at/1024/zred
|
||||
if [ ! -e ../../zone-at-1024$(DBEXT) ] ; then \
|
||||
$(BZIP2) -d at/1024/zred.bz2; \
|
||||
./$(PROGRAM) -d ../../zone-at-1024$(DBEXT) -r at/1024/zred -v -l4; \
|
||||
$(BZIP2) -9 at/1024/zred; \
|
||||
fi
|
||||
|
||||
AT-1066:
|
||||
$(BZIP2) -d at/1066/zred.bz2
|
||||
./$(PROGRAM) -d ../../zone-at-1066$(DBEXT) -r at/1066/zred -c at/code -v
|
||||
$(BZIP2) -9 at/1066/zred
|
||||
if [ ! -e ../../zone-at-1066$(DBEXT) ] ; then \
|
||||
$(BZIP2) -d at/1066/zred.bz2; \
|
||||
./$(PROGRAM) -d ../../zone-at-1066$(DBEXT) -r at/1066/zred -v; \
|
||||
$(BZIP2) -9 at/1066/zred; \
|
||||
fi
|
||||
|
||||
DE: DE-dtag
|
||||
.PHONY: DE-dtag
|
||||
|
||||
DE-dtag:
|
||||
$(BZIP2) -d de/01033/zred.dtag.bz2
|
||||
./$(PROGRAM) -d ../../zone-de-dtag$(DBEXT) -r de/01033/zred.dtag -c de/code -a49 -v
|
||||
$(BZIP2) -9 de/01033/zred.dtag
|
||||
if [ ! -e ../../zone-de-dtag$(DBEXT) ] ; then \
|
||||
$(BZIP2) -d de/01033/zred.dtag.bz2; \
|
||||
./$(PROGRAM) -d ../../zone-de-dtag$(DBEXT) -r de/01033/zred.dtag -v; \
|
||||
$(BZIP2) -9 de/01033/zred.dtag; \
|
||||
fi
|
||||
|
||||
NL: NL-kpn
|
||||
.PHONY: NL-kpn
|
||||
|
||||
NL-kpn:
|
||||
$(BZIP2) -d nl/kpn/zred.bz2
|
||||
./$(PROGRAM) -d ../../zone-nl-kpn$(DBEXT) -r nl/kpn/zred -c nl/code -a31 -v -o3 -l7
|
||||
$(BZIP2) -9 nl/kpn/zred
|
||||
if [ ! -e ../../zone-nl-kpn$(DBEXT) ] ; then \
|
||||
$(BZIP2) -d nl/kpn/zred.bz2; \
|
||||
./$(PROGRAM) -d ../../zone-nl-kpn$(DBEXT) -r nl/kpn/zred -v -o3 -l7; \
|
||||
$(BZIP2) -9 nl/kpn/zred; \
|
||||
fi
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
* SYNOPSIS
|
||||
* mkzonedb -r Zonefile -d database -c Codef [-f] [-v] [-V] [-o Oz] [-l L]
|
||||
*
|
||||
* 1.23: w. USE_DESTINATION
|
||||
* mkzonedb -r Zonefile -d database [-f] [-v] [-V] [-o Oz] [-l L]
|
||||
*
|
||||
* 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, or (at your option)
|
||||
|
@ -22,11 +25,17 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef USE_DESTINATION
|
||||
static char progversion[] = "1.23";
|
||||
#else
|
||||
static char progversion[] = "1.11";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Changes:
|
||||
*
|
||||
* 1.23 1999.10.12 lt moved /CC/code handling to destination
|
||||
*
|
||||
* 1.11 1999.07.08 lt added support for NL
|
||||
*
|
||||
* in NL areacode may be shorter than actual aeracodenumber
|
||||
|
@ -61,7 +70,11 @@ extern const char *basename (const char *name);
|
|||
|
||||
|
||||
void usage(char *argv[]) {
|
||||
#ifdef USE_DESTINATION
|
||||
fprintf(stderr, "%s: -r RedZonefile -d Database [ -v ] [ -V ] [ -o Localzone ] [ -l Len ]\n",
|
||||
#else
|
||||
fprintf(stderr, "%s: -r RedZonefile -d Database -c Code [-a CC] [ -v ] [ -V ] [ -o Localzone ] [ -l Len ]\n",
|
||||
#endif
|
||||
basename(argv[0]));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
@ -72,16 +85,19 @@ static bool verbose=false;
|
|||
static int table[256];
|
||||
static int tablelen, keylen, keydigs, maxnum;
|
||||
static int n, nn;
|
||||
#ifndef USE_DESTINATION
|
||||
typedef struct {
|
||||
int num;
|
||||
char *code;
|
||||
} code_t;
|
||||
static code_t *codes = 0;
|
||||
static int nc;
|
||||
static int country=0;
|
||||
#endif
|
||||
static int ortszone=1;
|
||||
static int numlen;
|
||||
static int country=0;
|
||||
|
||||
#ifndef USE_DESTINATION
|
||||
static void read_codefile(char *cf) {
|
||||
FILE *fp;
|
||||
char *p;
|
||||
|
@ -134,6 +150,7 @@ static void read_codefile(char *cf) {
|
|||
codes[nc].code=strdup("");
|
||||
free(cf);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void read_rzfile(char *rf) {
|
||||
int i;
|
||||
|
@ -145,6 +162,9 @@ static void read_rzfile(char *rf) {
|
|||
fprintf(stderr, "Coudn't read '%s'\n", rf);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#ifdef USE_DESTINATION
|
||||
maxnum = numlen==5 ? 40000 : 10000;
|
||||
#endif
|
||||
if ((numbers = calloc(maxnum+1, sizeof(int))) == 0) {
|
||||
fprintf(stderr, "Out of mem\n");
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -187,10 +207,22 @@ static void read_rzfile(char *rf) {
|
|||
keylen=from;
|
||||
if (to > keylen)
|
||||
keylen=to;
|
||||
#ifdef USE_DESTINATION
|
||||
if(to>maxnum) {
|
||||
maxnum=to;
|
||||
if ((numbers = realloc(numbers,(maxnum+1)*sizeof(int))) == 0) {
|
||||
fprintf(stderr, "Out of mem\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
numbers[to]++;
|
||||
n++;
|
||||
}
|
||||
free(rf);
|
||||
#ifdef USE_DESTINATION
|
||||
maxnum=keylen<maxnum?keylen:maxnum;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* get the 256 top used nums in table */
|
||||
|
@ -225,9 +257,13 @@ static void make_table() {
|
|||
nn = 256;
|
||||
}
|
||||
|
||||
|
||||
#ifndef USE_DESTINATION
|
||||
|
||||
static int comp_func(const void *p1, const void *p2) {
|
||||
return ((code_t*)p1)->num - ((code_t*)p2)->num;
|
||||
}
|
||||
|
||||
/* insert the code of from into value */
|
||||
static void insert_code(datum *value, int ifrom) {
|
||||
int l;
|
||||
|
@ -286,6 +322,7 @@ static void write_remaining_codes(_DB db) {
|
|||
free(val);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void write_db(char * df) {
|
||||
_DB db;
|
||||
|
@ -299,8 +336,10 @@ static void write_db(char * df) {
|
|||
int i, j;
|
||||
char version[80];
|
||||
|
||||
#ifndef USE_DESTINATION
|
||||
if (country)
|
||||
qsort(codes, nc, sizeof(code_t), comp_func);
|
||||
#endif
|
||||
if (verbose)
|
||||
printf("Writing\n");
|
||||
if((db=OPEN(df,WRITE)) == 0) {
|
||||
|
@ -318,9 +357,15 @@ static void write_db(char * df) {
|
|||
key.dptr = "vErSiO";
|
||||
key.dsize = 7;
|
||||
/* version of zone.c must be not smaller than dataversion */
|
||||
sprintf(version,"V1.20 K%c C%c N%d T%d O%d L%d A%d",
|
||||
#ifndef USE_DESTINATION
|
||||
sprintf(version,"V1.23 K%c C%c N%d T%d O%d L%d A%d",
|
||||
keylen==2?'S':'L',tablelen==1?'C':tablelen==2?'S':'L',
|
||||
nn,n, ortszone, numlen?numlen:keydigs, country);
|
||||
#else
|
||||
sprintf(version,"V1.20 K%c C%c N%d T%d O%d L%d",
|
||||
keylen==2?'S':'L',tablelen==1?'C':tablelen==2?'S':'L',
|
||||
nn,n, ortszone, numlen?numlen:keydigs);
|
||||
#endif
|
||||
value.dptr = version;
|
||||
value.dsize = strlen(version)+1;
|
||||
if(STORE(db, key, value)) {
|
||||
|
@ -366,8 +411,10 @@ static void write_db(char * df) {
|
|||
*((US*)val) = count;
|
||||
value.dptr = val;
|
||||
value.dsize = vlen;
|
||||
#ifndef USE_DESTINATION
|
||||
if (country)
|
||||
insert_code(&value, ofrom);
|
||||
#endif
|
||||
if(STORE(db, key, value)) {
|
||||
fprintf(stderr, "Error storing key '%d' - %s\n",ofrom,GET_ERR);
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -423,43 +470,59 @@ static void write_db(char * df) {
|
|||
*((US*)val) = count;
|
||||
value.dptr = val;
|
||||
value.dsize = vlen;
|
||||
#ifndef USE_DESTINATION
|
||||
if (country)
|
||||
insert_code(&value, ofrom);
|
||||
#endif
|
||||
STORE(db, key, value);
|
||||
free(value.dptr);
|
||||
#ifndef USE_DESTINATION
|
||||
if (country)
|
||||
write_remaining_codes(db);
|
||||
#endif
|
||||
CLOSE(db);
|
||||
free(zones);
|
||||
free(df);
|
||||
#ifndef USE_DESTINATION
|
||||
for (i = 0; i <= nc; i++)
|
||||
free(codes[i].code);
|
||||
free(codes);
|
||||
#endif
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
char *df=0;
|
||||
char *rf=0;
|
||||
#ifndef USE_DESTINATION
|
||||
char *cf=0;
|
||||
#endif
|
||||
int c;
|
||||
|
||||
if (argc < 2)
|
||||
usage(argv);
|
||||
#ifdef USE_DESTINATION
|
||||
while ( (c=getopt(argc, argv, "vVr:d:o:l:")) != EOF) {
|
||||
#else
|
||||
while ( (c=getopt(argc, argv, "vVr:d:c:o:l:a:")) != EOF) {
|
||||
#endif
|
||||
switch (c) {
|
||||
case 'v' : verbose = true; break;
|
||||
case 'V' : printf("%s: V%s Db=%s\n",
|
||||
basename(argv[0]), progversion, dbv); exit(1);
|
||||
case 'd' : df = strdup(optarg); break;
|
||||
case 'r' : rf = strdup(optarg); break;
|
||||
#ifndef USE_DESTINATION
|
||||
case 'c' : cf = strdup(optarg); break;
|
||||
case 'a' : country = atoi(optarg); break;
|
||||
#endif
|
||||
case 'o' : ortszone = atoi(optarg); break;
|
||||
case 'l' : numlen = atoi(optarg); break;
|
||||
case 'a' : country = atoi(optarg); break;
|
||||
}
|
||||
}
|
||||
#ifndef USE_DESTINATION
|
||||
read_codefile(cf);
|
||||
#endif
|
||||
read_rzfile(rf);
|
||||
make_table();
|
||||
write_db(df);
|
||||
|
|
Loading…
Reference in New Issue