- bugfix: it is possible to install isdnlog now

- improved performance for read files for vbox files and mgetty files.
- it is possible to decide via config if you want to use avon or
  areacode.
This commit is contained in:
luethje 1997-05-19 22:57:51 +00:00
parent 66c2d0852e
commit 02f1102b7d
15 changed files with 309 additions and 109 deletions

2
HOWTO
View File

@ -131,7 +131,7 @@ xisdn voruebergehend aus der Distribution genommen wurde!!!!
Konfigurationsdatei "isdnlog.conf" in die neue Syntax umzuwandeln.
Dieses passiert automatisch mit make install
Es werden in dieser Version alle Telefonnummern in der Datei callerid.conf
ausgelagert, so dass die isdn.conf sehr klien wird.
ausgelagert, so dass die isdn.conf sehr klein wird.
6. Erster Start des neuen isdnlog:

View File

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.14 1997/05/16 12:23:26 fritz Exp $
# $Id: Makefile,v 1.15 1997/05/19 22:57:52 luethje Exp $
#
# Toplevel Makefile for isdn4k-utils
#
@ -10,6 +10,10 @@ all: do-it-all
#
# Make "config" the default target if there is no configuration file.
#
# Following line is important for lib and isdnlog (sl).
export ROOTDIR=$(shell pwd)
ifeq (.config,$(wildcard .config))
include .config
do-it-all: subtargets
@ -19,9 +23,6 @@ do-it-all: config
endif
SUBDIRS :=
ifeq ($(CONFIG_LIB_AREACODE),y)
SUBDIRS := $(SUBDIRS) areacode lib
endif
ifeq ($(CONFIG_ISDNCTRL),y)
SUBDIRS := $(SUBDIRS) isdnctrl
endif
@ -54,7 +55,11 @@ ifeq ($(CONFIG_IMONTTY),y)
SUBDIRS := $(SUBDIRS) imontty
endif
ifeq ($(CONFIG_ISDNLOG),y)
SUBDIRS := $(SUBDIRS) isdnlog
SUBDIRS := $(SUBDIRS) areacode lib isdnlog
else
ifeq ($(CONFIG_LIB_AREACODE),y)
SUBDIRS := $(SUBDIRS) areacode
endif
endif
ifeq ($(CONFIG_IPPPSTATS),y)
SUBDIRS := $(SUBDIRS) ipppstats

View File

@ -4,6 +4,10 @@
# the original Makefile, it is called GNUmakefile.
#
#ifndef CONFIG_AREACODE_DATA
#CONFIG_AREACODE_DATA=x
#endif
ifeq (../.config,$(wildcard ../.config))
include ../.config
DATAOPTS := DATATARGET=$(shell echo $(CONFIG_AREACODE_DATA))/areacodes
@ -18,6 +22,8 @@ endif
all: .depend
$(MAKE) -f make/linux.mak $(BUILDOPTS) all
depend dep: .depend
.depend:
$(MAKE) -f make/linux.mak $(BUILDOPTS) depend
@ -33,9 +39,15 @@ distclean:
install-man:
install:
mkdir -p $(CONFIG_AREACODE_DATA)
$(MAKE) -f make/linux.mak $(INSTALLOPTS) install
install: all
ifeq ($(CONFIG_LIB_AREACODE),y)
mkdir -p $(CONFIG_AREACODE_DATA)
$(MAKE) -f make/linux.mak $(INSTALLOPTS) install
endif
# -@test "$(CONFIG_AREACODE_DATA)" != "x" && \
# mkdir -p $(CONFIG_AREACODE_DATA) && \
# $(MAKE) -f make/linux.mak $(INSTALLOPTS) install
uninstall:
rm -f $(shell echo $(CONFIG_AREACODE_DATA))/areacodes

View File

@ -1,4 +1,4 @@
## $Id: Makefile.in,v 1.25 1997/05/17 01:08:11 luethje Exp $
## $Id: Makefile.in,v 1.26 1997/05/19 22:58:02 luethje Exp $
##
## ISDN accounting for isdn4linux.
##
@ -19,6 +19,12 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Log: Makefile.in,v $
## Revision 1.26 1997/05/19 22:58:02 luethje
## - bugfix: it is possible to install isdnlog now
## - improved performance for read files for vbox files and mgetty files.
## - it is possible to decide via config if you want to use avon or
## areacode.
##
## Revision 1.25 1997/05/17 01:08:11 luethje
## some bugfixes
##
@ -159,6 +165,7 @@ INSTALL_DATA := $(INSTALL) -m 0644 -o 0 -g 0
LIBISDNDIR := @LIBISDNDIR@
I4LCONFDIR := @I4LCONFDIR@
CONFFILE := @CONFFILE@
CALLERIDFILE := @CALLERIDFILE@
OLDCONFDIR := @OLDCONFDIR@
OLDCONFFILE := @OLDCONFFILE@
LIBAREA := @LIBAREA@
@ -183,12 +190,13 @@ export CHARGEMAX := 1000.00
ifndef ROOTDIR
export ROOTDIR=$(shell pwd)
PREFIXDIR=.
MAKELIB =1
else
PREFIXDIR=$(ROOTDIR)
#PREFIXDIR=$(ROOTDIR)
endif
PREFIXDIR=.
ifeq ($(MAKELIB),1)
SUBDIRS = $(LIBISDNDIR)
endif
@ -203,9 +211,7 @@ CC = $(_CC)
INCLUDE = -I./connect -I./tools -I$(PREFIXDIR) -I$(LIBISDNDIR)
ifneq ($(LIBAREA),1)
LIB = $(DBMLIB)
endif
@ -217,7 +223,7 @@ SERVICEFILE = /etc/services
# DON'T EDIT BELOW THIS LINE
######################################################################
VERSION = 2.99.19
VERSION = 2.99.20
ifeq ($(POSTGRES),1)
DEFS += -DPOSTGRES
@ -294,7 +300,7 @@ rootperm:
fi
uninstall: rootperm
if ps -x | fgrep $(ISDNLOG) >/dev/null; then kill `cat $(RUNDIR)/isdnlog.pid`; fi
if ps -x | fgrep $(ISDNLOG) >/dev/null; then kill `cat $(RUNDIR)/isdnlog.pid` 2>/dev/null; fi
rm -f $(SBINDIR)/$(ISDNLOG) $(BINDIR)/$(ISDNREP) $(BINDIR)/$(ISDNCONF)
rm -f $(MAN8DIR)/isdnlog.8 $(MAN1DIR)/isdnrep.1
@ -302,20 +308,24 @@ installdirs: rootperm
$(INSTALL_DIR) $(I4LCONFDIR)
$(INSTALL_DIR) $(BINDIR)
$(INSTALL_DIR) $(SBINDIR)
$(INSTALL_DIR) $(MAN1DIR)
$(INSTALL_DIR) $(MAN8DIR)
# $(INSTALL_DIR) $(MAN1DIR)
# $(INSTALL_DIR) $(MAN8DIR)
install: depend all rootperm installdirs
if ps -x | fgrep $(ISDNLOG) >/dev/null; then kill `cat $(RUNDIR)/isdnlog.pid`; fi
-test ! -d $(OLDCONFDIR) || (cp -auv $(OLDCONFDIR)/* $(I4LCONFDIR) \
@echo "Killing running isdnlog!"
-@if ps -x | fgrep $(ISDNLOG) >/dev/null; then kill `cat $(RUNDIR)/isdnlog.pid 2>/dev/null`; fi
-@test ! -d $(OLDCONFDIR) || cp -auv $(OLDCONFDIR)/$(USERFILE) $(I4LCONFDIR)
-@test ! -d $(OLDCONFDIR) || (cp -auv $(OLDCONFDIR)/$(OLDCONFFILE) $(I4LCONFDIR) \
&& $(ISDNREP) 1>/dev/null 2>&1) \
&& mv $(I4LCONFDIR)/$(OLDCONFFILE) $(I4LCONFDIR)/$(OLDCONFFILE).old
$(GENCONF) $(I4LCONFDIR)/$(CONFFILE)
$(GENCONF) $(I4LCONFDIR)/$(CONFFILE) $(I4LCONFDIR)/$(CALLERIDFILE)
@echo "Generate config files. Wait a moment..."
@$(ISDNCONF) -c 040 1>/dev/null 2>&1
$(INSTALL_BIN) $(ISDNLOG) $(SBINDIR)
$(INSTALL_BIN) $(ISDNREP) $(BINDIR)
$(INSTALL_BIN) $(ISDNCONF) $(BINDIR)
$(INSTALL_DATA) isdnlog/isdnlog.8 $(MAN8DIR)
$(INSTALL_DATA) isdnrep/isdnrep.1 $(MAN1DIR)
# $(INSTALL_DATA) isdnlog/isdnlog.8 $(MAN8DIR)
# $(INSTALL_DATA) isdnrep/isdnrep.1 $(MAN1DIR)
@echo ""
@echo "Don't forget to create $(I4LCONFDIR)/$(USERFILE)"
@echo ""

View File

@ -1,4 +1,3 @@
# Lock und PID-Files
ISDNLOG - Version 3.0 - 4-Mai-97 22:09
@ -338,17 +337,38 @@ Dazu siehe jedoch Kapitel 15. Dual-Mode !
3. Installation
---------------
Nun kann isdnlog ausgepackt (wohl bereits geschehen ;-) und erstellt
sowie installiert werden:
Da isdnlog seit der Version 3.0 nur noch im isdn4k-utils freigegeben wird,
findet die Konfiguration ueber das Menu statt. Es darf also nicht mehr direkt
in dem Makefile editiert werden.
cd /usr/src
tar xzf isdnlog.tar.gz
cd isdnlog-<Version>
make install
Die alte Datei isdnlog.conf wird, wenn vorhanden in die Dateien isdn.conf und
callerid.conf umgesetzt. Dieses macht die Installation automatisch.
Vor dem "make" koennen folgende Eintraege koennen im Installationsmenue
den eigenen Gegebenheiten angepasst werden. Bitte nicht mehr direkt im Makefile
editieren, da diese Eintraege ueberschrieben werden.
Die alte Konfigurationsdatei isdnlog.conf wird ins neue Verzeichnis uebernommen.
Allerdings traegt sie dann den Namen isdnlog.conf.old.
Es ist dabei zu beachten, dass bei allen Telefonnummern, die in der
isdnlog.conf, die mit einem "*" oder einem "?" beginnen, dieses Zeichen
geloescht wird.
Beispiel:
*8154711 -> 8154711
081547* -> 081547*
Wenn das Zeichen ("*" oder "?") nur als Platzhalter fuer eine "0" stand, kann
man es lassen, andernfalls muss eine manuelle Nacheditierung stattfinden.
Auch die Datei isdnlog.users wird uebernommen. Allerdings finden hier keine
Aenderungen statt.
Das Vornummernverzeichnis AVON wird nicht uebernommen. Da sich die Syntax
etwas geaendert hat. Muss die alte Datei von Hand an die neue angefuegt werden.
Aber normalerweise wird bei der Installation von isdnlog empfohlen die
areacode-Library zu verwenden.
Hier sind nochmal alle Eintraege aufgefuehrt, die isdnlog im Makefile enthaelt,
die ueber das Menue konfiguriert werden:
COPTS
Compiler-Optionen fuer den gcc
@ -508,6 +528,16 @@ COUNTRYPREFIX:
Es enthaelt den Prefix zur Laenderkennung. Beim Kompilieren ist dieser
Wert defaultmaessig auf "+" gesetzt. Dieser Eintrag ist optional.
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
erlaubt. Es sollte dann aber zusaetzlich AREALIB bzw. AVONLIB eingetragen
werden.
Dieser Eintrag ist optional.
Beispiel:
CODELIB=avon
AREALIB:
Enthaelt den vollen Pfad zu der Datei "areacodes". Diese Angabe ist
optional und nur notwendig, wenn sich der Pfad nach der Compilation
@ -570,39 +600,46 @@ gehalten, sondern nur noch nach Beendigung eines Gespraeches wird die Datei
geoeffnet, der Eintrag ergaenzt und anschliessend wieder geschlossen.
Dadurch ist es jetzt moeglich diese Datei zu verschieben, wenn der isdnlog
laeuft und gerade kein Gespraech beendet wird.
Dieser Eintrag ist optional.
RELOADCMD = reload
Hiermit wird ein ausfuehrbares Programm (z.b. Shell-Script) angegeben,
mit dem isdnlog ein evtl. wildgewordenes isdn4linux reanimieren kann.
(Ein Beispiel findet sich im Kapitel 14.1 Watchdog)
Dieser Eintrag ist optional.
STOPCMD = stop
Hiermit wird ein ausfuehrbares Programm (z.b. Shell-Script) angegeben,
mit dem isdnlog isdn4linux terminieren kann.
(Ein Beispiel findet sich im Kapitel 14.2 CHARGEMAX)
Dieser Eintrag ist optional.
REBOOTCMD = /sbin/reboot
Hiermit wird ein ausfuehrbares Programm (z.b. Shell-Script) angegeben,
mit dem isdnlog Linux herunterfahren kann.
(Ein Beispiel findet sich im Kapitel 14.2 CHARGEMAX)
Dieser Eintrag ist optional.
CHARGEMAX = 15.00
Hiermit wird (in DM) angegeben, wieviel Geld man pro Tag maximal
mit isdn4linux vertelefonieren moechte.
Dieser Eintrag ist pflicht!
CONNECTMAX = 18000,0
Hiermit wird (in Sekunden) angegeben, wieviel Zeit man pro Monat
maximal Online sein moechte.
Dieser Eintrag ist optional.
BYTEMAX = 67108864,0
Hiermit wird (in Byte) angegeben, wieviel Byte man maximal pro
Monat saugen moechte.
Dieser Eintrag ist optional.
CURRENCY=factor,currency
@ -630,6 +667,38 @@ lassen will, kann man hier z.B. folgenden Wert setzen:
CURRENCY=0.1043,DM
Dieser Eintrag ist optional.
Wenn der isdnrep via HTML aufgezeichneten Anrufe abspielen soll, dann muss hier
der Pfad eingetragen werden. Eine genaue Beschreibung findet man unter
dem Kapitel isdnrep.
Dieser Eintrag ist optional.
Beipiel:
VBOXPATH = /var/spool/vbox/fred/incoming
Der isdnrep kann fuer jeden aufgezeichneten Anruf ein Koonvertierungsprogramm
starten. Eine genaue Beschreibung findet man unter dem Kapitel isdnrep.
Dieser Eintrag ist optional.
Beipiel:
VBOXCMD = /usr/bin/zyxeltowav
Wenn der isdnrep via HTML angekommene Faxe anzeigen soll, dann muss hier
der Pfad eingetragen werden. Eine genaue Beschreibung findet man unter
dem Kapitel isdnrep.
Dieser Eintrag ist optional.
Beipiel:
MGETTYPATH = /var/spool/fax/incoming
Der isdnrep kann fuer jedes Fax ein Koonvertierungsprogramm starten.
Eine genaue Beschreibung findet man unter dem Kapitel isdnrep.
Dieser Eintrag ist optional.
Beipiel:
MGETTYCMD = /usr/bin/g3tojpg
Fuer den isdnrep kann man einen oder mehrere Formatsstrings definieren,
wie der isdnrep die einzelnen Gebuehren anzeigen soll. Die genaue Syntax
wird unter dem Kapitel isdnrep beschrieben.

3
isdnlog/configure vendored
View File

@ -542,6 +542,7 @@ I4LCONFDIR=$CONFIG_I4LCONFDIR
OLDCONFDIR=$CONFIG_ISDNLOG_OLDI4LCONFDIR
OLDCONFFILE=$CONFIG_ISDNLOG_OLDI4LCONFFILE
CONFFILE=$CONFIG_CONFFILE
CALLERIDFILE=$CONFIG_CALLERIDFILE
RUNDIR=$CONFIG_RUNDIR
SERV_PORT=$CONFIG_ISDNLOG_SERV_PORT
USERFILE=$CONFIG_ISDNLOG_USERFILE
@ -566,6 +567,7 @@ I4LCONFDIR="/etc/isdn"
OLDCONFDIR="/etc/isdnlog"
OLDCONFFILE="isdnlog.conf"
CONFFILE="isdn.conf"
CALLERIDFILE="callerid.conf"
RUNDIR="/var/run"
ALIB=area
SERV_PORT=20011
@ -1952,6 +1954,7 @@ s%@USERFILE@%$USERFILE%g
s%@OLDCONFDIR@%$OLDCONFDIR%g
s%@OLDCONFFILE@%$OLDCONFFILE%g
s%@CONFFILE@%$CONFIG_CONFFILE%g
s%@CALLERIDFILE@%$CONFIG_CALLERIDFILE%g
s%@LOGFILE@%$LOGFILE%g
s%@COUNTRYCODE@%$COUNTRYCODE%g
s%@COUNTRYPREFIX@%$COUNTRYPREFIX%g

View File

@ -1,5 +1,5 @@
#!/bin/sh
## $Id: genconf,v 1.5 1997/05/10 01:21:00 luethje Exp $
## $Id: genconf,v 1.6 1997/05/19 22:58:13 luethje Exp $
##
## installation script for the config file of isdnlog
##
@ -20,6 +20,12 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Log: genconf,v $
## Revision 1.6 1997/05/19 22:58:13 luethje
## - bugfix: it is possible to install isdnlog now
## - improved performance for read files for vbox files and mgetty files.
## - it is possible to decide via config if you want to use avon or
## areacode.
##
## Revision 1.5 1997/05/10 01:21:00 luethje
## some primitive changes
##
@ -40,6 +46,8 @@
##
CONFFILE=$1
CALLERIDFILE=$2
RESFILE=/tmp/`basename $0`.res.$$
setentry() {
@ -94,7 +102,7 @@ setentry "[GLOBAL]" "COUNTRYCODE" "$COUNTRYCODE"
setentry "[GLOBAL]" "COUNTRYPREFIX" "$COUNTRYPREFIX"
setentry "[ISDNLOG]" "CHARGEMAX" "$CHARGEMAX"
setentry "[ISDNLOG]" "REPFMT" '\" %X %D %15.15H %T %-15.15F %7u %U %I %O\"'
setentry "[ISDNLOG]" "REPFMTSHORT" '\"%X%D %8.8H %T %-14.14F %U%I %O\"'
setentry "[ISDNLOG]" "REPFMTSHORT" '\"%X%D %8.8H %T %-14.14F%U%I %O\"'
setentry "[ISDNLOG]" "REPFMTWWW" '\"%X %D %17.17H %T %-17.17F %-20.20l SI: %S %9u %U %I %O\"'
setentry "[ISDNLOG]" "OLABEL" "$OLABEL"
setentry "[ISDNLOG]" "ILABEL" "$ILABEL"
@ -102,9 +110,21 @@ setentry "[ISDNLOG]" "LOGFILE" "$LOGFILE"
# Change the variables $1 to \$1 and so one.
sed -e "s/\([^\]\)\$\([0-9][ ]\)/\1\\\\$\2/g" $CONFFILE >$RESFILE
sed -e "s/\([^\]\)\$\([0-9][ ]\)/\1\\\\$\2/g" $CONFFILE |\
sed -e "s/\([^\]\)\$\([0-9][ ]\)/\1\\\\$\2/g" >$RESFILE
cp $RESFILE $CONFFILE
rm -f $RESFILE
echo " Ready."
if [ -f $USERFILE ]
then
# Change the variables $1 to \$1 and so one.
echo -n "Adding some entries to the config file \"$CALLERIDFILE\"..."
sed -e "s/\([^\]\)\$\([0-9][ ]\)/\1\\\\$\2/g" $CALLERIDFILE |\
sed -e "s/\(NUMBER[ ]*=[ ]*\)\*/\1/" |\
sed -e "s/\([^\]\)\$\([0-9][ ]\)/\1\\\\$\2/g" >$RESFILE
cp $RESFILE $CALLERIDFILE
echo " Ready."
fi
rm -f $RESFILE

View File

@ -1,4 +1,4 @@
/* $Id: isdnrep.c,v 1.25 1997/05/17 14:58:28 luethje Exp $
/* $Id: isdnrep.c,v 1.26 1997/05/19 22:58:18 luethje Exp $
*
* ISDN accounting for isdn4linux. (Report-module)
*
@ -20,6 +20,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnrep.c,v $
* Revision 1.26 1997/05/19 22:58:18 luethje
* - bugfix: it is possible to install isdnlog now
* - improved performance for read files for vbox files and mgetty files.
* - it is possible to decide via config if you want to use avon or
* areacode.
*
* Revision 1.25 1997/05/17 14:58:28 luethje
* bug fix in HTML-Link
*
@ -223,6 +229,9 @@
#define C_VBOX 'v'
#define C_FAX 'f'
#define F_VBOX 1
#define F_FAX 2
/*****************************************************************************/
#define F_BEGIN 1
@ -352,6 +361,7 @@ static int file_root_size = 0;
static int file_root_member = 0;
static char *_myname;
static time_t _begintime;
static int read_path = 0;
/*****************************************************************************/
@ -471,9 +481,6 @@ int read_logfile(char *myname)
if (html & H_PRINT_HEADER)
html_header();
if (html)
get_file_list();
if (lineformat == NULL)
{
if (html)
@ -485,6 +492,10 @@ int read_logfile(char *myname)
if (get_format(lineformat) == NULL)
return -1;
/* following two lines must be after get_format()! */
if (html)
get_file_list();
clear_sum(&day_sum);
clear_sum(&day_com_sum);
clear_sum(&all_sum);
@ -1525,6 +1536,15 @@ static prt_fmt** get_format(const char *format)
return NULL;
}
switch (Type)
{
case 'C': read_path |= F_VBOX;
break;
case 'G': read_path |= F_FAX;
break;
default : break;
}
fmt->s_type= Type;
fmt->range = strdup(Range);
fmt->type = FMT_FMT;
@ -2485,8 +2505,11 @@ static char *print_diff_date(char *start, char *stop)
static int get_file_list(void)
{
set_dir_entries(vboxpath,set_vbox_entry);
set_dir_entries(mgettypath,set_mgetty_entry);
if (read_path & F_VBOX)
set_dir_entries(vboxpath,set_vbox_entry);
if (read_path & F_FAX)
set_dir_entries(mgettypath,set_mgetty_entry);
qsort(file_root,file_root_member,sizeof(file_list*),Compare_files);
return 0;

View File

@ -36,29 +36,31 @@ endif
CC = $(_CC)
export AVON = avon
export I4LCONFDIR
######################################################################
# DON'T EDIT BELOW THIS LINE
######################################################################
ifdef LIBAREA
LIBDIR = areacode
LIB_AREA = $(LIBDIR)/areacode.o
DEFS += -DLIBAREA
else
LIBDIR = avon
LIB_AREA = $(LIBDIR)/createDB.o
DEFS += -DAVON=\"$(AVON)\"
AREADIR = ../areacode
LIB_AREA = $(AREADIR)/areacode.o
ifeq ($(LIBAREA),1)
DEFS += -DLIBAREA
endif
SUBDIRS = $(LIBDIR)
AVONDIR = avon
LIB_AVON += $(AVONDIR)/createDB.o
DEFS += -DAVON=\"$(AVON)\"
SUBDIRS = $(AVONDIR) #$(AREADIR)
DEFS += -I$(PREFIXDIR)
%.o: %.c
$(CC) $(CFLAGS) $(DEFS) -c -o $@ $<
all: libs libisdn.a
all: .depend libs libisdn.a
libs:
set -e; for i in `echo $(SUBDIRS)`; do $(MAKE) -C $$i; done
@ -80,14 +82,18 @@ distclean: clean
install: depend all
set -e; for i in `echo $(SUBDIRS)`; do $(MAKE) -C $$i depend; done
set -e; for i in `echo $(SUBDIRS)`; do $(MAKE) -C $$i all; done
set -e; for i in `echo $(SUBDIRS)`; do $(MAKE) -C $$i install; done
ifneq ($(CONFIG_LIB_AREACODE),y)
set -e; for i in `echo $(AVONDIR)`; do $(MAKE) -C $$i install; done
#else
# set -e; for i in `echo $(AREADIR)`; do $(MAKE) -C $$i install; done
endif
deinstall: distclean
set -e; for i in `echo $(SUBDIRS)`; do $(MAKE) -C $$i deinstall; done
libisdn.a: conffile.o isdntools.o libtools.o $(LIB_AREA)
ar rs libisdn.a isdntools.o conffile.o libtools.o $(LIB_AREA)
libisdn.a: conffile.o isdntools.o libtools.o $(LIB_AREA) $(LIB_AVON)
ar rs libisdn.a isdntools.o conffile.o libtools.o $(LIB_AREA) $(LIB_AVON)
ifeq (.depend,$(wildcard .depend))
include .depend

View File

@ -57,13 +57,16 @@ distclean:
# TODO: build a shared version and install it.
#
install-avon:
$(MAKE) -f Makefile I4LCONFDIR=$(LIB_AVON_DATA) install
$(MAKE) -f Makefile I4LCONFDIR=$(CONFIG_I4LCONFDIR) install
uninstall-avon:
$(MAKE) -f Makefile I4LCONFDIR=$(LIB_AVON_DATA) deinstall
$(MAKE) -f Makefile I4LCONFDIR=$(CONFIG_I4LCONFDIR) deinstall
ifeq ($(CONFIG_LIB_AREACODE),y)
install:
$(MAKE) -f Makefile $(BUILDOPTS) all
uninstall:
else
install: install-avon

View File

@ -24,6 +24,7 @@ else
PREFIXDIR =$(ROOTDIR)
endif
######################################################################
# USER CONFIGURATION AREA
######################################################################
@ -37,6 +38,10 @@ CC = $(_CC)
# DON'T EDIT BELOW THIS LINE
######################################################################
INSTALL =install
INSTALL_DIR := $(INSTALL) -m 0755 -o 0 -g 0 -d
INSTALL_AVON := $(INSTALL) -m 0644 $(AVON) $(I4LCONFDIR)
#CFLAGS = -I$(PREFIXDIR)
all: createDB.o
@ -53,12 +58,14 @@ distclean: clean
rm -f .depend
install: depend all
-test $(AVON) -ot $(I4LCONFDIR)/$(AVON) || ( $(INSTALL) -m 644 $(AVON) $(I4LCONFDIR) )
# -rm -f $(I4LCONFDIR)/$(AVON).pag $(I4LCONFDIR)/$(AVON).dir
ifneq ($(CONFIG_LIB_AREACODE),y)
-$(INSTALL_DIR) $(I4LCONFDIR)
-test $(AVON) -ot $(I4LCONFDIR)/$(AVON) || ( $(INSTALL_AVON) )
-@rm -f $(I4LCONFDIR)/$(AVON).pag $(I4LCONFDIR)/$(AVON).dir
endif
deinstall: distclean
-rm -f $(I4LCONFDIR)/$(AVON)*
createDB.o: createDB.c createDB.h

View File

@ -1,4 +1,4 @@
/* $Id: createDB.c,v 1.2 1997/04/17 23:29:50 luethje Exp $
/* $Id: createDB.c,v 1.3 1997/05/19 22:58:34 luethje Exp $
*
* ISDN accounting for isdn4linux. (Utilities)
*
@ -19,6 +19,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: createDB.c,v $
* Revision 1.3 1997/05/19 22:58:34 luethje
* - bugfix: it is possible to install isdnlog now
* - improved performance for read files for vbox files and mgetty files.
* - it is possible to decide via config if you want to use avon or
* areacode.
*
* Revision 1.2 1997/04/17 23:29:50 luethje
* new structure of isdnrep completed.
*
@ -36,11 +42,16 @@
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include "createDB.h"
/****************************************************************************/
#define FILEMODE 0664
/****************************************************************************/
static int ln = 0;
/****************************************************************************/
@ -49,7 +60,7 @@ static int (*print_msg)(const char *, ...) = printf;
/****************************************************************************/
void set_print_fkt_for_avon(int (*new_print_msg)(const char *, ...))
void set_print_fct_for_avon(int (*new_print_msg)(const char *, ...))
{
print_msg = new_print_msg;
}
@ -66,27 +77,37 @@ int createDB(char *fn, int force)
sprintf(s, "%s.dir", fn);
if (force || stat(s, &statbuf)) {
if ((f = open(s, O_CREAT | O_TRUNC | O_RDWR, 0666)) >= 0) {
if ((f = open(s, O_CREAT | O_TRUNC | O_RDWR, FILEMODE)) >= 0) {
close(f);
sprintf(s, "%s.pag", fn);
if ((f = open(s, O_CREAT | O_TRUNC | O_RDWR, 0666)) >= 0) {
if ((f = open(s, O_CREAT | O_TRUNC | O_RDWR, FILEMODE)) >= 0) {
close(f);
return(1);
if(!openDB(fn, O_RDWR | O_CREAT))
{
readAVON(fn);
closeDB();
return 0;
}
} /* if */
else
print_msg("Can not open file `%s': %s!\n",s,strerror(errno));
} /* if */
else
print_msg("Can not open file `%s': %s!\n",s,strerror(errno));
} /* if */
return(0);
return(-1);
} /* createDB */
/******************************************************************************/
int openDB(char *fn)
int openDB(char *fn, int flag)
{
dbm = dbm_open(fn, O_RDWR | O_CREAT, 0666);
dbm = dbm_open(fn, flag, FILEMODE);
return((dbm == (DBM *)NULL) ? -1 : 0);
} /* dbminit */

View File

@ -1,4 +1,4 @@
/* $Id: createDB.h,v 1.2 1997/04/17 23:29:51 luethje Exp $
/* $Id: createDB.h,v 1.3 1997/05/19 22:58:36 luethje Exp $
*
* ISDN accounting for isdn4linux.
*
@ -19,6 +19,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: createDB.h,v $
* Revision 1.3 1997/05/19 22:58:36 luethje
* - bugfix: it is possible to install isdnlog now
* - improved performance for read files for vbox files and mgetty files.
* - it is possible to decide via config if you want to use avon or
* areacode.
*
* Revision 1.2 1997/04/17 23:29:51 luethje
* new structure of isdnrep completed.
*
@ -49,9 +55,9 @@
_EXTERN datum key, data;
_EXTERN DBM *dbm SET_NULL;
_EXTERN void set_print_fkt_for_avon(int (*new_print_msg)(const char *, ...));
_EXTERN void set_print_fct_for_avon(int (*new_print_msg)(const char *, ...));
_EXTERN int createDB(char *fn, int force);
_EXTERN int openDB(char *fn);
_EXTERN int openDB(char *fn, int flag);
_EXTERN void closeDB();
_EXTERN void insertDB(char *num, char *area);
_EXTERN void readAVON(char *fn);

View File

@ -1,4 +1,4 @@
/* $Id: isdntools.c,v 1.12 1997/05/09 23:31:06 luethje Exp $
/* $Id: isdntools.c,v 1.13 1997/05/19 22:58:28 luethje Exp $
*
* ISDN accounting for isdn4linux. (Utilities)
*
@ -19,6 +19,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdntools.c,v $
* Revision 1.13 1997/05/19 22:58:28 luethje
* - bugfix: it is possible to install isdnlog now
* - improved performance for read files for vbox files and mgetty files.
* - it is possible to decide via config if you want to use avon or
* areacode.
*
* Revision 1.12 1997/05/09 23:31:06 luethje
* isdnlog: new switch -O
* isdnrep: new format %S
@ -131,6 +137,7 @@
/****************************************************************************/
static int (*print_msg)(const char *, ...) = printf;
static char *_get_avon(char *code, int *Len, int flag);
static char *_get_areacode(char *code, int *Len, int flag);
static int create_runfile(const char *file, const char *format);
@ -178,7 +185,8 @@ static char countrycodes[][2][30] = {
{"", ""},
};
char *avonlib;
static char *avonlib = NULL;
static char *codelib = NULL;
/****************************************************************************/
@ -187,9 +195,7 @@ void set_print_fct_for_lib(int (*new_print_msg)(const char *, ...))
print_msg = new_print_msg;
set_print_fct_for_conffile(new_print_msg);
set_print_fct_for_libtools(new_print_msg);
#ifndef LIBAREA
set_print_fct_for_avon(new_print_msg);
#endif
}
/****************************************************************************/
@ -498,11 +504,11 @@ static int create_runfile(const char *file, const char *format)
muss von jedem Programm aufgerufen werden!!!
*/
#define _MAX_VARS 5
#define _MAX_VARS 7
int Set_Codes(section* Section)
{
static char *ptr[_MAX_VARS] = {NULL,NULL,NULL,NULL,NULL};
static char *ptr[_MAX_VARS] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL};
int i;
int RetCode = 0;
entry *Entry;
@ -520,28 +526,30 @@ int Set_Codes(section* Section)
if ((SPtr = Get_Section(Section,CONF_SEC_GLOBAL)) == NULL)
return -1;
#ifdef LIBAREA
if ((Entry = Get_Entry(SPtr->entries,CONF_ENT_AREALIB)) != NULL &&
Entry->value != NULL )
ptr[0] = acFileName = strdup(Entry->value);
#else
if ((Entry = Get_Entry(SPtr->entries,CONF_ENT_AVONLIB)) != NULL &&
Entry->value != NULL )
ptr[0] = avonlib = strdup(Entry->value);
ptr[1] = avonlib = strdup(Entry->value);
else
{
sprintf(s, "%s%c%s", confdir(), C_SLASH, AVON);
ptr[0] = avonlib = strdup(s);
ptr[1] = avonlib = strdup(s);
}
#endif
if ((Entry = Get_Entry(SPtr->entries,CONF_ENT_COUNTRY_PREFIX)) != NULL &&
Entry->value != NULL )
ptr[1] = countryprefix = strdup(Entry->value);
ptr[2] = countryprefix = strdup(Entry->value);
if ((Entry = Get_Entry(SPtr->entries,CONF_ENT_AREA_PREFIX)) != NULL &&
Entry->value != NULL )
ptr[2] = areaprefix = strdup(Entry->value);
ptr[3] = areaprefix = strdup(Entry->value);
if ((Entry = Get_Entry(SPtr->entries,CONF_ENT_CODELIB)) != NULL &&
Entry->value != NULL )
ptr[4] = codelib = strdup(Entry->value);
if ((Entry = Get_Entry(SPtr->entries,CONF_ENT_AREA)) != NULL &&
Entry->value != NULL )
@ -549,11 +557,11 @@ int Set_Codes(section* Section)
ptr2 = Entry->value;
if (strncmp(Entry->value,areaprefix,strlen(areaprefix)))
ptr[3] = myarea = strdup(ptr2);
ptr[5] = myarea = strdup(ptr2);
else
ptr[3] = myarea = strdup(ptr2+strlen(areaprefix));
ptr[5] = myarea = strdup(ptr2+strlen(areaprefix));
if (ptr[3] != NULL)
if (ptr[5] != NULL)
RetCode++;
else
print_msg("Error: Variable `%s' are not set!\n",CONF_ENT_AREA);
@ -571,7 +579,7 @@ int Set_Codes(section* Section)
ptr2 = s;
}
if ((ptr[4] = mycountry = strdup(ptr2)) != NULL)
if ((ptr[6] = mycountry = strdup(ptr2)) != NULL)
RetCode++;
else
print_msg("Error: Variable `%s' are not set!\n",CONF_ENT_COUNTRY);
@ -635,7 +643,19 @@ char *get_areacode(char *code, int *Len, int flag)
i++;
}
if ((Ptr = _get_areacode(code,Len,flag)) != NULL)
if (codelib != NULL && !strcasecmp(codelib,"AVON"))
Ptr = _get_avon(code,Len,flag);
else
if (codelib != NULL && !strcasecmp(codelib,"AREACODE"))
Ptr = _get_areacode(code,Len,flag);
else
#ifdef LIBAREA
Ptr = _get_areacode(code,Len,flag);
#else
Ptr = _get_avon(code,Len,flag);
#endif
if (Ptr != NULL)
return Ptr;
i=0;
@ -661,8 +681,7 @@ char *get_areacode(char *code, int *Len, int flag)
/****************************************************************************/
#ifndef LIBAREA
static char *_get_areacode(char *code, int *Len, int flag)
static char *_get_avon(char *code, int *Len, int flag)
{
static int opened = 0;
static char s[BUFSIZ];
@ -680,18 +699,13 @@ static char *_get_areacode(char *code, int *Len, int flag)
if (!opened)
{
auto char s[BUFSIZ];
if (avonlib == NULL && !(flag & C_NO_ERROR))
print_msg("No path for AVON library defined!\n");
if (!access(avonlib, R_OK))
{
if (createDB(avonlib, 0) && !openDB(avonlib))
readAVON(avonlib);
else
(void)openDB(avonlib);
createDB(avonlib,0);
openDB(avonlib,O_WRONLY);
}
opened = 1;
@ -723,11 +737,9 @@ static char *_get_areacode(char *code, int *Len, int flag)
return (s[0]?s:NULL);
}
#endif
/****************************************************************************/
#ifdef LIBAREA
static char *_get_areacode(char *code, int *Len, int flag)
{
auto int cc = 0;
@ -767,7 +779,6 @@ static char *_get_areacode(char *code, int *Len, int flag)
return NULL;
}
#endif
/****************************************************************************/

View File

@ -1,5 +1,5 @@
/* $Id: libisdn.h,v 1.6 1997/04/08 21:57:07 luethje Exp $
/* $Id: libisdn.h,v 1.7 1997/05/19 22:58:29 luethje Exp $
*
* ISDN accounting for isdn4linux.
*
@ -20,6 +20,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: libisdn.h,v $
* Revision 1.7 1997/05/19 22:58:29 luethje
* - bugfix: it is possible to install isdnlog now
* - improved performance for read files for vbox files and mgetty files.
* - it is possible to decide via config if you want to use avon or
* areacode.
*
* Revision 1.6 1997/04/08 21:57:07 luethje
* Create the file isdn.conf
* some bug fixes for pid and lock file
@ -45,11 +51,8 @@
#include "policy.h"
#include "conffile.h"
#ifdef LIBAREA
# include "areacode/areacode.h"
#else
# include "avon/createDB.h"
#endif
#include "areacode/areacode.h"
#include "avon/createDB.h"
/****************************************************************************/
@ -115,6 +118,7 @@ extern char *basename __P((__const char *__name));
#define CONF_ENT_AREA "AREACODE"
#define CONF_ENT_AREALIB "AREALIB"
#define CONF_ENT_AVONLIB "AVON"
#define CONF_ENT_CODELIB "CODELIB"
#define CONF_SEC_VAR "VARIABLES"