isdnlog-4.37

- removed "09978 Schoenthal Oberpfalz" from "zone-de.dtag.cdb". Entry was
  totally buggy.

- isdnlog/isdnlog/processor.c ... added err msg for failing IIOCGETCPS

- isdnlog/tools/cdb       ... (NEW DIR) cdb Constant Data Base
- isdnlog/Makefile.in     ... cdb Constant Data Base
- isdnlog/configure{,.in}
- isdnlog/policy.h.in
- isdnlog/FAQ                 sic!
- isdnlog/NEWS
- isdnlog/README
- isdnlog/tools/NEWS
- isdnlog/tools/dest.c
- isdnlog/tools/isdnrate.man
- isdnlog/tools/zone/Makefile.in
- isdnlog/tools/zone/configure{,.in}
- isdnlog/tools/zone/config.h.in
- isdnlog/tools/zone/common.h
- isdnlog/tools/dest/Makefile.in
- isdnlog/tools/dest/configure{,.in}
- isdnlog/tools/dest/makedest
- isdnlog/tools/dest/CDB_File_Dump.{pm,3pm} ... (NEW) writes cdb dump files
- isdnlog/tools/dest/mcdb ... (NEW) convert testdest dumps to cdb dumps

- isdnlog/tools/Makefile ... clean:-target fixed
- isdnlog/tools/telnum{.c,.h} ... TELNUM.vbn was not always initialized
- isdnlog/tools/rate.c ... fixed bug with R:tag and isdnlog not always
                           calculating correct rates (isdnrate worked)

 s. isdnlog/tools/NEWS on details for using cdb. and
    isdnlog/README 20.a Datenbanken for a note about databases (in German).

 As this is the first version with cdb and a major patch there could be
 still some problems. If you find something let me know. <lt@toetsch.at>
This commit is contained in:
akool 2000-08-01 20:31:28 +00:00
parent 0f43decdfa
commit ac6b9f39f9
115 changed files with 5651 additions and 703 deletions

View File

@ -1,3 +1,40 @@
isdnlog-4.xx (SuSE 6.4)
Q: isdnlog logged nichts mehr, isdnrep zeigt keine Gespraeche,
seit einem Update auf SuSE 6.4.
A: Schau in die SuSE-Supportdatenbank, in den Startupfiles ist ein
kleiner Typo.
-----------------------------------------------------------------------
isdnlog-4.xx
Q: Insdlog bring immer Fehler "HINT: LCR:FAILED."
A: Das sind keine Fehler, sondern Meldungen, dass bei dem Telefonat
nicht der billigste konfigurierte Provider (s. rate.conf) Verwendung
fand.
(Hinweis: HINT heisst Hinweis ;-)
-----------------------------------------------------------------------
isdnlog-4.16
Q: Ich habe einen Provider mit sekundengenauer Abrechnung. Isdnlog
muellt mir das Log mit CI-Meldungen voll.
S: $ man isdnlog
/ciinterval
oder lese tools/NEWS
-----------------------------------------------------------------------
[ Sorry fuer die kleine zeitliche Pause ]
-----------------------------------------------------------------------
isdnlog-2.60:
Q: nach jedem Reboot der Maschine (Strg-Alt-Entf) sind alle Daten

View File

@ -1,4 +1,4 @@
## $Id: Makefile.in,v 1.174 2000/07/24 17:02:56 akool Exp $
## $Id: Makefile.in,v 1.175 2000/08/01 20:31:28 akool Exp $
##
## ISDN accounting for isdn4linux.
##
@ -19,6 +19,44 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Log: Makefile.in,v $
## Revision 1.175 2000/08/01 20:31:28 akool
## isdnlog-4.37
## - removed "09978 Schoenthal Oberpfalz" from "zone-de.dtag.cdb". Entry was
## totally buggy.
##
## - isdnlog/isdnlog/processor.c ... added err msg for failing IIOCGETCPS
##
## - isdnlog/tools/cdb ... (NEW DIR) cdb Constant Data Base
## - isdnlog/Makefile.in ... cdb Constant Data Base
## - isdnlog/configure{,.in}
## - isdnlog/policy.h.in
## - isdnlog/FAQ sic!
## - isdnlog/NEWS
## - isdnlog/README
## - isdnlog/tools/NEWS
## - isdnlog/tools/dest.c
## - isdnlog/tools/isdnrate.man
## - isdnlog/tools/zone/Makefile.in
## - isdnlog/tools/zone/configure{,.in}
## - isdnlog/tools/zone/config.h.in
## - isdnlog/tools/zone/common.h
## - isdnlog/tools/dest/Makefile.in
## - isdnlog/tools/dest/configure{,.in}
## - isdnlog/tools/dest/makedest
## - isdnlog/tools/dest/CDB_File_Dump.{pm,3pm} ... (NEW) writes cdb dump files
## - isdnlog/tools/dest/mcdb ... (NEW) convert testdest dumps to cdb dumps
##
## - isdnlog/tools/Makefile ... clean:-target fixed
## - isdnlog/tools/telnum{.c,.h} ... TELNUM.vbn was not always initialized
## - isdnlog/tools/rate.c ... fixed bug with R:tag and isdnlog not always
## calculating correct rates (isdnrate worked)
##
## s. isdnlog/tools/NEWS on details for using cdb. and
## isdnlog/README 20.a Datenbanken for a note about databases (in German).
##
## As this is the first version with cdb and a major patch there could be
## still some problems. If you find something let me know. <lt@toetsch.at>
##
## Revision 1.174 2000/07/24 17:02:56 akool
## isdnlog-4.36
## - added new provider 01017.com
@ -1248,6 +1286,7 @@ MYSQLDIR := @MYSQLDIR@
ORACLE := @ORACLE@
SERV_PORT := @SERV_PORT@
USERFILE := @USERFILE@
CDBEXTRALIBS := @CDBEXTRALIBS@
DEFS :=
SUBDIRS := tools/zone tools/dest
@ -1295,7 +1334,7 @@ SERVICEFILE = /etc/services
# DON'T EDIT BELOW THIS LINE
######################################################################
VERSION = 4.36
VERSION = 4.37
MANPAGES = isdnlog/callerid.conf.5 isdnlog/isdn.conf.5 \
isdnlog/isdnformat.5 isdnlog/isdnlog.5 isdnlog/isdnlog.8 \
@ -1373,7 +1412,7 @@ ISDNLOG_OBJS = isdnlog/isdnlog.o isdnlog/processor.o isdnlog/functions.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 \
$(LIBISDNDIR)/libisdn.a
$(LIBISDNDIR)/libisdn.a $(CDBEXTRALIBS)
ifeq ($(POSTGRES),1)
@ -1396,24 +1435,24 @@ 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/holiday.o tools/dest.o \
tools/telnum.o \
$(LIBISDNDIR)/libisdn.a
$(LIBISDNDIR)/libisdn.a $(CDBEXTRALIBS)
ISDNBILL_OBJS = isdnrep/isdnbill.o tools/tools.o tools/isdnconf.o \
isdnlog/messages.o \
tools/rate.o tools/zone.o tools/holiday.o tools/dest.o \
tools/telnum.o \
$(LIBISDNDIR)/libisdn.a
$(LIBISDNDIR)/libisdn.a $(CDBEXTRALIBS)
ISDNCONF_OBJS= isdnconf/isdnconf.o tools/tools.o tools/isdnconf.o \
tools/rate.o tools/zone.o tools/holiday.o \
tools/telnum.o tools/dest.o \
$(LIBISDNDIR)/libisdn.a
$(LIBISDNDIR)/libisdn.a $(CDBEXTRALIBS)
ISDNRATE_OBJS= tools/isdnrate.o tools/isdnconf.o tools/tools.o \
tools/rate.o tools/zone.o tools/dest.o \
tools/holiday.o \
tools/telnum.o \
$(LIBISDNDIR)/libisdn.a
$(LIBISDNDIR)/libisdn.a $(CDBEXTRALIBS)
ORA_LOAD_OBJS= isdnlog/ora_load.o isdnlog/oracle.o
@ -1490,7 +1529,7 @@ uninstall: rootperm
$(DESTDIR)$(MAN5DIR)/isdnformat$(MAN5EXT) \
$(DESTDIR)$(DATADIR)/country-$(NATION).dat \
$(DESTDIR)$(DATADIR)/rate-$(NATION).dat \
$(DESTDIR)$(DATADIR)/dest.gdbm
$(DESTDIR)$(DATADIR)/dest.{gdbm,db,cdb}
installdirs: rootperm
@ -1574,7 +1613,7 @@ install-data:
$(INSTALL_DATA) country-de.dat $(DESTDIR)$(DATADIR)
$(INSTALL_DATA) rate-$(NATION).dat $(DESTDIR)$(DATADIR)
$(INSTALL_DATA) holiday-$(NATION).dat $(DESTDIR)$(DATADIR)
@for f in `ls zone-$(NATION)-*.{gdbm,db} tools/dest/dest.{gdbm,db} 2>/dev/null` ; do \
@for f in `ls zone-$(NATION)-*.{gdbm,db,cdb} tools/dest/dest.{gdbm,db,cdb} 2>/dev/null` ; do \
$(INSTALL_DATA) $$f $(DESTDIR)$(DATADIR); \
echo Installing $(DESTDIR)$(DATADIR)/$$f; \
done

View File

@ -1,5 +1,11 @@
isdnlog news
lt 2000.06.27
isdnlog/rate/rep use not cdb as default database.
s. tools/NEWS for details.
lt 2000.03.08-09
changed/new isdnlog options / parameters

View File

@ -1,4 +1,4 @@
ISDNLOG - Version 4.25 - 27-May-2000
ISDNLOG - Version 4.37 - 27-July-2000
isdnlog ist ein Utility zur Auswertung des D-Kanals eines
@ -17,9 +17,9 @@ Quick-Installation-Guide
CONFIG_ISDN=m
CONFIG_ISDN_DRV_HISAX=m
2. isdn4k-utils-3.0.tar.gz auspacken, erstellen und installieren:
2. isdn4k-utils-3.1.tar.gz auspacken, erstellen und installieren:
cd /usr/src
tar xzf isdn4k-utils-3.0.tar.gz
tar xzf isdn4k-utils-3.1.tar.gz
cd isdn4k-utils
make config
make
@ -35,25 +35,21 @@ Quick-Installation-Guide
NUMBER = 4711
SI = 1
ALIAS = My Phone
ZONE = 1
[MSN]
NUMBER = 4712
SI = 1
ALIAS = FAX
ZONE = 1
[MSN]
NUMBER = 4713
SI = 1
ALIAS = X.75
ZONE = 1
-----------------------------------------------------
NUMBER = <eigene_Telefonnumer_ohne_Vorwahl>
SI = <Dienstkennung>
ALIAS = <Alias>
ZONE = 1
4. isdn4linux das D-Kanal-Protokoll entlocken:
@ -118,6 +114,7 @@ Inhalt:
18. LCR (Least cost router)
19. Probleme?
20. Verwendete Dateien
20.a Datenbanken
21. Verwendete Environment-Variablen
22. Verwendete Abkuerzungen
23. Danksagung
@ -129,68 +126,6 @@ Vorwort
Die Logdatei "isdn.log" ist nicht mehr im Verzeichnis "/var/adm/,
sondern im Verzeichnis "/var/log" zu Hause.
Fuer die isdn4linux-Version ("ISDN subsystem Rev: 1.5/1.5/1.5/1.5")
respektive Linux-1.3.93 _muss_ isdnlog mit "-DSELECT_FIX"
erstellt werden. Dadurch wird ein kleiner Bug in dieser Version umgangen.
Dadurch entfaellt leider auch die Durchsatz-Raten-Ermittlung!
Anmerkung:
Der X11-Version (isdnlog-X11-2.43.tar.gz) liegen einige Sound-Dateien
als Samples bei.
Diese Datei unterliegen _nicht_ dem GPL. Diese sind nur als Beigaben
der Autoren zu Betrachten und stehen in keinem Zusammenhang mit den
Sourcen.
Es wurden folgende Dinge geaendert, die vor dem ersten Start
dieser neuen Version unbedingt angepasst werden muessen!
Aenderungen seit Version 2.60:
- Unterstuetzung fuer die seit 1.1.1998 moeglichen privaten
Telefongesellschaften
Aenderungen seit Version 2.50:
- Konfigurationsdateien heissen jetzt isdn.conf, callerid.conf und
~/.isdn statt isdnlog.conf
- Neue Syntax der Konfigurationsdateien
- Watchdog-Funktion (isdnlog ueberwacht isdn4linux)
- HTML-Ausgabe des isdnrep
Aenderungen seit Version 2.41:
- Das neue Feature "Rueckruf bei Besetzt" der Telekom wird erkannt,
und ignoriert
Aenderungen seit Version 2.30:
- Die "isdnlog.conf" hat fuer die Flags eine komplett neue
Syntax erhalten.
- Die Optionen -c und -i sind entfallen. Diese wurden durch die
ueberarbeitete Option -S ersetzt.
- Die -C x Option wurde geaendert. Es muss jetzt dort der gesamte
Pfad angegeben werden:
Vorher "-C p7 -> /dev/ttyp7",
jetzt "-C /dev/ttyp7"
Aenderungen seit Version 2.01:
- Die "isdnlog.conf" gehoert nun in das Verzeichnis
"/etc/isdn" ... anstelle von "/etc"
- Die "isdnlog.conf" hat neue Spalten erhalten, die _unbedingt_
in bestehende Dateien einzutragen sind
- Alle Telefonnummern in der "isdnlog.conf" muessen nun -
ausser den eigenen MSN's - mit der korrekten Anzahl vorlaufender
Nullen eingetragen werden
- Diverse Command-Line-Argumente von isdnlog haben erweiterte
oder geaenderte Funktionen erhalten.
Ein Bitte noch:
===============
@ -321,8 +256,8 @@ isdnlog sammelt all diese Informationen, und gestattet damit folgendes:
--------------------------
Z.Zt. arbeitet isdnlog _nur_ mit dem HiSax-Treiber (d.h. allen passiven
Karten) sowie der AVM-B1 zusammen, die ICN-Karte wird leider noch nicht
unterstuetzt.
Karten) sowie der AVM-B1 und der Eicon DIVA Server 4?BRI zusammen,
die ICN-Karte wird leider noch nicht unterstuetzt.
Weiterhin kann isdnlog bei allen rausgehenden Verbindungen, die nicht
mit der ISDN-Karte entstanden sind (ISDN-Telefon, Modem/Fax etc. am
@ -542,6 +477,7 @@ COUNTRYFILE = /usr/lib/isdn/country-de.dat
Diese Datei beinhaltet Laenderbezeichnungen und Vorwahlen. Sie dient
als Ausgangsbasis zum Erzeugen der Destination-Datenbank dest.gdbm.
s. [20.a] Datenbanken
RATEFILE= /usr/lib/isdn/rate-de.dat
@ -565,10 +501,12 @@ ZONEFILE= /usr/lib/isdn/zone-de-%s.gdbm
ersetzt.
s. auch isdnlog/samples/isdn.conf.CC fuer verschiedene Konfigurationen.
s. [20.a] Datenbanken
DESTFILE= /usr/lib/isdn/dest.gdbm
Destination Database mit Ortsnamen und Vorwahlen
s. [20.a] Datenbanken
VBN = Verbindungsnetzbetreiberauswahlnummer
@ -4590,6 +4528,29 @@ Folgende Files werden von diesem System verwendet:
/tmp/isdnctrl0 - Protokoll obiger Devices als ASCII-Datei
/usr/X11R6/lib/X11/app-defaults/Isdn - Resourcefile fuer xisdn
s. [20.a] Datenbanken
20.a Datenbanken
----------------
In alle den vorhergehenden Beispielen wurde '.gdbm' als Endung der
Zonen- oder Destination-Datenbank genannt. Das haengt aber von der
vorhandenen Konfiguration ab, welche Datenbank-Bibliotheken auf dem
Rechner unterstuetzt sind.
Ueber die Erkennung und das Verwenden verschiedenr DB-Systeme gibt
es in der exim-Dokumentation (www.exim.org, [.tgz..] doc/dbm.discuss.txt)
eine sehr ausfuehrliche Zusammenfassung.
Isdnlog/rep/rate verwendeten bis dato (27.7.2000) den Gnu Database Manager
(gdbm) als Standard, Konfigurationsoptionen fuer ndbm und db sind zwar
vorhanden, ich weiss aber nicht, ob sie funktionieren.
Nun verwendet isdnlog standardmaessig die Constant DataBase von
D. J. Bernstein <http://cr.yp.to/cdb.html>.
In tools/NEWS ist u.a. auch eine Prozedur zum Switchen zwischen gdbm und
cdb beschrieben.
21. Verwendete Environment-Variablen
------------------------------------

75
isdnlog/TelDa.Net.i Normal file
View File

@ -0,0 +1,75 @@
#
# $Id: TelDa.Net.i,v 1.1 2000/08/01 20:31:29 akool Exp $
#
# G:15-Jan-2000
C:TelDa.Net
C:Address:Telefon-, Daten- und Fax-Transfer GmbH & Co. KG, Schuppertsgasse 30, 35083 Wetter (Hessen)
C:Address:TeDaFax, Telefon-, Daten- und Faxtransfer AG, Postfach 2206, 35010 Marburg
C:Homepage:http://www.teldafax.de
C:Hotline:0800/01030-23
C:Hotfax:0800/01030-33
C:Maintainer:Tarif Datenbank Crew <rates@gmx.de>
C:Special:Die Homepage der Tarif-Datenbank Crew: http://www.digitalprojects.com/rates
#
# ACHTUNG:
# Hierbei handelt es sich um das "CeBIT Sonderangebot" der TelDaFax
# Nach einer Anmeldung (Zugangsnummer: "CEBIT-M70F35QVYPGT76")
# kann dieser Dienst f<EFBFBD>r 3 Monate zum Preis von
# DM 0,029/Minute genutzt werden, danach kostet dieser Dienst
# DM 0,06/Minute
#
# Damit "isdnlog" diesen Tarif korrekt abrechnet, müssen folgende Schritte
# unternommen werden:
#
# 1. In der "/usr/lib/isdn/rate-de.dat" muß im Kapitel
# "P:30,0 TelDaFax"
# der Eintrag
# "I:TelDa.Net.i" eingefügt werden.
#
# 2. Das untige Datum 1.6.2000 muß durch das persönliche Ablaufdatum für
# dieses Sonderangebot abgeändert werden.
#
Z:109
A:08000103021
T:[-01.06.2000] */*=0.029/60
T:[01.06.2000] */*=0.06/60
#####################################################################
##L $Log: TelDa.Net.i,v $
##L Revision 1.1 2000/08/01 20:31:29 akool
##L isdnlog-4.37
##L - removed "09978 Schoenthal Oberpfalz" from "zone-de.dtag.cdb". Entry was
##L totally buggy.
##L
##L - isdnlog/isdnlog/processor.c ... added err msg for failing IIOCGETCPS
##L
##L - isdnlog/tools/cdb ... (NEW DIR) cdb Constant Data Base
##L - isdnlog/Makefile.in ... cdb Constant Data Base
##L - isdnlog/configure{,.in}
##L - isdnlog/policy.h.in
##L - isdnlog/FAQ sic!
##L - isdnlog/NEWS
##L - isdnlog/README
##L - isdnlog/tools/NEWS
##L - isdnlog/tools/dest.c
##L - isdnlog/tools/isdnrate.man
##L - isdnlog/tools/zone/Makefile.in
##L - isdnlog/tools/zone/configure{,.in}
##L - isdnlog/tools/zone/config.h.in
##L - isdnlog/tools/zone/common.h
##L - isdnlog/tools/dest/Makefile.in
##L - isdnlog/tools/dest/configure{,.in}
##L - isdnlog/tools/dest/makedest
##L - isdnlog/tools/dest/CDB_File_Dump.{pm,3pm} ... (NEW) writes cdb dump files
##L - isdnlog/tools/dest/mcdb ... (NEW) convert testdest dumps to cdb dumps
##L
##L - isdnlog/tools/Makefile ... clean:-target fixed
##L - isdnlog/tools/telnum{.c,.h} ... TELNUM.vbn was not always initialized
##L - isdnlog/tools/rate.c ... fixed bug with R:tag and isdnlog not always
##L calculating correct rates (isdnrate worked)
##L
##L s. isdnlog/tools/NEWS on details for using cdb. and
##L isdnlog/README 20.a Datenbanken for a note about databases (in German).
##L
##L As this is the first version with cdb and a major patch there could be
##L still some problems. If you find something let me know. <lt@toetsch.at>
##L

388
isdnlog/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -128,9 +128,20 @@ AC_PROG_MAKE_SET
AC_PATH_PROGS(BZIP2, bzip2, /usr/bin/bzip2, $PATH:/bin:/usr/bin:/usr/local/bin)
dnl Checks for libraries.
if test -e tools/cdb/i4l_cdb.c ; then
AC_DEFINE(USE_CDB)
CDBEXTRALIBS="tools/cdb/i4l_cdb.a tools/cdb/cdb.a tools/cdb/buffer.a tools/cdb/unix.a tools/cdb/byte.a tools/cdb/alloc.a"
DBEXT=".cdb"
RDBEXT=".cdb"
AC_MSG_RESULT(Using 'cdb' as database)
else
AC_CHECK_LIB(gdbm, gdbm_open, DBMLIB=-lgdbm; AC_DEFINE(HAVE_LIBGDBM),
AC_CHECK_LIB(dbm, dbm_open, DBMLIB=-ldbm; AC_DEFINE(HAVE_LIBDBM),
AC_CHECK_LIB(db, dbm_open, DBMLIB=-ldb; AC_DEFINE(HAVE_LIBDB))))
fi
AC_DEFINE_UNQUOTED(RDBEXT,"$RDBEXT")
dnl log database support
AC_CHECK_POSTGRES
AC_CHECK_MYSQLDB
AC_CHECK_ORACLE
@ -247,4 +258,5 @@ AC_SUBST(MANDATE_ISDNLOG8)
AC_SUBST(MANDATE_ISDNLOG_USERS)
AC_SUBST(MANDATE_ISDNREP)
AC_SUBST(MANDATE_ISDNCONF)
AC_SUBST(CDBEXTRALIBS)
AC_OUTPUT(Makefile isdnlog/callerid.conf.5 isdnlog/isdn.conf.5 isdnlog/isdnformat.5 isdnlog/isdnlog.5 isdnlog/isdnlog.8 isdnlog/isdnlog.users.5 isdnrep/isdnrep.1 isdnconf/isdnconf.1)

View File

@ -1,4 +1,4 @@
/* $Id: processor.c,v 1.109 2000/07/07 19:38:30 akool Exp $
/* $Id: processor.c,v 1.110 2000/08/01 20:31:30 akool Exp $
*
* ISDN accounting for isdn4linux. (log-module)
*
@ -19,6 +19,44 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: processor.c,v $
* Revision 1.110 2000/08/01 20:31:30 akool
* isdnlog-4.37
* - removed "09978 Schoenthal Oberpfalz" from "zone-de.dtag.cdb". Entry was
* totally buggy.
*
* - isdnlog/isdnlog/processor.c ... added err msg for failing IIOCGETCPS
*
* - isdnlog/tools/cdb ... (NEW DIR) cdb Constant Data Base
* - isdnlog/Makefile.in ... cdb Constant Data Base
* - isdnlog/configure{,.in}
* - isdnlog/policy.h.in
* - isdnlog/FAQ sic!
* - isdnlog/NEWS
* - isdnlog/README
* - isdnlog/tools/NEWS
* - isdnlog/tools/dest.c
* - isdnlog/tools/isdnrate.man
* - isdnlog/tools/zone/Makefile.in
* - isdnlog/tools/zone/configure{,.in}
* - isdnlog/tools/zone/config.h.in
* - isdnlog/tools/zone/common.h
* - isdnlog/tools/dest/Makefile.in
* - isdnlog/tools/dest/configure{,.in}
* - isdnlog/tools/dest/makedest
* - isdnlog/tools/dest/CDB_File_Dump.{pm,3pm} ... (NEW) writes cdb dump files
* - isdnlog/tools/dest/mcdb ... (NEW) convert testdest dumps to cdb dumps
*
* - isdnlog/tools/Makefile ... clean:-target fixed
* - isdnlog/tools/telnum{.c,.h} ... TELNUM.vbn was not always initialized
* - isdnlog/tools/rate.c ... fixed bug with R:tag and isdnlog not always
* calculating correct rates (isdnrate worked)
*
* s. isdnlog/tools/NEWS on details for using cdb. and
* isdnlog/README 20.a Datenbanken for a note about databases (in German).
*
* As this is the first version with cdb and a major patch there could be
* still some problems. If you find something let me know. <lt@toetsch.at>
*
* Revision 1.109 2000/07/07 19:38:30 akool
* isdnlog-4.30
* - isdnlog/tools/rate-at.c ... 1001 onlinetarif
@ -4956,9 +4994,10 @@ void processflow()
register int j;
auto char sx[BUFSIZ];
auto double s;
int ret;
static int tries = 3;
if (!ioctl(sockets[ISDNINFO].descriptor, IIOCGETCPS, &io)) {
if (!(ret=ioctl(sockets[ISDNINFO].descriptor, IIOCGETCPS, &io))) {
if (verbose & VERBOSE_FLOW) {
p = sx;
@ -4986,6 +5025,10 @@ void processflow()
processbytes();
} /* if */
else if (tries) {
tries--;
print_msg(PRT_ERR, "Can't read iobytes: ioctl IIOCGETCPS returned %d\n", ret);
}
} /* processflow */

View File

@ -134,3 +134,7 @@
/* Command for rebooting */
#undef REBOOTCMD
/* Use CDB instead of g?dbm? */
/* rename tools/cdb/i4l_cdb.c, if you want to use gdbm */
#undef USE_CDB

View File

@ -1,4 +1,4 @@
V:1.10-Germany [24-Jul-2000 17:55:09]
V:1.10-Germany [01-Aug-2000 21:46:58]
# Währungsformat
U:%.3f DM
@ -8,7 +8,7 @@ U:%.3f DM
#
# (C) Copyright 1999, 2000 by Andreas Kool (akool@isdn4linux.de)
#
# $Id: rate-de.dat,v 1.102 2000/07/24 17:02:56 akool Exp $
# $Id: rate-de.dat,v 1.103 2000/08/01 20:31:29 akool Exp $
#
#
# Das "A:" Tag muß folgendermaßen gefüllt werden:
@ -6478,6 +6478,9 @@ A:+49
T:W/09-18=0.09/60
T:W/18-09=0.07/60
T:E,H/*=0.07/60
Z:10 Mobilfunk
A:_DEMF
T:*/*=99.99/1
Z:200 Türkei
A:TR
T:*/*=0.33/60
@ -12295,7 +12298,7 @@ T:*/*=0.12/2.31
P:33,4 DTAG AktivPlus
# Dieser Tarif gilt auch bei T-ISDN 300
B:01033
# G:01-Jul-2000
# G:01-Aug-2000
D:dtag
C:Name:Deutsche Telekom AG AktivPlus
C:Address:Deutsche Telekom AG, Friedrich-Ebert-Allee 140, 53113 Bonn
@ -12359,9 +12362,9 @@ T:W/18-09=0.03/60 Moonshine
T:E,H/*=0.03/60 Spar
Z:3-4 GermanCall
A:DE
T:W/09-18=0.12/60 Sunshine
T:W/18-09=0.06/60 Moonshine
T:E,H/*=0.06/60 Spar
T:W/09-18=0.09/60 Sunshine
T:W/18-09=0.05/60 Moonshine
T:E,H/*=0.05/60 Spar
Z:10 C-Mobilboxen
A:_DEMCM
T:*/*=0.12/16.7
@ -22056,12 +22059,7 @@ Z:2-4 Ferngespr
A:DE
T:*/*=0.07/60
Z:10 Mobilfunk
A:_DEMC
A:_DEMCM
A:_DEMD1
A:_DEMD2
A:_DEME1
A:_DEME2
A:_DEMF
T:*/*=0.40/60
Z:40 Telefonauskunft Inland (Austria, dial 01051004366211811)
A:+4366211811
@ -22318,6 +22316,7 @@ A:_BMMF
A:_PRMF
A:_DZMF
A:_AEMF
T:*/*=99.99/1
#####################################################################
#
#
@ -22925,6 +22924,44 @@ Z:209 Welt IV
A:+
T:*/*=2.19(60)/1
#####################################################################
P:63,2 KDD-Conos CbC
B:01063
C:Corporate Network & Services Aktiengesellschaft Lievelingsweg 125 52119 Bonn 01063
C:Address:Corporate Network & Services Aktiengesellschaft, Lievelingsweg 125, 5
C:URL: http://www.kdd-conos.de
C:Name:KDD-Conos PrivateCall genau
C:Maintainer:Tarif Datenbank Crew <crew@rates4linux.sourceforge.net>
C:Special:Die Homepage der Tarif-Datenbank Crew: http://www.digitalprojects.com
C:Special:Preselection
C:Special:Sondertarif für Gespräche zu KDD-Conos Mobilfunkteilnehmern vorhanden
C:Preselection
C:Erfasste Zonen:
C:0 - 4 Deutschland
C:5 Sondertarif
C:10 Mobilfunk
C:200 - 209 Ausland
C:Sondertarif 5: Gespräche zu KDD-Conos Mobilfunkteilnehmern
# G: 19-Jul-2000
Z:0 FreeCall
A:011*
A:0130*,0800*,0801*
A:031*
A:110
A:112
T:*/*=0
Z:10 Mobilfunk
A:_DEMF
T:*/*=0.49(60)/30
Z:200 Frankreich
A:FR
T:*/*=0.11(60)/30
Z:201 Frankreich Mobilfunk
A:_FRMF
T:*/*=0.49(60)/30
Z:202 USA
A:US
T:*/*=0.119(60)/30
#####################################################################
#
#
P:64,0 Hannoversche
@ -23127,47 +23164,37 @@ A:110
A:112
T:*/*=0
Z:1-3 Regio Plus
T:[-29.02.2000]W/06-09=0.07/60
T:[-29.02.2000]W/09-18=0.14/60
T:[-29.02.2000]W/18-21=0.07/60
T:[-29.02.2000]W/21-06=0.04/60
T:[-29.02.2000]E,H/06-21=0.07/60
T:[-29.02.2000]E,H/21-06=0.04/60
T:[01.03.2000-]W/07-18=0.14/60
T:[01.03.2000-]W/18-21=0.05/60
T:[01.03.2000-]W/21-07=0.04/60
T:[01.03.2000-]E/07-21=0.05/60
T:[01.03.2000-]E/21-07=0.04/60
T:W/07-18=0.14/60
T:W/18-21=0.044/60
T:W/21-07=0.039/60
T:E,H/07-21=0.044/60
T:E,H/21-07=0.039/60
Z:4 Fern
A:+49
T:[-29.02.2000]W/06-09=0.08/60
T:[-29.02.2000]W/09-18=0.18/60
T:[-29.02.2000]W/18-21=0.08/60
T:[-29.02.2000]W/21-06=0.06/60
T:[-29.02.2000]E,H/06-21=0.08/60
T:[-29.02.2000]E,H/21-06=0.06/60
T:[01.03.2000-]W/07-18=0.18/60
T:[01.03.2000-]W/18-21=0.05/60
T:[01.03.2000-]W/21-07=0.04/60
T:[01.03.2000-]E/07-21=0.05/60
T:[01.03.2000-]E/21-07=0.04/60
Z:10-12,15 D1,C,E2-Netz
A:_DEMD1
T:W/07-18=0.18/60
T:W/18-21=0.044/60
T:W/21-07=0.039/60
T:E,H/07-21=0.044/60
T:E,H/21-07=0.039/60
Z:10 C Netz
A:_DEMC,_DEMCM
A:_DEME2
T:W/09-18=0.96/60 Hauptzeit
T:W/18-09=0.48/60 Nebenzeit
T:W/07-18=0.96/60 Hauptzeit
T:W/18-07=0.48/60 Nebenzeit
T:E,H/*=0.48/60 Freizeit
Z:13 D2
Z:11 D1 Netz
A:_DEMD1
T:*/*=0.48/60
Z:12 D2 Netz
A:_DEMD2
T:W/09-18=0.94/60 Hauptzeit
T:W/18-09=0.46/60 Nebenzeit
T:W/07-18=0.48/60 Hauptzeit
T:W/18-07=0.46/60 Nebenzeit
T:E,H/*=0.46/60 Freizeit
Z:14 E-Plus
Z:14 E-Plus Netz
A:_DEME1
T:W/09-18=1.25/60 Hauptzeit
T:W/18-09=0.56/60 Nebenzeit
T:E,H/*=0.56/60 Freizeit
T:*/*=0.54/60
Z:15 E2 Netz
A:_DEME2
T:*/*=0.57/60
Z:200 Euro
A:NL
A:BE
@ -23179,7 +23206,7 @@ A:IE
A:FI
A:IT
A:AT
T:*/*=0.46/60
T:*/*=0.24/60
Z:201 Euro Plus
A:FO
A:GR
@ -23599,7 +23626,7 @@ T:*/*=0
#
P:75,0 Callino
B:01075
# G:01-Feb-2000
# G:01-Aug-2000
C:Address:ARCIS Media Com Management GmbH, Maximilianstr. 14, 80539 München
C:Name:Callino
C:Maintainer:Tarif Datenbank Crew <crew@rates4linux.sourceforge.net>
@ -23614,19 +23641,12 @@ A:112
T:*/*=0
Z:1-4 Fern
A:+49
T:W/08-18=0.119/60
T:W/18-21=0.079/60
T:W/21-06=0.059/60
T:W/06-08=0.079/60
T:E,H/06-21=0.079/60
T:E,H/21-06=0.059/60
Z:10-12,15 D1,D2,C,E2-Netz
A:_DEMD1
A:_DEMD2
A:_DEMC,_DEMCM
A:_DEME2
A:_DEME1
T:*/*=0.89/60
T:W/08-16=0.099/60
T:W/16-08=0.047/60
T:E,H/*=0.047/60
Z:10-12,15 Deutschland Mobilfunk
A:_DEMF
T:*/*=0.59/60
Z:60-66,68-75 Funkruf
A:0164,01682,01683,01684,01685,01687,01688,01689 cityruf automatic
A:016951,016952 cityruf operator
@ -25231,9 +25251,11 @@ A:112
T:*/*=0
Z:1-4 National
A:+49
T:W/06-20=0.063/60
T:W/20-06=0.033/60
T:E,H/*=0.003/60
T:*/06-20=0.063/60
T:*/20-06=0.033/60
Z:10 Mobilfunknetz
A:_DEMF
T:*/*=0.60/60
Z:200 Euro 1 / USA, Kanada # gilt *NICHT* für Mobilfunknetze in diese Länder!
A:DK,FR,UK,CA,NL,SE
A:CH,US
@ -25427,20 +25449,18 @@ A:112
T:*/*=0
Z:1-4 Fern
A:+49
T:W/06-08=0.10/60 Sparzeit
T:W/08-18=0.15/60 Hauptzeit
T:W/18-21=0.10/60 Freizeit
T:W/21-06=0.05/60 Traumzeit
T:E,H/06-21=0.10/60 Freizeit
T:E,H/21-06=0.05/60 Nacht
T:[01.03.2000-31.03.2000]7/*=0.029/60 Maerz-Spezial
T:[15.07.2000-28.08.2000]*/21-06=0.033/60 Sonderangebot
T:W/06-08=0.08/60 Sparzeit
T:W/08-18=0.12/60 Hauptzeit
T:W/18-21=0.08/60 Freizeit
# T:W/21-06=0.05/60 Traumzeit
T:W/21-06=0.033/60 Sonderangebot # g<>ltig vom 15.7.2000 bis 27.8.2000
T:E,H/06-21=0.08/60 Freizeit
# T:E,H/21-06=0.05/60 Nacht
T:E,H/21-06=0.033/60 Sonderangebot # g<>ltig vom 15.7.2000 bis 27.8.2000
Z:10-15 Mobil
A:_DEMCM
A:_DEMC
A:_DEMD1
A:_DEMD2
A:_DEME1
A:_DEME2
A:_DEMF
T:W/08-18=0.89/60
T:W/18-08=0.49/60 Freizeit
T:E,H/*=0.49/60 Traumzeit

View File

@ -1,197 +1,202 @@
# rate.conf 1.21 07-Jul-00 21:35
# rate.conf 4.37 25-Jul-00 18:31
# P:10=0 # Teleglobe
P:11=0 # o.tel.o CbC
# P:11=1 # o.tel.o private Preselection
# P:11=2 # o.tel.o private plus Preselection
# P:11=3 # o.tel.o professional plus Preselection
# P:11=4 # o.tel.o international plus Preselection
# P:12=0 # Tele Danmark
# P:13=0 # Tele 2 Privatkunden # ACHTUNG: Kein CbC ... AK-spezifisch!
# P:13=1 # Tele 2 Preselection
# P:14=0 # EWE TEL CbC national
# P:14=1 # EWE TEL CbC/pre-select regional
# P:14=2 # EWE TEL direct
P:15=0 # RSL clever call
# P:15=1 # RSL CleverLine global
# P:15=2 # RSL CleverLine metropolitan
# P:16=0 # LausitzNet
# P:17=0 # 01017
# P:18=0 # debitel
# P:18=1 # debitel DirectLine Profi-Tarif 30 Sekunden
# P:18=2 # debitel DirectLine Privat-Tarif Sekunden Takt
# P:18=3 # debitel DirectLine Profi-Tarif Sekunden Takt
P:19=0 # Mobilcom CbC
# P:19=1 # Mobilcom Preselection/Business
# P:19=2 # Mobilcom Preselection/Privat
# P:19=3 # Mobilcom CbC mit freenet PowerTarif # ACHTUNG: Muss beantragt werden ... AK-spezifisch!
# P:20=0 # ISIS isiFON classic
# P:20=1 # ISIS isiFON plus
# P:20=2 # ISIS Preselection
P:21=0 # QS
# P:22=0 # NetCologne
# P:23=0 # tesion connectClassic
# P:23=1 # tesion connectProfi
# P:23=2 # tesion CbC
# P:24=0 # Telepassport 99 Plus
# P:24=1 # Telepassport Plus
# P:24=2 # Telepassport CbC
# P:24=3 # Telepassport RegionalTarif Plus
# P:24=4 # Telepassport SüdOst-Tarif
# P:24=5 # Telepassport SüdOst
# P:24=6 # Telepassport StudentenTarif
P:24=7 # Super 24
# P:25=0 # CityKom
# P:25=1 # CityKom Preselection
# P:26=0 # ECN
# P:27=0 # Nordcom Butensurf
# P:27=1 # Nordcom Butensurf Plus
# P:28=0 # TeleBridge CbC
# P:28=1 # TeleBridge EasyBridge
# P:28=2 # UPX Super 8
# P:28=3 # Nikoma by Call
# P:29=0 # Unisource
P:30=0 # TelDaFax
# P:31=0 # HEAG
# P:32=0 # KDD
# P:33=0 # DTAG ISDN
P:33=1 # DTAG CityPlus
# P:33=2 # DTAG CityWeekend
# P:33=3 # DTAG CityWeekend & CityPlus
# P:33=4 # DTAG AktivPlus # ACHTUNG: Muss beantragt werden ... AK-spezifisch!
# P:33=5 # DTAG Select 5/30
# P:33=6 # DTAG flatrate
# P:33=7 # DTAG AktivPlus xxl
# P:34=0 # NEFkom
# P:35=0 # interCOM
# P:36=0 # Hutchison fairfon
# P:36=1 # Hutchison easyfon
# P:36=2 # Hutchison o.tel.o private
# P:36=3 # Hutchison fairfon Sekundentakt
# P:36=4 # Hutchison easyfon Sekundentakt
# P:37=0 # ETS
# P:38=0 # MediaWays
P:39=0 # First Telecom CbC
P:40=0 # GTS Esprit
# P:41=0 # HanseNet
# P:41=1 # HanseNet Preselection
# P:42=0 # TeleBeL ISDN Plus
# P:42=1 # TeleBeL ISDN XL
# P:43=0 # KielNet CbC
# P:43=1 # KielNet Preselection
# P:43=2 # KielNet Telefonanschluß
# P:44=0 # VEW TELNET
# P:45=0 # Global Network
# P:46=0 # KomTel
# P:46=1 # KomTel MoinMoin
# P:47=0 # PrimeTec
# P:48=0 # DOKOM
# P:49=0 # ACC ACCess Direkt Pre-Selection Einheitentarif
# P:49=1 # ACC ACCess Direkt Pre-Selection Minutentarif
# P:49=2 # ACC ACCess Einheitentarif CbC
# P:49=3 # ACC ACCess Minutentarif CbC
P:50=0 # Talkline CbC
# P:50=1 # Talkline EasyLine
# P:50=2 # Talkline talkmax
# P:50=3 # Talkline BusinessLine Classic
# P:50=4 # Talkline BusinessLine Local
P:51=0 # 01051
# P:52=0 # Long Distance
# P:53=0 # WOBCOM
# P:54=0 # USFI
P:55=0 # prompt
# P:56=0 # BITel
# P:57=0 # Mox
# P:58=0 # KaTel
# P:59=0 # Pacific Gateway Exchange
# P:60=0 # Telecom-InfoService
# P:61=0 # TelSA
# P:62=0 # DENTEL
# P:63=0 # KDD-Conos PrivateCall easy
# P:63=1 # KDD-Conos PrivateCall genau
# P:64=0 # Hannoversche
# P:65=0 # Rapid Link
P:66=0 # Interoute
# P:67=0 # RegioCom
# P:68=0 # Tele Media
# P:69=0 # Primus
P:70=0 # Arcor CbC
# P:70=1 # Arcor Town to Town
# P:70=2 # Arcor Town to Town Sekunde
# P:71=0 # DeTeMobil
# P:72=0 # Mannesmann
# P:73=0 # AXXON
# P:74=0 # Alpha
P:75=0 # Callino
# P:76=0 # QuickNet
# P:77=0 # E-Plus
P:78=0 # 3U
P:79=0 # Viatel
P:80=0 # Telegate # diesen Dienst gibt es nicht mehr
# P:81=0 # Infotel
# P:82=0 # AugustaKom
# P:83=0 # Wuerzburger
# P:84=0 # Telegroup
# P:85=0 # GTS-WESTCom # Diese Firma gibt es nicht mehr!
# P:86=0 # One.Tel
# P:87=0 # HAMCOM
P:88=0 # WorldCom # ACHTUNG: Kein CbC ... AK-spezifisch!
# P:88=1 # Hutchison CbC
# P:89=0 # M'net
P:90=0 # Viag Interkom
# P:91=0 # IDT
# P:92=0 # Hallo Telefon Service
# P:93=0 # Kray
P:94=0 # Startec
# P:95=0 # Teleos
# P:96=0 # GELSEN-NET
# P:97=0 # AT & T-Unisource
# P:98=0 # Mox
# P:98=1 # Nikocity Study&Surf
# P:98=2 # Nikocity
# P:99=0 # ECONOPHONE
# P:100=0 # TELELEV
# P:100=1 # Meocom
# P:101=0 # Netnet
# P:102=0 # EncoTel
# P:103=0 # mevacom
# P:107=0 # KPN
# P:108=0 # USA Global Link
# P:109=0 # ChemTel
# P:110=0 # Bertelsmann mediaSystems
# P:111=0 # RED LINE
P:112=0 # 11883 Telecom
# P:115=0 # Delta Three
# P:118=0 # MFS
# P:119=0 # E.T.H.
# P:120=0 # Komm Consult
P:121=0 # FITphone
# P:122=0 # Motorola
# P:125=0 # Mediascape
# P:130=0 # tnp telenet
# P:131=0 # accom
# P:132=0 # SD
# P:133=0 # Level 3
# P:140=0 # VossNet
# P:142=0 # connection 42
# P:144=0 # Carrier 1
P:150=0 # Drillisch Superregionen
# P:150=1 # Drillisch
# P:154=0 # Osnatel
# P:155=0 # Telia
# P:156=0 # NETCOM
# P:160=0 # JelloCom
# P:168=0 # VSE
# P:170=0 # Deutsche Telefon- und Marketing Services
# P:173=0 # TFN COM SA
# P:175=0 # Gigabell
# P:177=0 # WorldxChange
# P:178=0 # Cybernet
# P:180=0 # FaciliCom
# P:181=0 # Daten- und Telekommunikations-GmbH Dessau
# P:184=0 # Startec
# P:185=0 # FirstMark
# P:188=0 # jk-tel
# P:190=0 # CNE
# P:195=0 # TeleNec
# P:199=0 # ESTel
# E = echtes Call by Call, d.h. kann sofort ohne Anmeldung genutzt
# werden. Abrechnung erfolgt ueber die Telekom-Rechnung
#
# A = unechtes Call by Call, d.h. man muss sich zuerst anmelden
# P:10=0 #A Teleglobe
P:11=0 #E o.tel.o CbC
# P:11=1 #A o.tel.o private Preselection
# P:11=2 #A o.tel.o private plus Preselection
# P:11=3 #A o.tel.o professional plus Preselection
# P:11=4 #A o.tel.o international plus Preselection
# P:12=0 #A Tele Danmark
# P:13=0 #A Tele 2 Privatkunden
# P:13=1 #A Tele 2 Preselection
# P:14=0 #A EWE TEL CbC national
# P:14=1 #A EWE TEL CbC/pre-select regional
# P:14=2 #A EWE TEL direct
P:15=0 #E RSL clever call
# P:15=1 #A RSL CleverLine global
# P:15=2 #A RSL CleverLine metropolitan
# P:16=0 #A LausitzNet
P:17=0 #E 01017
# P:18=0 #A debitel
# P:18=1 #A debitel DirectLine Profi-Tarif 30 Sekunden
# P:18=2 #A debitel DirectLine Privat-Tarif Sekunden Takt
# P:18=3 #A debitel DirectLine Profi-Tarif Sekunden Takt
P:19=0 #E Mobilcom CbC
# P:19=1 #A Mobilcom Preselection/Business
# P:19=2 #A Mobilcom Preselection/Privat
# P:19=3 #A Mobilcom CbC mit freenet PowerTarif
# P:20=0 #A ISIS isiFON classic
# P:20=1 #A ISIS isiFON plus
# P:20=2 #A ISIS Preselection
P:21=0 #E QSC
# P:22=0 #A NetCologne
# P:23=0 #A tesion connectClassic
# P:23=1 #A tesion connectProfi
P:23=2 #E tesion CbC
# P:24=0 #A Telepassport 99 Plus
# P:24=1 #A Telepassport Plus
# P:24=2 #A Telepassport CbC
# P:24=3 #A Telepassport RegionalTarif Plus
# P:24=4 #A Telepassport SüdOst-Tarif
# P:24=5 #A Telepassport SüdOst
# P:24=6 #A Telepassport StudentenTarif
P:24=7 #E Super 24
# P:25=0 #A CityKom
# P:25=1 #A CityKom Preselection
# P:26=0 #A ECN
# P:27=0 #A Nordcom Butensurf
# P:27=1 #A Nordcom Butensurf Plus
# P:28=0 #A TeleBridge CbC
# P:28=1 #A TeleBridge EasyBridge
# P:28=2 #A UPX Super 8
# P:28=3 #A Nikoma by Call
# P:29=0 #A Unisource
P:30=0 #E TelDaFax
# P:31=0 #A HEAG
# P:32=0 #A KDD
P:33=0 #E DTAG ISDN
# P:33=1 #A DTAG CityPlus
# P:33=2 #A DTAG CityWeekend
# P:33=3 #A DTAG CityWeekend & CityPlus
# P:33=4 #A DTAG AktivPlus
# P:33=5 #A DTAG Select 5/30
# P:33=6 #A DTAG flatrate
# P:33=7 #A DTAG AktivPlus xxl
# P:34=0 #A NEFkom
# P:35=0 #A interCOM
# P:36=0 #A Hutchison fairfon
# P:36=1 #A Hutchison easyfon
# P:36=2 #A Hutchison o.tel.o private
# P:36=3 #A Hutchison fairfon Sekundentakt
# P:36=4 #A Hutchison easyfon Sekundentakt
# P:37=0 #A ETS
# P:38=0 #A MediaWays
P:39=0 #E First Telecom CbC
P:40=0 #E GTS Esprit
# P:41=0 #A HanseNet
# P:41=1 #A HanseNet Preselection
# P:42=0 #A TeleBeL ISDN Plus
# P:42=1 #A TeleBeL ISDN XL
# P:43=0 #A KielNet CbC
# P:43=1 #A KielNet Preselection
# P:43=2 #A KielNet Telefonanschluß
# P:44=0 #A VEW TELNET
# P:45=0 #A Global Network
# P:46=0 #A KomTel
# P:46=1 #A KomTel MoinMoin
# P:47=0 #A PrimeTec
# P:48=0 #A DOKOM
# P:49=0 #A ACC ACCess Direkt Pre-Selection Einheitentarif # diese Firma gibt es nicht mehr
# P:49=1 #A ACC ACCess Direkt Pre-Selection Minutentarif
# P:49=2 #A ACC ACCess Einheitentarif CbC
# P:49=3 #A ACC ACCess Minutentarif CbC
P:50=0 #E Talkline CbC
# P:50=1 #A Talkline EasyLine
# P:50=2 #A Talkline talkmax
# P:50=3 #A Talkline BusinessLine Classic
# P:50=4 #A Talkline BusinessLine Local
P:51=0 #E 01051
# P:52=0 #A Long Distance
# P:53=0 #A WOBCOM
# P:54=0 #A USFI
P:55=0 #E prompt
# P:56=0 #A BITel
# P:57=0 #A Mox
# P:58=0 #A KaTel
# P:59=0 #A Pacific Gateway Exchange
# P:60=0 #A Telecom-InfoService
# P:61=0 #A TelSA
# P:62=0 #A DENTEL
# P:63=0 #A KDD-Conos PrivateCall easy
# P:63=1 #A KDD-Conos PrivateCall genau
P:63=2 #E KDD-Conos CbC
# P:64=0 #A Hannoversche
# P:65=0 #A Rapid Link
P:66=0 #E Interoute
# P:67=0 #A RegioCom
# P:68=0 #A Tele Media
# P:69=0 #A PTI Primus
P:70=0 #E Arcor CbC
# P:70=1 #A Arcor Town to Town
# P:70=2 #A Arcor Town to Town Sekunde
# P:71=0 #A DeTeMobil
# P:72=0 #A Mannesmann
# P:73=0 #A AXXON
# P:74=0 #A Alpha
P:75=0 #E Callino
# P:76=0 #A QuickNet
# P:77=0 #A E-Plus
P:78=0 #E 3U
P:79=0 #E Viatel
# P:80=0 #E Telegate # diesen Dienst gibt es seit 14.3.2000 nicht mehr
# P:81=0 #A Infotel
# P:82=0 #A AugustaKom
# P:83=0 #A Wuerzburger
# P:84=0 #A Telegroup
# P:85=0 #E GTS-WESTCom # Diese Firma gibt es seit 31.12.1999 nicht mehr!
P:86=0 #E One.Tel
# P:87=0 #A HAMCOM
# P:88=0 #A WorldCom
# P:88=1 #A Hutchison CbC
# P:89=0 #A M'net
P:90=0 #E Viag Interkom
# P:91=0 #A IDT
# P:92=0 #A Hallo Telefon Service
# P:93=0 #A Kray
P:94=0 #E Startec
# P:95=0 #A Teleos
# P:96=0 #A GELSEN-NET
# P:97=0 #A AT & T-Unisource
# P:98=0 #A Mox
# P:99=0 #A ECONOPHONE
# P:100=0 #A TELELEV
# P:100=1 #A Meocom
# P:101=0 #A Netnet
# P:102=0 #A EncoTel
# P:103=0 #A mevacom
# P:107=0 #A KPN
# P:108=0 #A USA Global Link
# P:109=0 #A ChemTel
# P:110=0 #A Bertelsmann mediaSystems
# P:111=0 #A RED LINE
P:112=0 #E 11883 Telecom
# P:114=0 #A <FREI>
# P:115=0 #A Delta Three
# P:118=0 #A MFS
# P:119=0 #A E.T.H.
# P:120=0 #A Komm Consult
P:121=0 #E FITphone
# P:122=0 #A Motorola
# P:125=0 #A Mediascape
# P:130=0 #A tnp telenet
# P:131=0 #A accom
# P:132=0 #A SD
# P:133=0 #A Level 3
# P:140=0 #A VossNet
# P:142=0 #A connection 42
# P:144=0 #A Carrier 1
# P:150=0 #E Drillisch Superregionen
P:150=1 #A Drillisch
# P:154=0 #A Osnatel
# P:155=0 #A Telia
# P:156=0 #A NETCOM
# P:160=0 #A JelloCom
# P:168=0 #A VSE
# P:170=0 #A Deutsche Telefon- und Marketing Services
# P:173=0 #A TFN COM SA
# P:175=0 #A <FREI>
# P:177=0 #A WorldxChange
# P:178=0 #A Cybernet
# P:180=0 #A FaciliCom
# P:181=0 #A Daten- und Telekommunikations-GmbH Dessau
# P:184=0 #A <FREI>
# P:185=0 #A FirstMark
# P:188=0 #A jk-tel
# P:190=0 #A CNE
# P:195=0 #A TeleNec
# P:199=0 #A ESTel

View File

@ -9,10 +9,11 @@ rate: rate.u zone.u country.u holiday.u dest.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
AT: rate-at country
./rate-at > rate-at.dat
(cd dest;./pp_rate ../rate-at.dat ../../rate-at.dat)
rm rate-at.dat
AT-leo: rate-at
./rate-at -leo > rate-at.dat
(cd dest;./pp_rate ../rate-at.dat ../../rate-at.dat)
@ -54,4 +55,4 @@ holiday.u: holiday.c holiday.h
${CC} -c -o holiday.u holiday.c
clean:
rm -f rate holiday *.u *~ rate-at
rm -f rate holiday *.{u,o} *~ rate-at

View File

@ -1,5 +1,38 @@
NEWS for tools: (rate, isdnrate, isdnrep)
2000.07.27
The isdnlog/rep/rate have now a new default database. It is cdb
(Constant DataBase from D. J. Bernstein <http://cr.yp.to/cdb.html>)
If for some reason you don't want to use it, rename or remove
the file /cdb/i4l_cdb.c, and run the procedure below.
To use the new (or switch) datafiles do in subdir isdnlog:
make clean
cd ..
make subconfig
cd isdnlog
make
su -c "make install"
Note: sometimes (after a small chhange in cdb) after leaving cdb,
make shows an error
"undefined reference to 'main'"
because $(PROGRAM) is lost in zone/Makefile, restarting make
then works. I don't know, what's goin on here - anyone?
After installing them change the two .gdbm entries in
/etc/isdn/isdn.conf to .cdb. You could also remove the *.gdbm in
/usr/lib/isdn.
The cdb data files are a lot smaller then the default gdbm we used,
The database seems to be much faster too.
-lt <lt@toetsch.at>
2000.07.17
all tools and rate-files

16
isdnlog/tools/cdb/CHANGES Normal file
View File

@ -0,0 +1,16 @@
20000215
api: rewrote almost everything from scratch. tnx Ken Lalonde for
suggesting mmap.
20000216
ui: cdbget supports skip.
version: cdb 0.70, beta.
20000219
bug: cdb_make_addbegin() didn't explicitly return 0. impact:
database creation could fail on systems that didn't
follow the traditional C return behavior. fix: obvious.
tnx Uwe Ohse.
internal: increased bspace in cdb_make.h from 1024 to 8192.
internal: switched cdbmake to PUTC, GETC. 3x speedup here.
internal: added testzero to rts.
ui: posplus() sets nomem if it passes 4GB.
version: cdb 0.75, beta.

78
isdnlog/tools/cdb/FILES Normal file
View File

@ -0,0 +1,78 @@
README
TODO
CHANGES
VERSION
FILES
SYSDEPS
TARGETS
conf-cc
conf-ld
conf-home
Makefile
cdbget.c
cdbmake.c
cdbdump.c
cdbstats.c
cdbtest.c
cdbmake-12.sh
cdbmake-sv.sh
cdb.h
cdb.c
cdb_hash.c
cdb_make.h
cdb_make.c
rts.sh
rts.tests
rts.exp
testzero.c
random.cdb
choose.sh
warn-auto.sh
find-systype.sh
trycpp.c
x86cpuid.c
alloc.c
alloc.h
auto-str.c
auto_home.h
buffer.c
buffer.h
buffer_0.c
buffer_1.c
buffer_1s.c
buffer_2.c
buffer_copy.c
buffer_get.c
buffer_put.c
byte.h
byte_copy.c
byte_cr.c
byte_diff.c
error.c
error.h
error_str.c
exit.h
fmt.h
fmt_ulong.c
hier.c
install.c
instcheck.c
open.h
open_read.c
open_trunc.c
readwrite.h
scan.h
scan_ulong.c
seek.h
seek_cur.c
seek_set.c
str.h
str_len.c
strerr.h
strerr_die.c
strerr_sys.c
tryulong32.c
uint32.h1
uint32.h2
uint32_pack.c
uint32_unpack.c

334
isdnlog/tools/cdb/Makefile Normal file
View File

@ -0,0 +1,334 @@
# Don't edit Makefile! Use conf-* for configuration.
SHELL=/bin/sh
default: cdbmake i4l_cdb.a
i4l_cdb.o: compile i4l_cdb.c i4l_cdb.h
./compile i4l_cdb.c
i4l_cdb.a: makelib cdb_make.o i4l_cdb.o
./makelib i4l_cdb.a i4l_cdb.o cdb_make.o
clean:
-rm *.o *.a cdbdump cdbget cdbmake{,-12,-sv} cdbstats \
cdbtest compile install instcheck load makelib rts testzero 2> /dev/null
distclean: clean
-rm autostr auto_home.c systype uint32.h 2> /dev/null
alloc.a: \
makelib alloc.o
./makelib alloc.a alloc.o
alloc.o: \
compile alloc.c alloc.h error.h
./compile alloc.c
auto-str: \
load auto-str.o buffer.a unix.a byte.a
./load auto-str buffer.a unix.a byte.a
auto-str.o: \
compile auto-str.c buffer.h readwrite.h exit.h
./compile auto-str.c
auto_home.c: \
auto-str conf-home
./auto-str auto_home `head -1 conf-home` > auto_home.c
auto_home.o: \
compile auto_home.c
./compile auto_home.c
buffer.a: \
makelib strerr_sys.o buffer.o buffer_put.o buffer_2.o strerr_die.o \
buffer_get.o buffer_copy.o buffer_1.o buffer_0.o buffer_1s.o
./makelib buffer.a strerr_sys.o buffer.o buffer_put.o \
buffer_2.o strerr_die.o buffer_get.o buffer_copy.o \
buffer_1.o buffer_0.o buffer_1s.o
buffer.o: \
compile buffer.c buffer.h
./compile buffer.c
buffer_0.o: \
compile buffer_0.c readwrite.h buffer.h
./compile buffer_0.c
buffer_1.o: \
compile buffer_1.c readwrite.h buffer.h
./compile buffer_1.c
buffer_1s.o: \
compile buffer_1s.c readwrite.h buffer.h
./compile buffer_1s.c
buffer_2.o: \
compile buffer_2.c readwrite.h buffer.h
./compile buffer_2.c
buffer_copy.o: \
compile buffer_copy.c buffer.h
./compile buffer_copy.c
buffer_get.o: \
compile buffer_get.c buffer.h byte.h error.h
./compile buffer_get.c
buffer_put.o: \
compile buffer_put.c buffer.h str.h byte.h error.h
./compile buffer_put.c
byte.a: \
makelib byte_copy.o byte_cr.o str_len.o fmt_ulong.o uint32_unpack.o \
byte_diff.o uint32_pack.o scan_ulong.o
./makelib byte.a byte_copy.o byte_cr.o str_len.o \
fmt_ulong.o uint32_unpack.o byte_diff.o uint32_pack.o \
scan_ulong.o
byte_copy.o: \
compile byte_copy.c byte.h
./compile byte_copy.c
byte_cr.o: \
compile byte_cr.c byte.h
./compile byte_cr.c
byte_diff.o: \
compile byte_diff.c byte.h
./compile byte_diff.c
cdb.a: \
makelib cdb.o cdb_hash.o cdb_make.o
./makelib cdb.a cdb.o cdb_hash.o cdb_make.o
cdb.o: \
compile cdb.c readwrite.h error.h seek.h byte.h cdb.h uint32.h
./compile cdb.c
cdb_hash.o: \
compile cdb_hash.c cdb.h uint32.h
./compile cdb_hash.c
cdb_make.o: \
compile cdb_make.c readwrite.h seek.h error.h alloc.h cdb.h uint32.h \
cdb_make.h buffer.h uint32.h
./compile cdb_make.c
cdbdump: \
load cdbdump.o buffer.a unix.a byte.a
./load cdbdump buffer.a unix.a byte.a
cdbdump.o: \
compile cdbdump.c uint32.h fmt.h buffer.h strerr.h
./compile cdbdump.c
cdbget: \
load cdbget.o cdb.a buffer.a unix.a byte.a
./load cdbget cdb.a buffer.a unix.a byte.a
cdbget.o: \
compile cdbget.c exit.h scan.h str.h buffer.h strerr.h cdb.h uint32.h
./compile cdbget.c
cdbmake: \
load cdbmake.o cdb.a alloc.a buffer.a unix.a byte.a
./load cdbmake cdb.a alloc.a buffer.a unix.a byte.a
cdbmake-12: \
warn-auto.sh cdbmake-12.sh conf-home
cat warn-auto.sh cdbmake-12.sh \
| sed s}HOME}"`head -1 conf-home`"}g \
> cdbmake-12
chmod 755 cdbmake-12
cdbmake-sv: \
warn-auto.sh cdbmake-sv.sh conf-home
cat warn-auto.sh cdbmake-sv.sh \
| sed s}HOME}"`head -1 conf-home`"}g \
> cdbmake-sv
chmod 755 cdbmake-sv
cdbmake.o: \
compile cdbmake.c error.h open.h strerr.h cdb_make.h buffer.h \
uint32.h cdb.h uint32.h
./compile cdbmake.c
cdbstats: \
load cdbstats.o cdb.a buffer.a unix.a byte.a
./load cdbstats cdb.a buffer.a unix.a byte.a
cdbstats.o: \
compile cdbstats.c uint32.h fmt.h buffer.h strerr.h seek.h cdb.h \
uint32.h
./compile cdbstats.c
cdbtest: \
load cdbtest.o cdb.a buffer.a unix.a byte.a
./load cdbtest cdb.a buffer.a unix.a byte.a
cdbtest.o: \
compile cdbtest.c uint32.h fmt.h buffer.h strerr.h seek.h cdb.h \
uint32.h
./compile cdbtest.c
check: \
it instcheck
./instcheck
compile: \
warn-auto.sh conf-cc
@( cat warn-auto.sh; \
echo exec "`head -1 conf-cc`" '-c $${1+"$$@"}' \
) > compile
@echo Making with `cat compile`
@chmod 755 compile
error.o: \
compile error.c error.h
./compile error.c
error_str.o: \
compile error_str.c error.h
./compile error_str.c
fmt_ulong.o: \
compile fmt_ulong.c fmt.h
./compile fmt_ulong.c
hier.o: \
compile hier.c auto_home.h
./compile hier.c
install: \
load install.o hier.o auto_home.o buffer.a unix.a byte.a
./load install hier.o auto_home.o buffer.a unix.a byte.a
install.o: \
compile install.c buffer.h strerr.h error.h open.h readwrite.h exit.h
./compile install.c
instcheck: \
load instcheck.o hier.o auto_home.o buffer.a unix.a byte.a
./load instcheck hier.o auto_home.o buffer.a unix.a byte.a
instcheck.o: \
compile instcheck.c strerr.h error.h readwrite.h exit.h
./compile instcheck.c
it: \
prog install instcheck
load: \
warn-auto.sh conf-ld
( cat warn-auto.sh; \
echo 'main="$$1"; shift'; \
echo exec "`head -1 conf-ld`" \
'-o "$$main" "$$main".o $${1+"$$@"}' \
) > load
chmod 755 load
makelib: \
warn-auto.sh systype
( cat warn-auto.sh; \
echo 'main="$$1"; shift'; \
echo 'rm -f "$$main"'; \
echo 'ar cr "$$main" $${1+"$$@"}'; \
case "`cat systype`" in \
sunos-5.*) ;; \
unix_sv*) ;; \
irix64-*) ;; \
irix-*) ;; \
dgux-*) ;; \
hp-ux-*) ;; \
sco*) ;; \
*) echo 'ranlib "$$main"' ;; \
esac \
) > makelib
chmod 755 makelib
open_read.o: \
compile open_read.c open.h
./compile open_read.c
open_trunc.o: \
compile open_trunc.c open.h
./compile open_trunc.c
prog: \
cdbget cdbmake cdbdump cdbstats cdbtest cdbmake-12 cdbmake-sv rts \
testzero
rts: \
warn-auto.sh rts.sh conf-home
cat warn-auto.sh rts.sh \
| sed s}HOME}"`head -1 conf-home`"}g \
> rts
chmod 755 rts
scan_ulong.o: \
compile scan_ulong.c scan.h
./compile scan_ulong.c
seek_cur.o: \
compile seek_cur.c seek.h
./compile seek_cur.c
seek_set.o: \
compile seek_set.c seek.h
./compile seek_set.c
setup: \
it install
./install
str_len.o: \
compile str_len.c str.h
./compile str_len.c
strerr_die.o: \
compile strerr_die.c buffer.h exit.h strerr.h
./compile strerr_die.c
strerr_sys.o: \
compile strerr_sys.c error.h strerr.h
./compile strerr_sys.c
systype: \
find-systype.sh conf-cc conf-ld trycpp.c x86cpuid.c
( cat warn-auto.sh; \
echo CC=\'`head -1 conf-cc`\'; \
echo LD=\'`head -1 conf-ld`\'; \
cat find-systype.sh; \
) | sh > systype
testzero: \
load testzero.o cdb.a alloc.a buffer.a unix.a byte.a
./load testzero cdb.a alloc.a buffer.a unix.a byte.a
testzero.o: \
compile testzero.c uint32.h scan.h strerr.h cdb_make.h buffer.h \
uint32.h
./compile testzero.c
uint32.h: \
tryulong32.c compile load uint32.h1 uint32.h2
( ( ./compile tryulong32.c && ./load tryulong32 && \
./tryulong32 ) >/dev/null 2>&1 \
&& cat uint32.h2 || cat uint32.h1 ) > uint32.h
rm -f tryulong32.o tryulong32
uint32_pack.o: \
compile uint32_pack.c uint32.h
./compile uint32_pack.c
uint32_unpack.o: \
compile uint32_unpack.c uint32.h
./compile uint32_unpack.c
unix.a: \
makelib error.o open_read.o open_trunc.o error_str.o seek_set.o \
seek_cur.o
./makelib unix.a error.o open_read.o open_trunc.o \
error_str.o seek_set.o seek_cur.o

7
isdnlog/tools/cdb/README Normal file
View File

@ -0,0 +1,7 @@
cdb 0.75, beta.
20000219
Copyright 2000
D. J. Bernstein
cdb home page: http://cr.yp.to/cdb.html
Installation instructions: http://cr.yp.to/cdb/install.html

View File

@ -0,0 +1,20 @@
This is an implementation of the Constant Data Base (cdb),
s. more in README
The main interface to i4l-tools is the file i4l_cdb.c, which
simulates a DB-interface.
Changes to the original cdb-0.75:
A target for i4l_cdb was added to the Makefile, the struct buffer
is renamed to cdb_buffer because of a conflict and cdbmake has improved
diagnostics.
This are the only changes to the original files
(s. i4l_cdb.diff for details)
Currently only the utility cdbmake is used, but you don't have to
install the cdb package.
- lt <lt@toetsch.at>

View File

@ -0,0 +1,3 @@
VERSION
systype
uint32.h

66
isdnlog/tools/cdb/TARGETS Normal file
View File

@ -0,0 +1,66 @@
load
compile
uint32.h
cdbget.o
systype
makelib
cdb.o
cdb_hash.o
cdb_make.o
cdb.a
strerr_sys.o
buffer.o
buffer_put.o
buffer_2.o
strerr_die.o
buffer_get.o
buffer_copy.o
buffer_1.o
buffer_0.o
buffer_1s.o
buffer.a
error.o
open_read.o
open_trunc.o
error_str.o
seek_set.o
seek_cur.o
unix.a
byte_copy.o
byte_cr.o
str_len.o
fmt_ulong.o
uint32_unpack.o
byte_diff.o
uint32_pack.o
scan_ulong.o
byte.a
cdbget
cdbmake.o
alloc.o
alloc.a
cdbmake
cdbdump.o
cdbdump
cdbstats.o
cdbstats
cdbtest.o
cdbtest
cdbmake-12
cdbmake-sv
rts
testzero.o
testzero
prog
install.o
hier.o
auto-str.o
auto-str
auto_home.c
auto_home.o
install
instcheck.o
instcheck
it
setup
check

1
isdnlog/tools/cdb/TODO Normal file
View File

@ -0,0 +1 @@
more rts

View File

@ -0,0 +1 @@
cdb 0.75

32
isdnlog/tools/cdb/alloc.c Normal file
View File

@ -0,0 +1,32 @@
#include "alloc.h"
#include "error.h"
extern char *malloc();
extern void free();
#define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */
#define SPACE 4096 /* must be multiple of ALIGNMENT */
typedef union { char irrelevant[ALIGNMENT]; double d; } aligned;
static aligned realspace[SPACE / ALIGNMENT];
#define space ((char *) realspace)
static unsigned int avail = SPACE; /* multiple of ALIGNMENT; 0<=avail<=SPACE */
/*@null@*//*@out@*/char *alloc(n)
unsigned int n;
{
char *x;
n = ALIGNMENT + n - (n & (ALIGNMENT - 1)); /* XXX: could overflow */
if (n <= avail) { avail -= n; return space + avail; }
x = malloc(n);
if (!x) errno = error_nomem;
return x;
}
void alloc_free(x)
char *x;
{
if (x >= space)
if (x < space + SPACE)
return; /* XXX: assuming that pointers are flat */
free(x);
}

View File

@ -0,0 +1,8 @@
#ifndef ALLOC_H
#define ALLOC_H
extern /*@null@*//*@out@*/char *alloc();
extern void alloc_free();
extern int alloc_re();
#endif

View File

@ -0,0 +1,44 @@
#include "buffer.h"
#include "readwrite.h"
#include "exit.h"
char buf1[256];
buffer ss1 = BUFFER_INIT(write,1,buf1,sizeof(buf1));
void puts(s)
char *s;
{
if (buffer_puts(&ss1,s) == -1) _exit(111);
}
main(argc,argv)
int argc;
char **argv;
{
char *name;
char *value;
unsigned char ch;
char octal[4];
name = argv[1];
if (!name) _exit(100);
value = argv[2];
if (!value) _exit(100);
puts("char ");
puts(name);
puts("[] = \"\\\n");
while (ch = *value++) {
puts("\\");
octal[3] = 0;
octal[2] = '0' + (ch & 7); ch >>= 3;
octal[1] = '0' + (ch & 7); ch >>= 3;
octal[0] = '0' + (ch & 7);
puts(octal);
}
puts("\\\n\";\n");
if (buffer_flush(&ss1) == -1) _exit(111);
_exit(0);
}

View File

@ -0,0 +1,6 @@
#ifndef AUTO_HOME_H
#define AUTO_HOME_H
extern char auto_home[];
#endif

View File

@ -0,0 +1,10 @@
#include "buffer.h"
void buffer_init(cdb_buffer *s,int (*op)(),int fd,char *buf,unsigned int len)
{
s->x = buf;
s->fd = fd;
s->op = op;
s->p = 0;
s->n = len;
}

View File

@ -0,0 +1,56 @@
#ifndef BUFFER_H
#define BUFFER_H
typedef struct cdb_buffer {
char *x;
unsigned int p;
unsigned int n;
int fd;
int (*op)();
} cdb_buffer;
#define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) }
#define BUFFER_INSIZE 8192
#define BUFFER_OUTSIZE 8192
extern void buffer_init(cdb_buffer *,int (*)(),int,char *,unsigned int);
extern int buffer_flush(cdb_buffer *);
extern int buffer_put(cdb_buffer *,char *,unsigned int);
extern int buffer_putalign(cdb_buffer *,char *,unsigned int);
extern int buffer_putflush(cdb_buffer *,char *,unsigned int);
extern int buffer_puts(cdb_buffer *,char *);
extern int buffer_putsalign(cdb_buffer *,char *);
extern int buffer_putsflush(cdb_buffer *,char *);
#define buffer_PUTC(s,c) \
( ((s)->n != (s)->p) \
? ( (s)->x[(s)->p++] = (c), 0 ) \
: buffer_put((s),&(c),1) \
)
extern int buffer_get(cdb_buffer *,char *,unsigned int);
extern int buffer_bget(cdb_buffer *,char *,unsigned int);
extern int buffer_feed(cdb_buffer *);
extern char *buffer_peek(cdb_buffer *);
extern void buffer_seek(cdb_buffer *,unsigned int);
#define buffer_PEEK(s) ( (s)->x + (s)->n )
#define buffer_SEEK(s,len) ( ( (s)->p -= (len) ) , ( (s)->n += (len) ) )
#define buffer_GETC(s,c) \
( ((s)->p > 0) \
? ( *(c) = (s)->x[(s)->n], buffer_SEEK((s),1), 1 ) \
: buffer_get((s),(c),1) \
)
extern int buffer_copy(cdb_buffer *,cdb_buffer *);
extern cdb_buffer *buffer_0;
extern cdb_buffer *buffer_0small;
extern cdb_buffer *buffer_1;
extern cdb_buffer *buffer_1small;
extern cdb_buffer *buffer_2;
#endif

View File

@ -0,0 +1,12 @@
#include "readwrite.h"
#include "buffer.h"
int buffer_0_read(fd,buf,len) int fd; char *buf; int len;
{
if (buffer_flush(buffer_1) == -1) return -1;
return read(fd,buf,len);
}
char buffer_0_space[BUFFER_INSIZE];
static cdb_buffer it = BUFFER_INIT(buffer_0_read,0,buffer_0_space,sizeof buffer_0_space);
cdb_buffer *buffer_0 = &it;

View File

@ -0,0 +1,6 @@
#include "readwrite.h"
#include "buffer.h"
char buffer_1_space[BUFFER_OUTSIZE];
static cdb_buffer it = BUFFER_INIT(write,1,buffer_1_space,sizeof buffer_1_space);
cdb_buffer *buffer_1 = &it;

View File

@ -0,0 +1,6 @@
#include "readwrite.h"
#include "buffer.h"
char buffer_1small_space[256];
static cdb_buffer it = BUFFER_INIT(write,1,buffer_1small_space,sizeof buffer_1small_space);
cdb_buffer *buffer_1small = &it;

View File

@ -0,0 +1,6 @@
#include "readwrite.h"
#include "buffer.h"
char buffer_2_space[256];
static cdb_buffer it = BUFFER_INIT(write,2,buffer_2_space,sizeof buffer_2_space);
cdb_buffer *buffer_2 = &it;

View File

@ -0,0 +1,16 @@
#include "buffer.h"
int buffer_copy(cdb_buffer *bout,cdb_buffer *bin)
{
int n;
char *x;
for (;;) {
n = buffer_feed(bin);
if (n < 0) return -2;
if (!n) return 0;
x = buffer_PEEK(bin);
if (buffer_put(bout,x,n) == -1) return -3;
buffer_SEEK(bin,n);
}
}

View File

@ -0,0 +1,67 @@
#include "buffer.h"
#include "byte.h"
#include "error.h"
static int oneread(int (*op)(),int fd,char *buf,unsigned int len)
{
int r;
for (;;) {
r = op(fd,buf,len);
if (r == -1) if (errno == error_intr) continue;
return r;
}
}
static int getthis(cdb_buffer *s,char *buf,unsigned int len)
{
if (len > s->p) len = s->p;
s->p -= len;
byte_copy(buf,len,s->x + s->n);
s->n += len;
return len;
}
int buffer_feed(cdb_buffer *s)
{
int r;
if (s->p) return s->p;
r = oneread(s->op,s->fd,s->x,s->n);
if (r <= 0) return r;
s->p = r;
s->n -= r;
if (s->n > 0) byte_copyr(s->x + s->n,r,s->x);
return r;
}
int buffer_bget(cdb_buffer *s,char *buf,unsigned int len)
{
int r;
if (s->p > 0) return getthis(s,buf,len);
if (s->n <= len) return oneread(s->op,s->fd,buf,s->n);
r = buffer_feed(s); if (r <= 0) return r;
return getthis(s,buf,len);
}
int buffer_get(cdb_buffer *s,char *buf,unsigned int len)
{
int r;
if (s->p > 0) return getthis(s,buf,len);
if (s->n <= len) return oneread(s->op,s->fd,buf,len);
r = buffer_feed(s); if (r <= 0) return r;
return getthis(s,buf,len);
}
char *buffer_peek(cdb_buffer *s)
{
return s->x + s->n;
}
void buffer_seek(cdb_buffer *s,unsigned int len)
{
s->n += len;
s->p -= len;
}

View File

@ -0,0 +1,88 @@
#include "buffer.h"
#include "str.h"
#include "byte.h"
#include "error.h"
static int allwrite(int (*op)(),int fd,char *buf,unsigned int len)
{
int w;
while (len) {
w = op(fd,buf,len);
if (w == -1) {
if (errno == error_intr) continue;
return -1; /* note that some data may have been written */
}
if (w == 0) ; /* luser's fault */
buf += w;
len -= w;
}
return 0;
}
int buffer_flush(cdb_buffer *s)
{
int p;
p = s->p;
if (!p) return 0;
s->p = 0;
return allwrite(s->op,s->fd,s->x,p);
}
int buffer_putalign(cdb_buffer *s,char *buf,unsigned int len)
{
unsigned int n;
while (len > (n = s->n - s->p)) {
byte_copy(s->x + s->p,n,buf); s->p += n; buf += n; len -= n;
if (buffer_flush(s) == -1) return -1;
}
/* now len <= s->n - s->p */
byte_copy(s->x + s->p,len,buf);
s->p += len;
return 0;
}
int buffer_put(cdb_buffer *s,char *buf,unsigned int len)
{
unsigned int n;
n = s->n;
if (len > n - s->p) {
if (buffer_flush(s) == -1) return -1;
/* now s->p == 0 */
if (n < BUFFER_OUTSIZE) n = BUFFER_OUTSIZE;
while (len > s->n) {
if (n > len) n = len;
if (allwrite(s->op,s->fd,buf,n) == -1) return -1;
buf += n;
len -= n;
}
}
/* now len <= s->n - s->p */
byte_copy(s->x + s->p,len,buf);
s->p += len;
return 0;
}
int buffer_putflush(cdb_buffer *s,char *buf,unsigned int len)
{
if (buffer_flush(s) == -1) return -1;
return allwrite(s->op,s->fd,buf,len);
}
int buffer_putsalign(cdb_buffer *s,char *buf)
{
return buffer_putalign(s,buf,str_len(buf));
}
int buffer_puts(cdb_buffer *s,char *buf)
{
return buffer_put(s,buf,str_len(buf));
}
int buffer_putsflush(cdb_buffer *s,char *buf)
{
return buffer_putflush(s,buf,str_len(buf));
}

13
isdnlog/tools/cdb/byte.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef BYTE_H
#define BYTE_H
extern unsigned int byte_chr();
extern unsigned int byte_rchr();
extern void byte_copy();
extern void byte_copyr();
extern int byte_diff();
extern void byte_zero();
#define byte_equal(s,n,t) (!byte_diff((s),(n),(t)))
#endif

View File

@ -0,0 +1,14 @@
#include "byte.h"
void byte_copy(to,n,from)
register char *to;
register unsigned int n;
register char *from;
{
for (;;) {
if (!n) return; *to++ = *from++; --n;
if (!n) return; *to++ = *from++; --n;
if (!n) return; *to++ = *from++; --n;
if (!n) return; *to++ = *from++; --n;
}
}

View File

@ -0,0 +1,16 @@
#include "byte.h"
void byte_copyr(to,n,from)
register char *to;
register unsigned int n;
register char *from;
{
to += n;
from += n;
for (;;) {
if (!n) return; *--to = *--from; --n;
if (!n) return; *--to = *--from; --n;
if (!n) return; *--to = *--from; --n;
if (!n) return; *--to = *--from; --n;
}
}

View File

@ -0,0 +1,16 @@
#include "byte.h"
int byte_diff(s,n,t)
register char *s;
register unsigned int n;
register char *t;
{
for (;;) {
if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
}
return ((int)(unsigned int)(unsigned char) *s)
- ((int)(unsigned int)(unsigned char) *t);
}

136
isdnlog/tools/cdb/cdb.c Normal file
View File

@ -0,0 +1,136 @@
/* Public domain. */
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include "readwrite.h"
#include "error.h"
#include "seek.h"
#include "byte.h"
#include "cdb.h"
void cdb_free(struct cdb *c)
{
if (c->map) {
munmap(c->map,c->size);
c->map = 0;
}
}
void cdb_findstart(struct cdb *c)
{
c->loop = 0;
}
void cdb_init(struct cdb *c,int fd)
{
struct stat st;
char *x;
cdb_free(c);
cdb_findstart(c);
c->fd = fd;
if (fstat(fd,&st) == 0)
if (st.st_size <= 0xffffffff) {
x = mmap(0,st.st_size,PROT_READ,MAP_SHARED,fd,0);
if (x + 1) {
c->size = st.st_size;
c->map = x;
}
}
}
int cdb_read(struct cdb *c,char *buf,unsigned int len,uint32 pos)
{
if (c->map) {
if ((pos > c->size) || (c->size - pos < len)) goto FORMAT;
byte_copy(buf,len,c->map + pos);
}
else {
if (seek_set(c->fd,pos) == -1) return -1;
while (len > 0) {
int r;
do
r = read(c->fd,buf,len);
while ((r == -1) && (errno == error_intr));
if (r == -1) return -1;
if (r == 0) goto FORMAT;
buf += r;
len -= r;
}
}
return 0;
FORMAT:
errno = error_proto;
return -1;
}
static int match(struct cdb *c,char *key,unsigned int len,uint32 pos)
{
char buf[32];
int n;
while (len > 0) {
n = sizeof buf;
if (n > len) n = len;
if (cdb_read(c,buf,n,pos) == -1) return -1;
if (byte_diff(buf,n,key)) return 0;
pos += n;
key += n;
len -= n;
}
return 1;
}
int cdb_findnext(struct cdb *c,char *key,unsigned int len)
{
char buf[8];
uint32 pos;
uint32 u;
if (!c->loop) {
u = cdb_hash(key,len);
if (cdb_read(c,buf,8,(u << 3) & 2047) == -1) return -1;
uint32_unpack(buf + 4,&c->hslots);
if (!c->hslots) return 0;
uint32_unpack(buf,&c->hpos);
c->khash = u;
u >>= 8;
u %= c->hslots;
u <<= 3;
c->kpos = c->hpos + u;
}
while (c->loop < c->hslots) {
if (cdb_read(c,buf,8,c->kpos) == -1) return -1;
uint32_unpack(buf + 4,&pos);
if (!pos) return 0;
c->loop += 1;
c->kpos += 8;
if (c->kpos == c->hpos + (c->hslots << 3)) c->kpos = c->hpos;
uint32_unpack(buf,&u);
if (u == c->khash) {
if (cdb_read(c,buf,8,pos) == -1) return -1;
uint32_unpack(buf,&u);
if (u == len)
switch(match(c,key,len,pos + 8)) {
case -1:
return -1;
case 1:
uint32_unpack(buf + 4,&c->dlen);
c->dpos = pos + 8 + len;
return 1;
}
}
}
return 0;
}
int cdb_find(struct cdb *c,char *key,unsigned int len)
{
cdb_findstart(c);
return cdb_findnext(c,key,len);
}

37
isdnlog/tools/cdb/cdb.h Normal file
View File

@ -0,0 +1,37 @@
/* Public domain. */
#ifndef CDB_H
#define CDB_H
#include "uint32.h"
#define CDB_HASHSTART 5381
extern uint32 cdb_hashadd(uint32,unsigned char);
extern uint32 cdb_hash(char *,unsigned int);
struct cdb {
char *map; /* 0 if no map is available */
int fd;
uint32 size; /* initialized if map is nonzero */
uint32 loop; /* number of hash slots searched under this key */
uint32 khash; /* initialized if loop is nonzero */
uint32 kpos; /* initialized if loop is nonzero */
uint32 hpos; /* initialized if loop is nonzero */
uint32 hslots; /* initialized if loop is nonzero */
uint32 dpos; /* initialized if cdb_findnext() returns 1 */
uint32 dlen; /* initialized if cdb_findnext() returns 1 */
} ;
extern void cdb_free(struct cdb *);
extern void cdb_init(struct cdb *,int fd);
extern int cdb_read(struct cdb *,char *,unsigned int,uint32);
extern void cdb_findstart(struct cdb *);
extern int cdb_findnext(struct cdb *,char *,unsigned int);
extern int cdb_find(struct cdb *,char *,unsigned int);
#define cdb_datapos(c) ((c)->dpos)
#define cdb_datalen(c) ((c)->dlen)
#endif

View File

@ -0,0 +1,21 @@
/* Public domain. */
#include "cdb.h"
uint32 cdb_hashadd(uint32 h,unsigned char c)
{
h += (h << 5);
return h ^ c;
}
uint32 cdb_hash(char *buf,unsigned int len)
{
uint32 h;
h = CDB_HASHSTART;
while (len) {
h = cdb_hashadd(h,*buf++);
--len;
}
return h;
}

View File

@ -0,0 +1,153 @@
/* Public domain. */
#include "readwrite.h"
#include "seek.h"
#include "error.h"
#include "alloc.h"
#include "cdb.h"
#include "cdb_make.h"
int cdb_make_start(struct cdb_make *c,int fd)
{
c->head = 0;
c->split = 0;
c->hash = 0;
c->numentries = 0;
c->fd = fd;
c->pos = sizeof c->final;
buffer_init(&c->b,write,fd,c->bspace,sizeof c->bspace);
return seek_set(fd,c->pos);
}
static int posplus(struct cdb_make *c,uint32 len)
{
uint32 newpos = c->pos + len;
if (newpos < len) { errno = error_nomem; return -1; }
c->pos = newpos;
return 0;
}
int cdb_make_addend(struct cdb_make *c,unsigned int keylen,unsigned int datalen,uint32 h)
{
struct cdb_hplist *head;
head = c->head;
if (!head || (head->num >= CDB_HPLIST)) {
head = (struct cdb_hplist *) alloc(sizeof(struct cdb_hplist));
if (!head) return -1;
head->num = 0;
head->next = c->head;
c->head = head;
}
head->hp[head->num].h = h;
head->hp[head->num].p = c->pos;
++head->num;
++c->numentries;
if (posplus(c,8) == -1) return -1;
if (posplus(c,keylen) == -1) return -1;
if (posplus(c,datalen) == -1) return -1;
return 0;
}
int cdb_make_addbegin(struct cdb_make *c,unsigned int keylen,unsigned int datalen)
{
char buf[8];
if (keylen > 0xffffffff) { errno = error_nomem; return -1; }
if (datalen > 0xffffffff) { errno = error_nomem; return -1; }
uint32_pack(buf,keylen);
uint32_pack(buf + 4,datalen);
if (buffer_putalign(&c->b,buf,8) == -1) return -1;
return 0;
}
int cdb_make_add(struct cdb_make *c,char *key,unsigned int keylen,char *data,unsigned int datalen)
{
if (cdb_make_addbegin(c,keylen,datalen) == -1) return -1;
if (buffer_putalign(&c->b,key,keylen) == -1) return -1;
if (buffer_putalign(&c->b,data,datalen) == -1) return -1;
return cdb_make_addend(c,keylen,datalen,cdb_hash(key,keylen));
}
int cdb_make_finish(struct cdb_make *c)
{
char buf[8];
int i;
uint32 len;
uint32 u;
uint32 memsize;
uint32 count;
uint32 where;
struct cdb_hplist *x;
struct cdb_hp *hp;
for (i = 0;i < 256;++i)
c->count[i] = 0;
for (x = c->head;x;x = x->next) {
i = x->num;
while (i--)
++c->count[255 & x->hp[i].h];
}
memsize = 1;
for (i = 0;i < 256;++i) {
u = c->count[i] * 2;
if (u > memsize)
memsize = u;
}
memsize += c->numentries; /* no overflow possible up to now */
u = (uint32) 0 - (uint32) 1;
u /= sizeof(struct cdb_hp);
if (memsize > u) { errno = error_nomem; return -1; }
c->split = (struct cdb_hp *) alloc(memsize * sizeof(struct cdb_hp));
if (!c->split) return -1;
c->hash = c->split + c->numentries;
u = 0;
for (i = 0;i < 256;++i) {
u += c->count[i]; /* bounded by numentries, so no overflow */
c->start[i] = u;
}
for (x = c->head;x;x = x->next) {
i = x->num;
while (i--)
c->split[--c->start[255 & x->hp[i].h]] = x->hp[i];
}
for (i = 0;i < 256;++i) {
count = c->count[i];
len = count + count; /* no overflow possible */
uint32_pack(c->final + 8 * i,c->pos);
uint32_pack(c->final + 8 * i + 4,len);
for (u = 0;u < len;++u)
c->hash[u].h = c->hash[u].p = 0;
hp = c->split + c->start[i];
for (u = 0;u < count;++u) {
where = (hp->h >> 8) % len;
while (c->hash[where].p)
if (++where == len)
where = 0;
c->hash[where] = *hp++;
}
for (u = 0;u < len;++u) {
uint32_pack(buf,c->hash[u].h);
uint32_pack(buf + 4,c->hash[u].p);
if (buffer_putalign(&c->b,buf,8) == -1) return -1;
if (posplus(c,8) == -1) return -1;
}
}
if (buffer_flush(&c->b) == -1) return -1;
if (seek_begin(c->fd) == -1) return -1;
return buffer_putflush(&c->b,c->final,sizeof c->final);
}

View File

@ -0,0 +1,39 @@
/* Public domain. */
#ifndef CDB_MAKE_H
#define CDB_MAKE_H
#include "buffer.h"
#include "uint32.h"
#define CDB_HPLIST 1000
struct cdb_hp { uint32 h; uint32 p; } ;
struct cdb_hplist {
struct cdb_hp hp[CDB_HPLIST];
struct cdb_hplist *next;
int num;
} ;
struct cdb_make {
char bspace[8192];
char final[2048];
uint32 count[256];
uint32 start[256];
struct cdb_hplist *head;
struct cdb_hp *split; /* includes space for hash */
struct cdb_hp *hash;
uint32 numentries;
cdb_buffer b;
uint32 pos;
int fd;
} ;
extern int cdb_make_start(struct cdb_make *,int);
extern int cdb_make_addbegin(struct cdb_make *,unsigned int,unsigned int);
extern int cdb_make_addend(struct cdb_make *,unsigned int,unsigned int,uint32);
extern int cdb_make_add(struct cdb_make *,char *,unsigned int,char *,unsigned int);
extern int cdb_make_finish(struct cdb_make *);
#endif

View File

@ -0,0 +1,83 @@
#include "uint32.h"
#include "fmt.h"
#include "buffer.h"
#include "strerr.h"
#define FATAL "cdbdump: fatal: "
void die_write(void)
{
strerr_die2sys(111,FATAL,"unable to write output: ");
}
void put(char *buf,unsigned int len)
{
if (buffer_put(buffer_1,buf,len) == -1) die_write();
}
void putflush(void)
{
if (buffer_flush(buffer_1) == -1) die_write();
}
uint32 pos = 0;
void get(char *buf,unsigned int len)
{
int r;
while (len > 0) {
r = buffer_get(buffer_0,buf,len);
if (r == -1)
strerr_die2sys(111,FATAL,"unable to read input: ");
if (r == 0)
strerr_die2x(111,FATAL,"unable to read input: truncated file");
pos += r;
buf += r;
len -= r;
}
}
char buf[512];
void copy(uint32 len)
{
unsigned int x;
while (len) {
x = sizeof buf;
if (len < x) x = len;
get(buf,x);
put(buf,x);
len -= x;
}
}
void getnum(uint32 *num)
{
get(buf,4);
uint32_unpack(buf,num);
}
char strnum[FMT_ULONG];
main()
{
uint32 eod;
uint32 klen;
uint32 dlen;
getnum(&eod);
while (pos < 2048) getnum(&dlen);
while (pos < eod) {
getnum(&klen);
getnum(&dlen);
put("+",1); put(strnum,fmt_ulong(strnum,klen));
put(",",1); put(strnum,fmt_ulong(strnum,dlen));
put(":",1); copy(klen);
put("->",2); copy(dlen);
put("\n",1);
}
put("\n",1);
putflush();
_exit(0);
}

View File

@ -0,0 +1,67 @@
#include "exit.h"
#include "scan.h"
#include "str.h"
#include "buffer.h"
#include "strerr.h"
#include "cdb.h"
#define FATAL "cdbget: fatal: "
void die_read(void)
{
strerr_die2sys(111,FATAL,"unable to read input: ");
}
void die_write(void)
{
strerr_die2sys(111,FATAL,"unable to write output: ");
}
void die_usage(void)
{
strerr_die1x(111,"cdbget: usage: cdbget key [skip]");
}
static struct cdb c;
char buf[1024];
main(int argc,char **argv)
{
char *key;
int r;
uint32 pos;
uint32 len;
unsigned long u = 0;
if (!*argv) die_usage();
if (!*++argv) die_usage();
key = *argv;
if (*++argv) {
scan_ulong(*argv,&u);
}
cdb_init(&c,0);
cdb_findstart(&c);
for (;;) {
r = cdb_findnext(&c,key,str_len(key));
if (r == -1) die_read();
if (!r) _exit(100);
if (!u) break;
--u;
}
pos = cdb_datapos(&c);
len = cdb_datalen(&c);
while (len > 0) {
r = sizeof buf;
if (r > len) r = len;
if (cdb_read(&c,buf,r,pos) == -1) die_read();
if (buffer_put(buffer_1small,buf,r) == -1) die_write();
pos += r;
len -= r;
}
if (buffer_flush(buffer_1small) == -1) die_write();
_exit(0);
}

View File

@ -0,0 +1,8 @@
awk '
/^[^#]/ {
print "+" length($1) "," length($2) ":" $1 "->" $2
}
END {
print ""
}
' | HOME/bin/cdbmake "$@"

View File

@ -0,0 +1,22 @@
awk '
{
if (split($0,x,"#")) {
f = split(x[1],y)
if (f >= 2) {
if (split(y[2],z,"/") >= 2) {
a = "@" z[1] "/" z[2]
print "+" length(a) "," length(y[1]) ":" a "->" y[1]
for (i = 1;i <= f;i += 1) {
if (i != 2) {
a = y[i] "/" z[2]
print "+" length(a) "," length(z[1]) ":" a "->" z[1]
}
}
}
}
}
}
END {
print ""
}
' | HOME/bin/cdbmake "$@"

114
isdnlog/tools/cdb/cdbmake.c Normal file
View File

@ -0,0 +1,114 @@
#include "error.h"
#include "open.h"
#include "strerr.h"
#include "cdb_make.h"
#include "cdb.h"
#define FATAL "cdbmake: fatal: "
char *fn;
char *fntmp;
void die_usage(void)
{
strerr_die1x(100,"cdbmake: usage: cdbmake f ftmp");
}
void die_write(void)
{
strerr_die4sys(111,FATAL,"unable to create ",fntmp,": ");
}
void die_read(void)
{
strerr_die2sys(111,FATAL,"unable to read input: ");
}
void die_readformat(char *s, int l)
{
char b[256];
sprintf(b, "unable to read input: bad format in %d, '%s", l, s);
strerr_die2x(111,FATAL,b);
}
int line = 0;
inline void get(char *ch)
{
switch(buffer_GETC(buffer_0,ch)) {
case 0: die_readformat("null",line);
case -1: die_read();
}
}
static struct cdb_make c;
main(int argc,char **argv)
{
unsigned int klen;
unsigned int dlen;
unsigned int i;
uint32 h;
int fd;
char ch;
if (!*argv) die_usage();
if (!*++argv) die_usage();
fn = *argv;
if (!*++argv) die_usage();
fntmp = *argv;
fd = open_trunc(fntmp);
if (fd == -1) die_write();
if (cdb_make_start(&c,fd) == -1) die_write();
for (;;) {
line++;
get(&ch);
if (ch == '\n') break;
if (ch != '+') die_readformat("+", line);
klen = 0;
for (;;) {
get(&ch);
if (ch == ',') break;
if ((ch < '0') || (ch > '9')) die_readformat("klen",line);
if (klen > 429496720) { errno = error_nomem; die_write(); }
klen = klen * 10 + (ch - '0');
}
dlen = 0;
for (;;) {
get(&ch);
if (ch == ':') break;
if ((ch < '0') || (ch > '9')) die_readformat("dlen",line);
if (dlen > 429496720) { errno = error_nomem; die_write(); }
dlen = dlen * 10 + (ch - '0');
}
if (cdb_make_addbegin(&c,klen,dlen) == -1) die_write();
h = CDB_HASHSTART;
for (i = 0;i < klen;++i) {
get(&ch);
if (buffer_PUTC(&c.b,ch) == -1) die_write();
h = cdb_hashadd(h,ch);
}
get(&ch);
if (ch != '-') die_readformat("-", line);
get(&ch);
if (ch != '>') die_readformat(">", line);
for (i = 0;i < dlen;++i) {
get(&ch);
if (buffer_PUTC(&c.b,ch) == -1) die_write();
}
if (cdb_make_addend(&c,klen,dlen,h) == -1) die_write();
get(&ch);
if (ch != '\n') die_readformat("nl",line);
}
if (cdb_make_finish(&c) == -1) die_write();
if (fsync(fd) == -1) die_write();
if (close(fd) == -1) die_write(); /* NFS silliness */
if (rename(fntmp,fn) == -1)
strerr_die6sys(111,FATAL,"unable to rename ",fntmp," to ",fn,": ");
_exit(0);
}

View File

@ -0,0 +1,125 @@
#include "uint32.h"
#include "fmt.h"
#include "buffer.h"
#include "strerr.h"
#include "seek.h"
#include "cdb.h"
#define FATAL "cdbstats: fatal: "
void die_read(void)
{
strerr_die2sys(111,FATAL,"unable to read input: ");
}
void die_readformat(void)
{
strerr_die2x(111,FATAL,"unable to read input: truncated file");
}
void die_write(void)
{
strerr_die2sys(111,FATAL,"unable to write output: ");
}
void put(char *buf,unsigned int len)
{
if (buffer_put(buffer_1small,buf,len) == -1) die_write();
}
void putflush(void)
{
if (buffer_flush(buffer_1small) == -1) die_write();
}
uint32 pos = 0;
void get(char *buf,unsigned int len)
{
int r;
while (len > 0) {
r = buffer_get(buffer_0,buf,len);
if (r == -1) die_read();
if (r == 0) die_readformat();
pos += r;
buf += r;
len -= r;
}
}
void getnum(uint32 *num)
{
char buf[4];
get(buf,4);
uint32_unpack(buf,num);
}
char strnum[FMT_ULONG];
void putnum(char *label,unsigned long count)
{
unsigned int i;
put(label,str_len(label));
for (i = fmt_ulong(0,count);i < 10;++i) put(" ",1);
put(strnum,fmt_ulong(strnum,count));
put("\n",1);
}
char key[1024];
static struct cdb c;
static unsigned long numrecords;
static unsigned long numd[11];
main()
{
uint32 eod;
uint32 klen;
uint32 dlen;
seek_pos rest;
int r;
cdb_init(&c,0);
getnum(&eod);
while (pos < 2048) getnum(&dlen);
while (pos < eod) {
getnum(&klen);
getnum(&dlen);
if (klen > sizeof key) {
while (klen) { get(key,1); --klen; }
}
else {
get(key,klen);
rest = seek_cur(0);
cdb_findstart(&c);
do {
switch(cdb_findnext(&c,key,klen)) {
case -1: die_read();
case 0: die_readformat();
}
} while (cdb_datapos(&c) != pos);
if (!c.loop) die_readformat();
++numrecords;
if (c.loop > 10)
++numd[10];
else
++numd[c.loop - 1];
if (seek_set(0,rest) == -1) die_read();
}
while (dlen) { get(key,1); --dlen; }
}
putnum("records ",numrecords);
putnum("d0 ",numd[0]);
putnum("d1 ",numd[1]);
putnum("d2 ",numd[2]);
putnum("d3 ",numd[3]);
putnum("d4 ",numd[4]);
putnum("d5 ",numd[5]);
putnum("d6 ",numd[6]);
putnum("d7 ",numd[7]);
putnum("d8 ",numd[8]);
putnum("d9 ",numd[9]);
putnum(">9 ",numd[10]);
putflush();
_exit(0);
}

119
isdnlog/tools/cdb/cdbtest.c Normal file
View File

@ -0,0 +1,119 @@
#include "uint32.h"
#include "fmt.h"
#include "buffer.h"
#include "strerr.h"
#include "seek.h"
#include "cdb.h"
#define FATAL "cdbtest: fatal: "
void die_read(void)
{
strerr_die2sys(111,FATAL,"unable to read input: ");
}
void die_write(void)
{
strerr_die2sys(111,FATAL,"unable to write output: ");
}
void put(char *buf,unsigned int len)
{
if (buffer_put(buffer_1small,buf,len) == -1) die_write();
}
void putflush(void)
{
if (buffer_flush(buffer_1small) == -1) die_write();
}
uint32 pos = 0;
void get(char *buf,unsigned int len)
{
int r;
while (len > 0) {
r = buffer_get(buffer_0,buf,len);
if (r == -1) die_read();
if (r == 0)
strerr_die2x(111,FATAL,"unable to read input: truncated file");
pos += r;
buf += r;
len -= r;
}
}
void getnum(uint32 *num)
{
char buf[4];
get(buf,4);
uint32_unpack(buf,num);
}
char strnum[FMT_ULONG];
void putnum(char *label,unsigned long count)
{
put(label,str_len(label));
put(strnum,fmt_ulong(strnum,count));
put("\n",1);
}
char key[1024];
unsigned long numuntested = 0;
unsigned long numnotfound = 0;
unsigned long numotherpos = 0;
unsigned long numbadlen = 0;
unsigned long numfound = 0;
static struct cdb c;
main()
{
uint32 eod;
uint32 klen;
uint32 dlen;
seek_pos rest;
int r;
cdb_init(&c,0);
getnum(&eod);
while (pos < 2048) getnum(&dlen);
while (pos < eod) {
getnum(&klen);
getnum(&dlen);
if (klen > sizeof key) {
++numuntested;
while (klen) { get(key,1); --klen; }
}
else {
get(key,klen);
rest = seek_cur(0);
switch(cdb_find(&c,key,klen)) {
case -1:
die_read();
case 0:
++numnotfound;
break;
default:
if (cdb_datapos(&c) != pos)
++numotherpos;
else
if (cdb_datalen(&c) != dlen)
++numbadlen;
else
++numfound;
}
if (seek_set(0,rest) == -1) die_read();
}
while (dlen) { get(key,1); --dlen; }
}
putnum("found: ",numfound);
putnum("different record: ",numotherpos);
putnum("bad length: ",numbadlen);
putnum("not found: ",numnotfound);
putnum("untested: ",numuntested);
putflush();
_exit(0);
}

View File

@ -0,0 +1,18 @@
result="$4"
case "$1" in
*c*) ./compile $2.c >/dev/null 2>&1 || result="$3" ;;
esac
case "$1" in
*l*) ./load $2 >/dev/null 2>&1 || result="$3" ;;
esac
case "$1" in
*r*) ./$2 >/dev/null 2>&1 || result="$3" ;;
esac
rm -f $2.o $2
exec cat "$result"

View File

@ -0,0 +1,3 @@
gcc -O2
This will be used to compile .c files.

View File

@ -0,0 +1,3 @@
/usr/local
This is the cdb home directory. Programs will be installed in .../bin.

View File

@ -0,0 +1,3 @@
gcc -s
This will be used to link .o files into an executable.

109
isdnlog/tools/cdb/error.c Normal file
View File

@ -0,0 +1,109 @@
#include <errno.h>
#include "error.h"
/* warning: as coverage improves here, should update error_{str,temp} */
int error_intr =
#ifdef EINTR
EINTR;
#else
-1;
#endif
int error_nomem =
#ifdef ENOMEM
ENOMEM;
#else
-2;
#endif
int error_noent =
#ifdef ENOENT
ENOENT;
#else
-3;
#endif
int error_txtbsy =
#ifdef ETXTBSY
ETXTBSY;
#else
-4;
#endif
int error_io =
#ifdef EIO
EIO;
#else
-5;
#endif
int error_exist =
#ifdef EEXIST
EEXIST;
#else
-6;
#endif
int error_timeout =
#ifdef ETIMEDOUT
ETIMEDOUT;
#else
-7;
#endif
int error_inprogress =
#ifdef EINPROGRESS
EINPROGRESS;
#else
-8;
#endif
int error_wouldblock =
#ifdef EWOULDBLOCK
EWOULDBLOCK;
#else
-9;
#endif
int error_again =
#ifdef EAGAIN
EAGAIN;
#else
-10;
#endif
int error_pipe =
#ifdef EPIPE
EPIPE;
#else
-11;
#endif
int error_perm =
#ifdef EPERM
EPERM;
#else
-12;
#endif
int error_acces =
#ifdef EACCES
EACCES;
#else
-13;
#endif
int error_nodevice =
#ifdef ENXIO
ENXIO;
#else
-14;
#endif
int error_proto =
#ifdef EPROTO
EPROTO;
#else
-15;
#endif

25
isdnlog/tools/cdb/error.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef ERROR_H
#define ERROR_H
extern int errno;
extern int error_intr;
extern int error_nomem;
extern int error_noent;
extern int error_txtbsy;
extern int error_io;
extern int error_exist;
extern int error_timeout;
extern int error_inprogress;
extern int error_wouldblock;
extern int error_again;
extern int error_pipe;
extern int error_perm;
extern int error_acces;
extern int error_nodevice;
extern int error_proto;
extern char *error_str(int);
extern int error_temp(int);
#endif

View File

@ -0,0 +1,271 @@
#include <errno.h>
#include "error.h"
#define X(e,s) if (i == e) return s;
char *error_str(int i)
{
X(0,"no error")
X(error_intr,"interrupted system call")
X(error_nomem,"out of memory")
X(error_noent,"file does not exist")
X(error_txtbsy,"text busy")
X(error_io,"input/output error")
X(error_exist,"file already exists")
X(error_timeout,"timed out")
X(error_inprogress,"operation in progress")
X(error_again,"temporary failure")
X(error_wouldblock,"input/output would block")
X(error_pipe,"broken pipe")
X(error_perm,"permission denied")
X(error_acces,"access denied")
X(error_nodevice,"device not configured")
X(error_proto,"protocol error")
#ifdef ESRCH
X(ESRCH,"no such process")
#endif
#ifdef E2BIG
X(E2BIG,"argument list too long")
#endif
#ifdef ENOEXEC
X(ENOEXEC,"exec format error")
#endif
#ifdef EBADF
X(EBADF,"file descriptor not open")
#endif
#ifdef ECHILD
X(ECHILD,"no child processes")
#endif
#ifdef EDEADLK
X(EDEADLK,"operation would cause deadlock")
#endif
#ifdef EFAULT
X(EFAULT,"bad address")
#endif
#ifdef ENOTBLK
X(ENOTBLK,"not a block device")
#endif
#ifdef EBUSY
X(EBUSY,"device busy")
#endif
#ifdef EXDEV
X(EXDEV,"cross-device link")
#endif
#ifdef ENODEV
X(ENODEV,"device does not support operation")
#endif
#ifdef ENOTDIR
X(ENOTDIR,"not a directory")
#endif
#ifdef EISDIR
X(EISDIR,"is a directory")
#endif
#ifdef EINVAL
X(EINVAL,"invalid argument")
#endif
#ifdef ENFILE
X(ENFILE,"system cannot open more files")
#endif
#ifdef EMFILE
X(EMFILE,"process cannot open more files")
#endif
#ifdef ENOTTY
X(ENOTTY,"not a tty")
#endif
#ifdef EFBIG
X(EFBIG,"file too big")
#endif
#ifdef ENOSPC
X(ENOSPC,"out of disk space")
#endif
#ifdef ESPIPE
X(ESPIPE,"unseekable descriptor")
#endif
#ifdef EROFS
X(EROFS,"read-only file system")
#endif
#ifdef EMLINK
X(EMLINK,"too many links")
#endif
#ifdef EDOM
X(EDOM,"input out of range")
#endif
#ifdef ERANGE
X(ERANGE,"output out of range")
#endif
#ifdef EALREADY
X(EALREADY,"operation already in progress")
#endif
#ifdef ENOTSOCK
X(ENOTSOCK,"not a socket")
#endif
#ifdef EDESTADDRREQ
X(EDESTADDRREQ,"destination address required")
#endif
#ifdef EMSGSIZE
X(EMSGSIZE,"message too long")
#endif
#ifdef EPROTOTYPE
X(EPROTOTYPE,"incorrect protocol type")
#endif
#ifdef ENOPROTOOPT
X(ENOPROTOOPT,"protocol not available")
#endif
#ifdef EPROTONOSUPPORT
X(EPROTONOSUPPORT,"protocol not supported")
#endif
#ifdef ESOCKTNOSUPPORT
X(ESOCKTNOSUPPORT,"socket type not supported")
#endif
#ifdef EOPNOTSUPP
X(EOPNOTSUPP,"operation not supported")
#endif
#ifdef EPFNOSUPPORT
X(EPFNOSUPPORT,"protocol family not supported")
#endif
#ifdef EAFNOSUPPORT
X(EAFNOSUPPORT,"address family not supported")
#endif
#ifdef EADDRINUSE
X(EADDRINUSE,"address already used")
#endif
#ifdef EADDRNOTAVAIL
X(EADDRNOTAVAIL,"address not available")
#endif
#ifdef ENETDOWN
X(ENETDOWN,"network down")
#endif
#ifdef ENETUNREACH
X(ENETUNREACH,"network unreachable")
#endif
#ifdef ENETRESET
X(ENETRESET,"network reset")
#endif
#ifdef ECONNABORTED
X(ECONNABORTED,"connection aborted")
#endif
#ifdef ECONNRESET
X(ECONNRESET,"connection reset")
#endif
#ifdef ENOBUFS
X(ENOBUFS,"out of buffer space")
#endif
#ifdef EISCONN
X(EISCONN,"already connected")
#endif
#ifdef ENOTCONN
X(ENOTCONN,"not connected")
#endif
#ifdef ESHUTDOWN
X(ESHUTDOWN,"socket shut down")
#endif
#ifdef ETOOMANYREFS
X(ETOOMANYREFS,"too many references")
#endif
#ifdef ECONNREFUSED
X(ECONNREFUSED,"connection refused")
#endif
#ifdef ELOOP
X(ELOOP,"symbolic link loop")
#endif
#ifdef ENAMETOOLONG
X(ENAMETOOLONG,"file name too long")
#endif
#ifdef EHOSTDOWN
X(EHOSTDOWN,"host down")
#endif
#ifdef EHOSTUNREACH
X(EHOSTUNREACH,"host unreachable")
#endif
#ifdef ENOTEMPTY
X(ENOTEMPTY,"directory not empty")
#endif
#ifdef EPROCLIM
X(EPROCLIM,"too many processes")
#endif
#ifdef EUSERS
X(EUSERS,"too many users")
#endif
#ifdef EDQUOT
X(EDQUOT,"disk quota exceeded")
#endif
#ifdef ESTALE
X(ESTALE,"stale NFS file handle")
#endif
#ifdef EREMOTE
X(EREMOTE,"too many levels of remote in path")
#endif
#ifdef EBADRPC
X(EBADRPC,"RPC structure is bad")
#endif
#ifdef ERPCMISMATCH
X(ERPCMISMATCH,"RPC version mismatch")
#endif
#ifdef EPROGUNAVAIL
X(EPROGUNAVAIL,"RPC program unavailable")
#endif
#ifdef EPROGMISMATCH
X(EPROGMISMATCH,"program version mismatch")
#endif
#ifdef EPROCUNAVAIL
X(EPROCUNAVAIL,"bad procedure for program")
#endif
#ifdef ENOLCK
X(ENOLCK,"no locks available")
#endif
#ifdef ENOSYS
X(ENOSYS,"system call not available")
#endif
#ifdef EFTYPE
X(EFTYPE,"bad file type")
#endif
#ifdef EAUTH
X(EAUTH,"authentication error")
#endif
#ifdef ENEEDAUTH
X(ENEEDAUTH,"not authenticated")
#endif
#ifdef ENOSTR
X(ENOSTR,"not a stream device")
#endif
#ifdef ETIME
X(ETIME,"timer expired")
#endif
#ifdef ENOSR
X(ENOSR,"out of stream resources")
#endif
#ifdef ENOMSG
X(ENOMSG,"no message of desired type")
#endif
#ifdef EBADMSG
X(EBADMSG,"bad message type")
#endif
#ifdef EIDRM
X(EIDRM,"identifier removed")
#endif
#ifdef ENONET
X(ENONET,"machine not on network")
#endif
#ifdef ERREMOTE
X(ERREMOTE,"object not local")
#endif
#ifdef ENOLINK
X(ENOLINK,"link severed")
#endif
#ifdef EADV
X(EADV,"advertise error")
#endif
#ifdef ESRMNT
X(ESRMNT,"srmount error")
#endif
#ifdef ECOMM
X(ECOMM,"communication error")
#endif
#ifdef EMULTIHOP
X(EMULTIHOP,"multihop attempted")
#endif
#ifdef EREMCHG
X(EREMCHG,"remote address changed")
#endif
return "unknown error";
}

6
isdnlog/tools/cdb/exit.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef EXIT_H
#define EXIT_H
extern void _exit();
#endif

View File

@ -0,0 +1,159 @@
# oper-:arch-:syst-:chip-:kern-
# oper = operating system type; e.g., sunos-4.1.4
# arch = machine language; e.g., sparc
# syst = which binaries can run; e.g., sun4
# chip = chip model; e.g., micro-2-80
# kern = kernel version; e.g., sun4m
# dependence: arch --- chip
# \ \
# oper --- syst --- kern
# so, for example, syst is interpreted in light of oper, but chip is not.
# anyway, no slashes, no extra colons, no uppercase letters.
# the point of the extra -'s is to ease parsing: can add hierarchies later.
# e.g., *:i386-*:*:pentium-*:* would handle pentium-100 as well as pentium,
# and i386-486 (486s do have more instructions, you know) as well as i386.
# the idea here is to include ALL useful available information.
exec 2>/dev/null
sys="`uname -s | tr '/:[A-Z]' '..[a-z]'`"
if [ x"$sys" != x ]
then
unamer="`uname -r | tr /: ..`"
unamem="`uname -m | tr /: ..`"
unamev="`uname -v | tr /: ..`"
case "$sys" in
bsd.os)
# in bsd 4.4, uname -v does not have useful info.
# in bsd 4.4, uname -m is arch, not chip.
oper="$sys-$unamer"
arch="$unamem"
syst=""
chip="`sysctl -n hw.model`"
kern=""
;;
freebsd)
# see above about bsd 4.4
oper="$sys-$unamer"
arch="$unamem"
syst=""
chip="`sysctl -n hw.model`" # hopefully
kern=""
;;
netbsd)
# see above about bsd 4.4
oper="$sys-$unamer"
arch="$unamem"
syst=""
chip="`sysctl -n hw.model`" # hopefully
kern=""
;;
linux)
# as in bsd 4.4, uname -v does not have useful info.
oper="$sys-$unamer"
syst=""
chip="$unamem"
kern=""
case "$chip" in
i386|i486|i586|i686)
arch="i386"
;;
alpha)
arch="alpha"
;;
esac
;;
aix)
# naturally IBM has to get uname -r and uname -v backwards. dorks.
oper="$sys-$unamev-$unamer"
arch="`arch | tr /: ..`"
syst=""
chip="$unamem"
kern=""
;;
sunos)
oper="$sys-$unamer-$unamev"
arch="`(uname -p || mach) | tr /: ..`"
syst="`arch | tr /: ..`"
chip="$unamem" # this is wrong; is there any way to get the real info?
kern="`arch -k | tr /: ..`"
;;
unix_sv)
oper="$sys-$unamer-$unamev"
arch="`uname -m`"
syst=""
chip="$unamem"
kern=""
;;
*)
oper="$sys-$unamer-$unamev"
arch="`arch | tr /: ..`"
syst=""
chip="$unamem"
kern=""
;;
esac
else
$CC -c trycpp.c
$LD -o trycpp trycpp.o
case `./trycpp` in
nextstep)
oper="nextstep-`hostinfo | sed -n 's/^[ ]*NeXT Mach \([^:]*\):.*$/\1/p'`"
arch="`hostinfo | sed -n 's/^Processor type: \(.*\) (.*)$/\1/p' | tr /: ..`"
syst=""
chip="`hostinfo | sed -n 's/^Processor type: .* (\(.*\))$/\1/p' | tr ' /:' '...'`"
kern=""
;;
*)
oper="unknown"
arch=""
syst=""
chip=""
kern=""
;;
esac
rm -f trycpp.o trycpp
fi
case "$chip" in
80486)
# let's try to be consistent here. (BSD/OS)
chip=i486
;;
i486DX)
# respect the hyphen hierarchy. (FreeBSD)
chip=i486-dx
;;
i486.DX2)
# respect the hyphen hierarchy. (FreeBSD)
chip=i486-dx2
;;
Intel.586)
# no, you nitwits, there is no such chip. (NeXTStep)
chip=pentium
;;
i586)
# no, you nitwits, there is no such chip. (Linux)
chip=pentium
;;
i686)
# STOP SAYING THAT! (Linux)
chip=ppro
esac
if $CC -c x86cpuid.c
then
if $LD -o x86cpuid x86cpuid.o
then
x86cpuid="`./x86cpuid | tr /: ..`"
case "$x86cpuid" in
?*)
chip="$x86cpuid"
;;
esac
fi
fi
rm -f x86cpuid x86cpuid.o
echo "$oper-:$arch-:$syst-:$chip-:$kern-" | tr ' [A-Z]' '.[a-z]'

25
isdnlog/tools/cdb/fmt.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef FMT_H
#define FMT_H
#define FMT_ULONG 40 /* enough space to hold 2^128 - 1 in decimal, plus \0 */
#define FMT_LEN ((char *) 0) /* convenient abbreviation */
extern unsigned int fmt_uint(char *,unsigned int);
extern unsigned int fmt_uint0(char *,unsigned int,unsigned int);
extern unsigned int fmt_xint(char *,unsigned int);
extern unsigned int fmt_nbbint(char *,unsigned int,unsigned int,unsigned int,unsigned int);
extern unsigned int fmt_ushort(char *,unsigned short);
extern unsigned int fmt_xshort(char *,unsigned short);
extern unsigned int fmt_nbbshort(char *,unsigned int,unsigned int,unsigned int,unsigned short);
extern unsigned int fmt_ulong(char *,unsigned long);
extern unsigned int fmt_xlong(char *,unsigned long);
extern unsigned int fmt_nbblong(char *,unsigned int,unsigned int,unsigned int,unsigned long);
extern unsigned int fmt_plusminus(char *,int);
extern unsigned int fmt_minus(char *,int);
extern unsigned int fmt_0x(char *,int);
extern unsigned int fmt_str(char *,char *);
extern unsigned int fmt_strn(char *,char *,unsigned int);
#endif

View File

@ -0,0 +1,13 @@
#include "fmt.h"
unsigned int fmt_ulong(register char *s,register unsigned long u)
{
register unsigned int len; register unsigned long q;
len = 1; q = u;
while (q > 9) { ++len; q /= 10; }
if (s) {
s += len;
do { *--s = '0' + (u % 10); u /= 10; } while(u); /* handles u == 0 */
}
return len;
}

15
isdnlog/tools/cdb/hier.c Normal file
View File

@ -0,0 +1,15 @@
#include "auto_home.h"
void hier()
{
h(auto_home,-1,-1,02755);
d(auto_home,"bin",-1,-1,02755);
c(auto_home,"bin","cdbget",-1,-1,0755);
c(auto_home,"bin","cdbmake",-1,-1,0755);
c(auto_home,"bin","cdbdump",-1,-1,0755);
c(auto_home,"bin","cdbstats",-1,-1,0755);
c(auto_home,"bin","cdbtest",-1,-1,0755);
c(auto_home,"bin","cdbmake-12",-1,-1,0755);
c(auto_home,"bin","cdbmake-sv",-1,-1,0755);
}

155
isdnlog/tools/cdb/i4l_cdb.c Normal file
View File

@ -0,0 +1,155 @@
/*
* i4l_cdb ... constant database for isdntools
*
* s. also zone/common.h for the macros
*
* This is a gdbm replacement with only the functions used in isdnlog
* database files are either written (by mkzonedb or dest/Makefile)
* or read.
* Read and write access can't be mixed, also writing must be done in
* one step.
*
* Copyright 2000 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.
*
*
* History
*
* 26.07.2000 V0.10 lt stable ;-)
*
*/
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <malloc.h>
#include "i4l_cdb.h"
_DB i4l_cdb_open(char *name, int wr) {
_DB d = 0;
int fd;
fd = open(name, wr ? O_RDWR|O_CREAT|O_TRUNC : O_RDONLY, 0644);
if (fd >= 0) {
d = calloc(sizeof(_DB), 1);
if (d == NULL) {
close(fd);
return NULL;
}
d->cdb = calloc(sizeof(struct cdb), 1);
if (d->cdb == NULL) {
close(fd);
free(d);
return NULL;
}
if (wr) {
d->cdb_make = calloc(sizeof(struct cdb_make), 1);
d->writing = 1;
if (d->cdb_make == NULL) {
err:
close(fd);
free(d->cdb);
free(d);
return NULL;
}
if (cdb_make_start(d->cdb_make, fd) == -1) {
free(d->cdb_make);
goto err;
}
}
else
cdb_init(d->cdb, fd);
}
return d;
}
void i4l_cdb_close(_DB d) {
if (!d)
return;
if (d->cdb_make) {
cdb_make_finish(d->cdb_make);
free(d->cdb_make);
}
cdb_free(d->cdb);
close(d->cdb->fd);
free(d->cdb);
free(d);
}
int i4l_cdb_store(_DB d, datum key, datum value) {
if (!d)
return -1;
if(cdb_make_add(d->cdb_make, key.dptr, key.dsize, value.dptr, value.dsize) == -1)
return -1;
return 0;
}
datum i4l_cdb_fetch(_DB d, datum key) {
int r;
uint32 pos, len;
static unsigned char buf[1024];
datum value;
value.dptr = NULL;
value.dsize = 0;
if (!d)
return value;
if(d->writing)
return value;
cdb_findstart(d->cdb);
r = cdb_findnext(d->cdb, key.dptr, key.dsize);
if (r <= 0)
return value;
pos = cdb_datapos(d->cdb);
len = cdb_datalen(d->cdb);
#ifdef WE_DONT_MODIFY_FESULT_OF_CDBREAD
/* we return a pointer to mapped region if we can */
/* nice idea - forget it */
if (d->cdb->map) {
if ((pos > d->cdb->size) || (d->cdb->size - pos < len))
return value;
value.dptr = d->cdb->map + pos;
value.dsize = len;
}
else
#endif
{
/* we return result in a static buffer */
r = sizeof buf;
if (len > r)
return value;
if (r > len) r = len;
if (cdb_read(d->cdb,buf,r,pos) == -1)
return value;
value.dptr = buf;
value.dsize = len;
}
return value;
}
int i4l_cdb_exists(_DB d, datum key) {
int r;
if (!d)
return 0;
if(d->writing)
return 0;
cdb_findstart(d->cdb);
r = cdb_findnext(d->cdb, key.dptr, key.dsize);
return (r <= 0) ? 0 : 1;
}

View File

@ -0,0 +1,384 @@
diff -ur /home/lt/src/cdb-0.75/Makefile cdb/Makefile
--- /home/lt/src/cdb-0.75/Makefile Sat Feb 19 21:42:05 2000
+++ cdb/Makefile Thu Jul 27 15:25:49 2000
@@ -2,8 +2,21 @@
SHELL=/bin/sh
-default: it
+default: cdbmake i4l_cdb.a
+i4l_cdb.o: compile i4l_cdb.c i4l_cdb.h
+ ./compile i4l_cdb.c
+
+i4l_cdb.a: makelib cdb_make.o i4l_cdb.o
+ ./makelib i4l_cdb.a i4l_cdb.o cdb_make.o
+
+clean:
+ -rm *.o *.a cdbdump cdbget cdbmake{,-12,-sv} cdbstats \
+ cdbtest compile install instcheck load makelib rts testzero 2> /dev/null
+
+distclean: clean
+ -rm autostr auto_home.c systype uint32.h 2> /dev/null
+
alloc.a: \
makelib alloc.o
./makelib alloc.a alloc.o
@@ -166,10 +179,11 @@
compile: \
warn-auto.sh conf-cc
- ( cat warn-auto.sh; \
+ @( cat warn-auto.sh; \
echo exec "`head -1 conf-cc`" '-c $${1+"$$@"}' \
) > compile
- chmod 755 compile
+ @echo Making with `cat compile`
+ @chmod 755 compile
error.o: \
compile error.c error.h
Only in cdb: README.first
diff -ur /home/lt/src/cdb-0.75/buffer.c cdb/buffer.c
--- /home/lt/src/cdb-0.75/buffer.c Sat Feb 19 21:42:05 2000
+++ cdb/buffer.c Wed Jul 26 11:20:10 2000
@@ -1,6 +1,6 @@
#include "buffer.h"
-void buffer_init(buffer *s,int (*op)(),int fd,char *buf,unsigned int len)
+void buffer_init(cdb_buffer *s,int (*op)(),int fd,char *buf,unsigned int len)
{
s->x = buf;
s->fd = fd;
diff -ur /home/lt/src/cdb-0.75/buffer.h cdb/buffer.h
--- /home/lt/src/cdb-0.75/buffer.h Sat Feb 19 21:42:05 2000
+++ cdb/buffer.h Wed Jul 26 11:20:27 2000
@@ -1,27 +1,27 @@
#ifndef BUFFER_H
#define BUFFER_H
-typedef struct buffer {
+typedef struct cdb_buffer {
char *x;
unsigned int p;
unsigned int n;
int fd;
int (*op)();
-} buffer;
+} cdb_buffer;
#define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) }
#define BUFFER_INSIZE 8192
#define BUFFER_OUTSIZE 8192
-extern void buffer_init(buffer *,int (*)(),int,char *,unsigned int);
+extern void buffer_init(cdb_buffer *,int (*)(),int,char *,unsigned int);
-extern int buffer_flush(buffer *);
-extern int buffer_put(buffer *,char *,unsigned int);
-extern int buffer_putalign(buffer *,char *,unsigned int);
-extern int buffer_putflush(buffer *,char *,unsigned int);
-extern int buffer_puts(buffer *,char *);
-extern int buffer_putsalign(buffer *,char *);
-extern int buffer_putsflush(buffer *,char *);
+extern int buffer_flush(cdb_buffer *);
+extern int buffer_put(cdb_buffer *,char *,unsigned int);
+extern int buffer_putalign(cdb_buffer *,char *,unsigned int);
+extern int buffer_putflush(cdb_buffer *,char *,unsigned int);
+extern int buffer_puts(cdb_buffer *,char *);
+extern int buffer_putsalign(cdb_buffer *,char *);
+extern int buffer_putsflush(cdb_buffer *,char *);
#define buffer_PUTC(s,c) \
( ((s)->n != (s)->p) \
@@ -29,12 +29,12 @@
: buffer_put((s),&(c),1) \
)
-extern int buffer_get(buffer *,char *,unsigned int);
-extern int buffer_bget(buffer *,char *,unsigned int);
-extern int buffer_feed(buffer *);
+extern int buffer_get(cdb_buffer *,char *,unsigned int);
+extern int buffer_bget(cdb_buffer *,char *,unsigned int);
+extern int buffer_feed(cdb_buffer *);
-extern char *buffer_peek(buffer *);
-extern void buffer_seek(buffer *,unsigned int);
+extern char *buffer_peek(cdb_buffer *);
+extern void buffer_seek(cdb_buffer *,unsigned int);
#define buffer_PEEK(s) ( (s)->x + (s)->n )
#define buffer_SEEK(s,len) ( ( (s)->p -= (len) ) , ( (s)->n += (len) ) )
@@ -45,12 +45,12 @@
: buffer_get((s),(c),1) \
)
-extern int buffer_copy(buffer *,buffer *);
+extern int buffer_copy(cdb_buffer *,cdb_buffer *);
-extern buffer *buffer_0;
-extern buffer *buffer_0small;
-extern buffer *buffer_1;
-extern buffer *buffer_1small;
-extern buffer *buffer_2;
+extern cdb_buffer *buffer_0;
+extern cdb_buffer *buffer_0small;
+extern cdb_buffer *buffer_1;
+extern cdb_buffer *buffer_1small;
+extern cdb_buffer *buffer_2;
#endif
diff -ur /home/lt/src/cdb-0.75/buffer_0.c cdb/buffer_0.c
--- /home/lt/src/cdb-0.75/buffer_0.c Sat Feb 19 21:42:05 2000
+++ cdb/buffer_0.c Wed Jul 26 11:20:35 2000
@@ -8,5 +8,5 @@
}
char buffer_0_space[BUFFER_INSIZE];
-static buffer it = BUFFER_INIT(buffer_0_read,0,buffer_0_space,sizeof buffer_0_space);
-buffer *buffer_0 = &it;
+static cdb_buffer it = BUFFER_INIT(buffer_0_read,0,buffer_0_space,sizeof buffer_0_space);
+cdb_buffer *buffer_0 = &it;
diff -ur /home/lt/src/cdb-0.75/buffer_1.c cdb/buffer_1.c
--- /home/lt/src/cdb-0.75/buffer_1.c Sat Feb 19 21:42:05 2000
+++ cdb/buffer_1.c Wed Jul 26 11:20:42 2000
@@ -2,5 +2,5 @@
#include "buffer.h"
char buffer_1_space[BUFFER_OUTSIZE];
-static buffer it = BUFFER_INIT(write,1,buffer_1_space,sizeof buffer_1_space);
-buffer *buffer_1 = &it;
+static cdb_buffer it = BUFFER_INIT(write,1,buffer_1_space,sizeof buffer_1_space);
+cdb_buffer *buffer_1 = &it;
diff -ur /home/lt/src/cdb-0.75/buffer_1s.c cdb/buffer_1s.c
--- /home/lt/src/cdb-0.75/buffer_1s.c Sat Feb 19 21:42:05 2000
+++ cdb/buffer_1s.c Wed Jul 26 11:20:49 2000
@@ -2,5 +2,5 @@
#include "buffer.h"
char buffer_1small_space[256];
-static buffer it = BUFFER_INIT(write,1,buffer_1small_space,sizeof buffer_1small_space);
-buffer *buffer_1small = &it;
+static cdb_buffer it = BUFFER_INIT(write,1,buffer_1small_space,sizeof buffer_1small_space);
+cdb_buffer *buffer_1small = &it;
diff -ur /home/lt/src/cdb-0.75/buffer_2.c cdb/buffer_2.c
--- /home/lt/src/cdb-0.75/buffer_2.c Sat Feb 19 21:42:05 2000
+++ cdb/buffer_2.c Wed Jul 26 11:20:56 2000
@@ -2,5 +2,5 @@
#include "buffer.h"
char buffer_2_space[256];
-static buffer it = BUFFER_INIT(write,2,buffer_2_space,sizeof buffer_2_space);
-buffer *buffer_2 = &it;
+static cdb_buffer it = BUFFER_INIT(write,2,buffer_2_space,sizeof buffer_2_space);
+cdb_buffer *buffer_2 = &it;
diff -ur /home/lt/src/cdb-0.75/buffer_copy.c cdb/buffer_copy.c
--- /home/lt/src/cdb-0.75/buffer_copy.c Sat Feb 19 21:42:05 2000
+++ cdb/buffer_copy.c Wed Jul 26 11:21:04 2000
@@ -1,6 +1,6 @@
#include "buffer.h"
-int buffer_copy(buffer *bout,buffer *bin)
+int buffer_copy(cdb_buffer *bout,cdb_buffer *bin)
{
int n;
char *x;
diff -ur /home/lt/src/cdb-0.75/buffer_get.c cdb/buffer_get.c
--- /home/lt/src/cdb-0.75/buffer_get.c Sat Feb 19 21:42:05 2000
+++ cdb/buffer_get.c Wed Jul 26 11:21:13 2000
@@ -13,7 +13,7 @@
}
}
-static int getthis(buffer *s,char *buf,unsigned int len)
+static int getthis(cdb_buffer *s,char *buf,unsigned int len)
{
if (len > s->p) len = s->p;
s->p -= len;
@@ -22,7 +22,7 @@
return len;
}
-int buffer_feed(buffer *s)
+int buffer_feed(cdb_buffer *s)
{
int r;
@@ -35,7 +35,7 @@
return r;
}
-int buffer_bget(buffer *s,char *buf,unsigned int len)
+int buffer_bget(cdb_buffer *s,char *buf,unsigned int len)
{
int r;
@@ -45,7 +45,7 @@
return getthis(s,buf,len);
}
-int buffer_get(buffer *s,char *buf,unsigned int len)
+int buffer_get(cdb_buffer *s,char *buf,unsigned int len)
{
int r;
@@ -55,12 +55,12 @@
return getthis(s,buf,len);
}
-char *buffer_peek(buffer *s)
+char *buffer_peek(cdb_buffer *s)
{
return s->x + s->n;
}
-void buffer_seek(buffer *s,unsigned int len)
+void buffer_seek(cdb_buffer *s,unsigned int len)
{
s->n += len;
s->p -= len;
diff -ur /home/lt/src/cdb-0.75/buffer_put.c cdb/buffer_put.c
--- /home/lt/src/cdb-0.75/buffer_put.c Sat Feb 19 21:42:05 2000
+++ cdb/buffer_put.c Wed Jul 26 11:21:22 2000
@@ -20,7 +20,7 @@
return 0;
}
-int buffer_flush(buffer *s)
+int buffer_flush(cdb_buffer *s)
{
int p;
@@ -30,7 +30,7 @@
return allwrite(s->op,s->fd,s->x,p);
}
-int buffer_putalign(buffer *s,char *buf,unsigned int len)
+int buffer_putalign(cdb_buffer *s,char *buf,unsigned int len)
{
unsigned int n;
@@ -44,7 +44,7 @@
return 0;
}
-int buffer_put(buffer *s,char *buf,unsigned int len)
+int buffer_put(cdb_buffer *s,char *buf,unsigned int len)
{
unsigned int n;
@@ -66,23 +66,23 @@
return 0;
}
-int buffer_putflush(buffer *s,char *buf,unsigned int len)
+int buffer_putflush(cdb_buffer *s,char *buf,unsigned int len)
{
if (buffer_flush(s) == -1) return -1;
return allwrite(s->op,s->fd,buf,len);
}
-int buffer_putsalign(buffer *s,char *buf)
+int buffer_putsalign(cdb_buffer *s,char *buf)
{
return buffer_putalign(s,buf,str_len(buf));
}
-int buffer_puts(buffer *s,char *buf)
+int buffer_puts(cdb_buffer *s,char *buf)
{
return buffer_put(s,buf,str_len(buf));
}
-int buffer_putsflush(buffer *s,char *buf)
+int buffer_putsflush(cdb_buffer *s,char *buf)
{
return buffer_putflush(s,buf,str_len(buf));
}
diff -ur /home/lt/src/cdb-0.75/cdb_make.h cdb/cdb_make.h
--- /home/lt/src/cdb-0.75/cdb_make.h Sat Feb 19 21:42:05 2000
+++ cdb/cdb_make.h Wed Jul 26 11:22:25 2000
@@ -25,7 +25,7 @@
struct cdb_hp *split; /* includes space for hash */
struct cdb_hp *hash;
uint32 numentries;
- buffer b;
+ cdb_buffer b;
uint32 pos;
int fd;
} ;
diff -ur /home/lt/src/cdb-0.75/cdbmake.c cdb/cdbmake.c
--- /home/lt/src/cdb-0.75/cdbmake.c Sat Feb 19 21:42:05 2000
+++ cdb/cdbmake.c Wed Jul 26 09:58:29 2000
@@ -21,15 +21,18 @@
{
strerr_die2sys(111,FATAL,"unable to read input: ");
}
-void die_readformat(void)
+void die_readformat(char *s, int l)
{
- strerr_die2x(111,FATAL,"unable to read input: bad format");
+ char b[256];
+ sprintf(b, "unable to read input: bad format in %d, '%s", l, s);
+ strerr_die2x(111,FATAL,b);
}
+ int line = 0;
inline void get(char *ch)
{
switch(buffer_GETC(buffer_0,ch)) {
- case 0: die_readformat();
+ case 0: die_readformat("null",line);
case -1: die_read();
}
}
@@ -59,14 +62,15 @@
if (cdb_make_start(&c,fd) == -1) die_write();
for (;;) {
+ line++;
get(&ch);
if (ch == '\n') break;
- if (ch != '+') die_readformat();
+ if (ch != '+') die_readformat("+", line);
klen = 0;
for (;;) {
get(&ch);
if (ch == ',') break;
- if ((ch < '0') || (ch > '9')) die_readformat();
+ if ((ch < '0') || (ch > '9')) die_readformat("klen",line);
if (klen > 429496720) { errno = error_nomem; die_write(); }
klen = klen * 10 + (ch - '0');
}
@@ -74,7 +78,7 @@
for (;;) {
get(&ch);
if (ch == ':') break;
- if ((ch < '0') || (ch > '9')) die_readformat();
+ if ((ch < '0') || (ch > '9')) die_readformat("dlen",line);
if (dlen > 429496720) { errno = error_nomem; die_write(); }
dlen = dlen * 10 + (ch - '0');
}
@@ -87,9 +91,9 @@
h = cdb_hashadd(h,ch);
}
get(&ch);
- if (ch != '-') die_readformat();
+ if (ch != '-') die_readformat("-", line);
get(&ch);
- if (ch != '>') die_readformat();
+ if (ch != '>') die_readformat(">", line);
for (i = 0;i < dlen;++i) {
get(&ch);
if (buffer_PUTC(&c.b,ch) == -1) die_write();
@@ -97,7 +101,7 @@
if (cdb_make_addend(&c,klen,dlen,h) == -1) die_write();
get(&ch);
- if (ch != '\n') die_readformat();
+ if (ch != '\n') die_readformat("nl",line);
}
if (cdb_make_finish(&c) == -1) die_write();
Only in cdb: i4l_cdb.c
Only in cdb: i4l_cdb.h

View File

@ -0,0 +1,28 @@
/*
GDB like interface for cdb
*/
#ifndef _I4L_CDB_H_
#define _I4L_CDB_H_
#include "cdb.h"
#include "cdb_make.h"
typedef struct datum_t {
unsigned char *dptr;
size_t dsize;
} datum;
typedef struct _db_t {
struct cdb *cdb;
struct cdb_make *cdb_make;
int writing;
} * _DB ;
_DB i4l_cdb_open(char *name, int wr);
void i4l_cdb_close(_DB d);
int i4l_cdb_store(_DB d, datum key, datum value);
datum i4l_cdb_fetch(_DB d, datum key);
int i4l_cdb_exists(_DB d, datum key);
#endif

149
isdnlog/tools/cdb/install.c Normal file
View File

@ -0,0 +1,149 @@
#include "buffer.h"
#include "strerr.h"
#include "error.h"
#include "open.h"
#include "readwrite.h"
#include "exit.h"
extern void hier();
#define FATAL "install: fatal: "
int fdsourcedir = -1;
void h(home,uid,gid,mode)
char *home;
int uid;
int gid;
int mode;
{
if (mkdir(home,0700) == -1)
if (errno != error_exist)
strerr_die4sys(111,FATAL,"unable to mkdir ",home,": ");
if (chown(home,uid,gid) == -1)
strerr_die4sys(111,FATAL,"unable to chown ",home,": ");
if (chmod(home,mode) == -1)
strerr_die4sys(111,FATAL,"unable to chmod ",home,": ");
}
void d(home,subdir,uid,gid,mode)
char *home;
char *subdir;
int uid;
int gid;
int mode;
{
if (chdir(home) == -1)
strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
if (mkdir(subdir,0700) == -1)
if (errno != error_exist)
strerr_die6sys(111,FATAL,"unable to mkdir ",home,"/",subdir,": ");
if (chown(subdir,uid,gid) == -1)
strerr_die6sys(111,FATAL,"unable to chown ",home,"/",subdir,": ");
if (chmod(subdir,mode) == -1)
strerr_die6sys(111,FATAL,"unable to chmod ",home,"/",subdir,": ");
}
char inbuf[BUFFER_INSIZE];
char outbuf[BUFFER_OUTSIZE];
buffer ssin;
buffer ssout;
void c(home,subdir,file,uid,gid,mode)
char *home;
char *subdir;
char *file;
int uid;
int gid;
int mode;
{
int fdin;
int fdout;
if (fchdir(fdsourcedir) == -1)
strerr_die2sys(111,FATAL,"unable to switch back to source directory: ");
fdin = open_read(file);
if (fdin == -1)
strerr_die4sys(111,FATAL,"unable to read ",file,": ");
buffer_init(&ssin,read,fdin,inbuf,sizeof inbuf);
if (chdir(home) == -1)
strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
if (chdir(subdir) == -1)
strerr_die6sys(111,FATAL,"unable to switch to ",home,"/",subdir,": ");
fdout = open_trunc(file);
if (fdout == -1)
strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
buffer_init(&ssout,write,fdout,outbuf,sizeof outbuf);
switch(buffer_copy(&ssout,&ssin)) {
case -2:
strerr_die4sys(111,FATAL,"unable to read ",file,": ");
case -3:
strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
}
close(fdin);
if (buffer_flush(&ssout) == -1)
strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
if (fsync(fdout) == -1)
strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
if (close(fdout) == -1) /* NFS silliness */
strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
if (chown(file,uid,gid) == -1)
strerr_die6sys(111,FATAL,"unable to chown .../",subdir,"/",file,": ");
if (chmod(file,mode) == -1)
strerr_die6sys(111,FATAL,"unable to chmod .../",subdir,"/",file,": ");
}
void z(home,subdir,file,len,uid,gid,mode)
char *home;
char *subdir;
char *file;
int len;
int uid;
int gid;
int mode;
{
int fdout;
if (chdir(home) == -1)
strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
if (chdir(subdir) == -1)
strerr_die6sys(111,FATAL,"unable to switch to ",home,"/",subdir,": ");
fdout = open_trunc(file);
if (fdout == -1)
strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
buffer_init(&ssout,write,fdout,outbuf,sizeof outbuf);
while (len-- > 0)
if (buffer_put(&ssout,"",1) == -1)
strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
if (buffer_flush(&ssout) == -1)
strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
if (fsync(fdout) == -1)
strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
if (close(fdout) == -1) /* NFS silliness */
strerr_die6sys(111,FATAL,"unable to write .../",subdir,"/",file,": ");
if (chown(file,uid,gid) == -1)
strerr_die6sys(111,FATAL,"unable to chown .../",subdir,"/",file,": ");
if (chmod(file,mode) == -1)
strerr_die6sys(111,FATAL,"unable to chmod .../",subdir,"/",file,": ");
}
main()
{
fdsourcedir = open_read(".");
if (fdsourcedir == -1)
strerr_die2sys(111,FATAL,"unable to open current directory: ");
umask(077);
hier();
_exit(0);
}

View File

@ -0,0 +1,108 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "strerr.h"
#include "error.h"
#include "readwrite.h"
#include "exit.h"
extern void hier();
#define FATAL "instcheck: fatal: "
#define WARNING "instcheck: warning: "
void perm(prefix1,prefix2,prefix3,file,type,uid,gid,mode)
char *prefix1;
char *prefix2;
char *prefix3;
char *file;
int type;
int uid;
int gid;
int mode;
{
struct stat st;
if (stat(file,&st) == -1) {
if (errno == error_noent)
strerr_warn6(WARNING,prefix1,prefix2,prefix3,file," does not exist",0);
else
strerr_warn4(WARNING,"unable to stat .../",file,": ",&strerr_sys);
return;
}
if ((uid != -1) && (st.st_uid != uid))
strerr_warn6(WARNING,prefix1,prefix2,prefix3,file," has wrong owner",0);
if ((gid != -1) && (st.st_gid != gid))
strerr_warn6(WARNING,prefix1,prefix2,prefix3,file," has wrong group",0);
if ((st.st_mode & 07777) != mode)
strerr_warn6(WARNING,prefix1,prefix2,prefix3,file," has wrong permissions",0);
if ((st.st_mode & S_IFMT) != type)
strerr_warn6(WARNING,prefix1,prefix2,prefix3,file," has wrong type",0);
}
void h(home,uid,gid,mode)
char *home;
int uid;
int gid;
int mode;
{
perm("","","",home,S_IFDIR,uid,gid,mode);
}
void d(home,subdir,uid,gid,mode)
char *home;
char *subdir;
int uid;
int gid;
int mode;
{
if (chdir(home) == -1)
strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
perm("",home,"/",subdir,S_IFDIR,uid,gid,mode);
}
void p(home,fifo,uid,gid,mode)
char *home;
char *fifo;
int uid;
int gid;
int mode;
{
if (chdir(home) == -1)
strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
perm("",home,"/",fifo,S_IFIFO,uid,gid,mode);
}
void c(home,subdir,file,uid,gid,mode)
char *home;
char *subdir;
char *file;
int uid;
int gid;
int mode;
{
if (chdir(home) == -1)
strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
if (chdir(subdir) == -1)
strerr_die6sys(111,FATAL,"unable to switch to ",home,"/",subdir,": ");
perm(".../",subdir,"/",file,S_IFREG,uid,gid,mode);
}
void z(home,file,len,uid,gid,mode)
char *home;
char *file;
int len;
int uid;
int gid;
int mode;
{
if (chdir(home) == -1)
strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
perm("",home,"/",file,S_IFREG,uid,gid,mode);
}
main()
{
hier();
_exit(0);
}

10
isdnlog/tools/cdb/open.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef OPEN_H
#define OPEN_H
extern int open_read(char *);
extern int open_excl(char *);
extern int open_append(char *);
extern int open_trunc(char *);
extern int open_write(char *);
#endif

View File

@ -0,0 +1,6 @@
#include <sys/types.h>
#include <fcntl.h>
#include "open.h"
int open_read(char *fn)
{ return open(fn,O_RDONLY | O_NDELAY); }

View File

@ -0,0 +1,6 @@
#include <sys/types.h>
#include <fcntl.h>
#include "open.h"
int open_trunc(char *fn)
{ return open(fn,O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT,0644); }

View File

@ -0,0 +1,7 @@
#ifndef READWRITE_H
#define READWRITE_H
extern int read();
extern int write();
#endif

251
isdnlog/tools/cdb/rts.exp Normal file
View File

@ -0,0 +1,251 @@
--- cdbmake handles simple example
0
--- cdbmake-12 handles simple example
0
--- cdbmake-sv handles simple example
0
--- cdbdump handles simple examples
+3,5:one->Hello
+3,7:two->Goodbye
0
+3,5:one->Hello
+3,7:two->Goodbye
0
+6,4:@7/tcp->echo
+8,1:echo/tcp->7
+6,4:@7/udp->echo
+8,1:echo/udp->7
+6,7:@9/tcp->discard
+11,1:discard/tcp->9
+8,1:sink/tcp->9
+8,1:null/tcp->9
+6,7:@9/udp->discard
+11,1:discard/udp->9
+8,1:sink/udp->9
+8,1:null/udp->9
+7,6:@11/tcp->systat
+10,2:systat/tcp->11
+9,2:users/tcp->11
+7,6:@11/udp->systat
+10,2:systat/udp->11
+9,2:users/udp->11
0
--- cdbtest handles simple examples
found: 2
different record: 0
bad length: 0
not found: 0
untested: 0
0
found: 2
different record: 0
bad length: 0
not found: 0
untested: 0
0
found: 18
different record: 0
bad length: 0
not found: 0
untested: 0
0
--- cdbstats handles simple examples
records 2
d0 2
d1 0
d2 0
d3 0
d4 0
d5 0
d6 0
d7 0
d8 0
d9 0
>9 0
0
records 2
d0 2
d1 0
d2 0
d3 0
d4 0
d5 0
d6 0
d7 0
d8 0
d9 0
>9 0
0
records 18
d0 18
d1 0
d2 0
d3 0
d4 0
d5 0
d6 0
d7 0
d8 0
d9 0
>9 0
0
--- cdbget retrieves data successfully
Hello
0
Goodbye
0
echo
0
echo
0
7
0
7
0
discard
0
discard
0
9
0
9
0
9
0
9
0
9
0
9
0
systat
0
systat
0
11
0
11
0
11
0
11
0
--- cdbget exits 100 on nonexistent data
100
100
--- cdbmake handles repeated keys
0
+3,5:one->Hello
+3,7:one->Goodbye
+3,7:one->Another
0
--- cdbget handles repeated keys
Hello
0
Hello
0
Goodbye
0
Another
0
100
100
--- cdbmake handles long keys and data
0
--- cdbdump handles long keys and data
+320,320:ba483b3442e75cace82def4b5df25bfca887b41687537c21dc4b82cb4c36315e2f6a0661d1af2e05e686c4c595c16561d8c1b3fbee8a6b99c54b3d10d61948445298e97e971f85a600c88164d6b0b09
b5169a54910232db0a56938de61256721667bddc1c0a2b14f5d063ab586a87a957e87f704acb7246c5e8c25becef713a365efef79bb1f406fecee88f3261f68e239c5903e3145961eb0fbc538ff506a
->152e113d5deec3638ead782b93e1b9666d265feb5aebc840e79aa69e2cfc1a2ce4b3254b79fa73c338d22a75e67cfed4cd17b92c405e204a48f21c31cdcf7da46312dc80debfbdaf6dc39d74694a711
6d170c5fde1a81806847cf71732c7f3217a38c6234235951af7b7c1d32e62d480d7c82a63a9d94291d92767ed97dd6a6809d1eb856ce23eda20268cb53fda31c016a19fc20e80aec3bd594a3eb82a5a
0
--- cdbtest handles long keys and data
found: 1
different record: 0
bad length: 0
not found: 0
untested: 0
0
--- cdbstats handles long keys and data
records 1
d0 1
d1 0
d2 0
d3 0
d4 0
d5 0
d6 0
d7 0
d8 0
d9 0
>9 0
0
--- cdbget handles long keys and data
152e113d5deec3638ead782b93e1b9666d265feb5aebc840e79aa69e2cfc1a2ce4b3254b79fa73c338d22a75e67cfed4cd17b92c405e204a48f21c31cdcf7da46312dc80debfbdaf6dc39d74694a711
6d170c5fde1a81806847cf71732c7f3217a38c6234235951af7b7c1d32e62d480d7c82a63a9d94291d92767ed97dd6a6809d1eb856ce23eda20268cb53fda31c016a19fc20e80aec3bd594a3eb82a5a
0
--- cdbmake handles unwritable tmp
cdbmake: fatal: unable to create loop: symbolic link loop
111
--- cdbmake handles unmovable cdb
cdbmake: fatal: unable to rename test.tmp to loop/test.cdb: symbolic link loop
111
--- cdbmake handles nomem
cdbmake: fatal: unable to create test.tmp: out of memory
111
--- cdbmake handles full disk
cdbmake: fatal: unable to create test.tmp: file too big
111
--- cdbmake handles absurd klen
cdbmake: fatal: unable to create test.tmp: out of memory
111
--- cdbget handles empty file
cdbget: fatal: unable to read input: protocol error
111
--- cdbdump and cdbmake handle random.cdb
0
--- cdbtest handles random.cdb
found: 100
different record: 0
bad length: 0
not found: 0
untested: 0
0
--- cdbstats handles random.cdb
records 100
d0 96
d1 4
d2 0
d3 0
d4 0
d5 0
d6 0
d7 0
d8 0
d9 0
>9 0
0
--- testzero works
0
found: 5
different record: 0
bad length: 0
not found: 0
untested: 0
0
--- testzero can build a database very close to 4GB
0
--- testzero complains if hash table passes 4GB
testzero: fatal: unable to write: out of memory
111
--- testzero complains if records pass 4GB
testzero: fatal: unable to write: out of memory
111

1
isdnlog/tools/cdb/rts.sh Normal file
View File

@ -0,0 +1 @@
env - PATH="`pwd`:$PATH" sh rts.tests 2>&1 | cat -v

210
isdnlog/tools/cdb/rts.tests Normal file
View File

@ -0,0 +1,210 @@
# Requirements:
# You have softlimit in your path.
# XFSZ is signal 25.
#
# Some features not tested here:
# cdbmake traps 4GB overflows.
umask 022
rm -rf rts-tmp
mkdir rts-tmp
cd rts-tmp
echo '--- cdbmake handles simple example'
echo '+3,5:one->Hello
+3,7:two->Goodbye
' | cdbmake test.cdb test.tmp
echo $?
echo '--- cdbmake-12 handles simple example'
echo '
one Hello
# comment line
two Goodbye
' | cdbmake-12 12.cdb 12.tmp
echo $?
echo '--- cdbmake-sv handles simple example'
echo '
# Network services, Internet style
echo 7/tcp
echo 7/udp
discard 9/tcp sink null
discard 9/udp sink null
systat 11/tcp users #Active Users
systat 11/udp users #Active Users
' | cdbmake-sv sv.cdb sv.tmp
echo $?
echo '--- cdbdump handles simple examples'
cdbdump < test.cdb
echo $?
cdbdump < 12.cdb
echo $?
cdbdump < sv.cdb
echo $?
echo '--- cdbtest handles simple examples'
cdbtest < test.cdb
echo $?
cdbtest < 12.cdb
echo $?
cdbtest < sv.cdb
echo $?
echo '--- cdbstats handles simple examples'
cdbstats < test.cdb
echo $?
cdbstats < 12.cdb
echo $?
cdbstats < sv.cdb
echo $?
echo '--- cdbget retrieves data successfully'
cdbget one < test.cdb
echo '
'$?
cdbget two < test.cdb
echo '
'$?
for i in @7 echo @9 discard sink null @11 systat users
do
cdbget $i/tcp < sv.cdb
echo '
'$?
cdbget $i/udp < sv.cdb
echo '
'$?
done
echo '--- cdbget exits 100 on nonexistent data'
cdbget three < test.cdb
echo $?
cdbget '#Active' < sv.cdb
echo $?
echo '--- cdbmake handles repeated keys'
echo '+3,5:one->Hello
+3,7:one->Goodbye
+3,7:one->Another
' | cdbmake rep.cdb rep.tmp
echo $?
cdbdump < rep.cdb
echo $?
echo '--- cdbget handles repeated keys'
cdbget one < rep.cdb
echo '
'$?
cdbget one 0 < rep.cdb
echo '
'$?
cdbget one 1 < rep.cdb
echo '
'$?
cdbget one 2 < rep.cdb
echo '
'$?
cdbget one 3 < rep.cdb
echo '
'$?
cdbget one 4 < rep.cdb
echo '
'$?
echo '--- cdbmake handles long keys and data'
echo '+320,320:ba483b3442e75cace82def4b5df25bfca887b41687537c21dc4b82cb4c36315e2f6a0661d1af2e05e686c4c595c16561d8c1b3fbee8a6b99c54b3d10d61948445298e97e971f85a600c88164d6b0b09
b5169a54910232db0a56938de61256721667bddc1c0a2b14f5d063ab586a87a957e87f704acb7246c5e8c25becef713a365efef79bb1f406fecee88f3261f68e239c5903e3145961eb0fbc538ff506a
->152e113d5deec3638ead782b93e1b9666d265feb5aebc840e79aa69e2cfc1a2ce4b3254b79fa73c338d22a75e67cfed4cd17b92c405e204a48f21c31cdcf7da46312dc80debfbdaf6dc39d74694a711
6d170c5fde1a81806847cf71732c7f3217a38c6234235951af7b7c1d32e62d480d7c82a63a9d94291d92767ed97dd6a6809d1eb856ce23eda20268cb53fda31c016a19fc20e80aec3bd594a3eb82a5a
' | cdbmake test.cdb test.tmp
echo $?
echo '--- cdbdump handles long keys and data'
cdbdump < test.cdb
echo $?
echo '--- cdbtest handles long keys and data'
cdbtest < test.cdb
echo $?
echo '--- cdbstats handles long keys and data'
cdbstats < test.cdb
echo $?
echo '--- cdbget handles long keys and data'
cdbget 'ba483b3442e75cace82def4b5df25bfca887b41687537c21dc4b82cb4c36315e2f6a0661d1af2e05e686c4c595c16561d8c1b3fbee8a6b99c54b3d10d61948445298e97e971f85a600c88164d6b0b09
b5169a54910232db0a56938de61256721667bddc1c0a2b14f5d063ab586a87a957e87f704acb7246c5e8c25becef713a365efef79bb1f406fecee88f3261f68e239c5903e3145961eb0fbc538ff506a
' < test.cdb
echo '
'$?
echo '--- cdbmake handles unwritable tmp'
ln -s loop loop
echo '' | cdbmake test.cdb loop
echo $?
echo '--- cdbmake handles unmovable cdb'
echo '' | cdbmake loop/test.cdb test.tmp
echo $?
echo '--- cdbmake handles nomem'
csh -cf 'repeat 5000 echo "+3,5:one->Hello"' \
| softlimit -d 50000 cdbmake test.cdb test.tmp
echo $?
echo '--- cdbmake handles full disk'
(
trap '' 25
echo '' | softlimit -f 2047 cdbmake test.cdb test.tmp
echo $?
)
echo '--- cdbmake handles absurd klen'
echo '+4294967210' | cdbmake test.cdb test.tmp
echo $?
echo '--- cdbget handles empty file'
cdbget foo </dev/null
echo $?
echo '--- cdbdump and cdbmake handle random.cdb'
cdbdump < ../random.cdb | cdbmake test.cdb test.tmp
echo $?
cmp ../random.cdb test.cdb
echo '--- cdbtest handles random.cdb'
cdbtest < ../random.cdb
echo $?
echo '--- cdbstats handles random.cdb'
cdbstats < ../random.cdb
echo $?
echo '--- testzero works'
testzero 5 > test.cdb
echo $?
cdbtest < test.cdb
echo $?
echo '--- testzero can build a database very close to 4GB'
testzero 65507 > /dev/null
echo $?
echo '--- testzero complains if hash table passes 4GB'
testzero 65508 > /dev/null
echo $?
echo '--- testzero complains if records pass 4GB'
testzero 66000 > /dev/null
echo $?
exit 0

28
isdnlog/tools/cdb/scan.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef SCAN_H
#define SCAN_H
extern unsigned int scan_uint(char *,unsigned int *);
extern unsigned int scan_xint(char *,unsigned int *);
extern unsigned int scan_nbbint(char *,unsigned int,unsigned int,unsigned int,unsigned int *);
extern unsigned int scan_ushort(char *,unsigned short *);
extern unsigned int scan_xshort(char *,unsigned short *);
extern unsigned int scan_nbbshort(char *,unsigned int,unsigned int,unsigned int,unsigned short *);
extern unsigned int scan_ulong(char *,unsigned long *);
extern unsigned int scan_xlong(char *,unsigned long *);
extern unsigned int scan_nbblong(char *,unsigned int,unsigned int,unsigned int,unsigned long *);
extern unsigned int scan_plusminus(char *,int *);
extern unsigned int scan_0x(char *,unsigned int *);
extern unsigned int scan_whitenskip(char *,unsigned int);
extern unsigned int scan_nonwhitenskip(char *,unsigned int);
extern unsigned int scan_charsetnskip(char *,char *,unsigned int);
extern unsigned int scan_noncharsetnskip(char *,char *,unsigned int);
extern unsigned int scan_strncmp(char *,char *,unsigned int);
extern unsigned int scan_memcmp(char *,char *,unsigned int);
extern unsigned int scan_long(char *,long *);
extern unsigned int scan_8long(char *,unsigned long *);
#endif

View File

@ -0,0 +1,11 @@
#include "scan.h"
unsigned int scan_ulong(register char *s,register unsigned long *u)
{
register unsigned int pos; register unsigned long result;
register unsigned long c;
pos = 0; result = 0;
while ((c = (unsigned long) (unsigned char) (s[pos] - '0')) < 10)
{ result = result * 10 + c; ++pos; }
*u = result; return pos;
}

15
isdnlog/tools/cdb/seek.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef SEEK_H
#define SEEK_H
typedef unsigned long seek_pos;
extern seek_pos seek_cur(int);
extern int seek_set(int,seek_pos);
extern int seek_end(int);
extern int seek_trunc(int,seek_pos);
#define seek_begin(fd) (seek_set((fd),(seek_pos) 0))
#endif

View File

@ -0,0 +1,7 @@
#include <sys/types.h>
#include "seek.h"
#define CUR 1 /* sigh */
seek_pos seek_cur(int fd)
{ return lseek(fd,(off_t) 0,CUR); }

View File

@ -0,0 +1,7 @@
#include <sys/types.h>
#include "seek.h"
#define SET 0 /* sigh */
int seek_set(int fd,seek_pos pos)
{ if (lseek(fd,(off_t) pos,SET) == -1) return -1; return 0; }

14
isdnlog/tools/cdb/str.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef STR_H
#define STR_H
extern unsigned int str_copy(char *,char *);
extern int str_diff(char *,char *);
extern int str_diffn(char *,char *,unsigned int);
extern unsigned int str_len(char *);
extern unsigned int str_chr(char *,int);
extern unsigned int str_rchr(char *,int);
extern int str_start(char *,char *);
#define str_equal(s,t) (!str_diff((s),(t)))
#endif

View File

@ -0,0 +1,14 @@
#include "str.h"
unsigned int str_len(char *s)
{
register char *t;
t = s;
for (;;) {
if (!*t) return t - s; ++t;
if (!*t) return t - s; ++t;
if (!*t) return t - s; ++t;
if (!*t) return t - s; ++t;
}
}

View File

@ -0,0 +1,78 @@
#ifndef STRERR_H
#define STRERR_H
struct strerr {
struct strerr *who;
char *x;
char *y;
char *z;
} ;
extern struct strerr strerr_sys;
extern void strerr_sysinit(void);
extern char *strerr(struct strerr *);
extern void strerr_warn(char *,char *,char *,char *,char *,char *,struct strerr *);
extern void strerr_die(int,char *,char *,char *,char *,char *,char *,struct strerr *);
#define STRERR(r,se,a) \
{ se.who = 0; se.x = a; se.y = 0; se.z = 0; return r; }
#define STRERR_SYS(r,se,a) \
{ se.who = &strerr_sys; se.x = a; se.y = 0; se.z = 0; return r; }
#define STRERR_SYS3(r,se,a,b,c) \
{ se.who = &strerr_sys; se.x = a; se.y = b; se.z = c; return r; }
#define strerr_warn6(x1,x2,x3,x4,x5,x6,se) \
strerr_warn((x1),(x2),(x3),(x4),(x5),(x6),(se))
#define strerr_warn5(x1,x2,x3,x4,x5,se) \
strerr_warn((x1),(x2),(x3),(x4),(x5),0,(se))
#define strerr_warn4(x1,x2,x3,x4,se) \
strerr_warn((x1),(x2),(x3),(x4),0,0,(se))
#define strerr_warn3(x1,x2,x3,se) \
strerr_warn((x1),(x2),(x3),0,0,0,(se))
#define strerr_warn2(x1,x2,se) \
strerr_warn((x1),(x2),0,0,0,0,(se))
#define strerr_warn1(x1,se) \
strerr_warn((x1),0,0,0,0,0,(se))
#define strerr_die6(e,x1,x2,x3,x4,x5,x6,se) \
strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),(se))
#define strerr_die5(e,x1,x2,x3,x4,x5,se) \
strerr_die((e),(x1),(x2),(x3),(x4),(x5),0,(se))
#define strerr_die4(e,x1,x2,x3,x4,se) \
strerr_die((e),(x1),(x2),(x3),(x4),0,0,(se))
#define strerr_die3(e,x1,x2,x3,se) \
strerr_die((e),(x1),(x2),(x3),0,0,0,(se))
#define strerr_die2(e,x1,x2,se) \
strerr_die((e),(x1),(x2),0,0,0,0,(se))
#define strerr_die1(e,x1,se) \
strerr_die((e),(x1),0,0,0,0,0,(se))
#define strerr_die6sys(e,x1,x2,x3,x4,x5,x6) \
strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),&strerr_sys)
#define strerr_die5sys(e,x1,x2,x3,x4,x5) \
strerr_die((e),(x1),(x2),(x3),(x4),(x5),0,&strerr_sys)
#define strerr_die4sys(e,x1,x2,x3,x4) \
strerr_die((e),(x1),(x2),(x3),(x4),0,0,&strerr_sys)
#define strerr_die3sys(e,x1,x2,x3) \
strerr_die((e),(x1),(x2),(x3),0,0,0,&strerr_sys)
#define strerr_die2sys(e,x1,x2) \
strerr_die((e),(x1),(x2),0,0,0,0,&strerr_sys)
#define strerr_die1sys(e,x1) \
strerr_die((e),(x1),0,0,0,0,0,&strerr_sys)
#define strerr_die6x(e,x1,x2,x3,x4,x5,x6) \
strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),0)
#define strerr_die5x(e,x1,x2,x3,x4,x5) \
strerr_die((e),(x1),(x2),(x3),(x4),(x5),0,0)
#define strerr_die4x(e,x1,x2,x3,x4) \
strerr_die((e),(x1),(x2),(x3),(x4),0,0,0)
#define strerr_die3x(e,x1,x2,x3) \
strerr_die((e),(x1),(x2),(x3),0,0,0,0)
#define strerr_die2x(e,x1,x2) \
strerr_die((e),(x1),(x2),0,0,0,0,0)
#define strerr_die1x(e,x1) \
strerr_die((e),(x1),0,0,0,0,0,0)
#endif

View File

@ -0,0 +1,31 @@
#include "buffer.h"
#include "exit.h"
#include "strerr.h"
void strerr_warn(char *x1,char *x2,char *x3,char *x4,char *x5,char *x6,struct strerr *se)
{
strerr_sysinit();
if (x1) buffer_puts(buffer_2,x1);
if (x2) buffer_puts(buffer_2,x2);
if (x3) buffer_puts(buffer_2,x3);
if (x4) buffer_puts(buffer_2,x4);
if (x5) buffer_puts(buffer_2,x5);
if (x6) buffer_puts(buffer_2,x6);
while(se) {
if (se->x) buffer_puts(buffer_2,se->x);
if (se->y) buffer_puts(buffer_2,se->y);
if (se->z) buffer_puts(buffer_2,se->z);
se = se->who;
}
buffer_puts(buffer_2,"\n");
buffer_flush(buffer_2);
}
void strerr_die(int e,char *x1,char *x2,char *x3,char *x4,char *x5,char *x6,struct strerr *se)
{
strerr_warn(x1,x2,x3,x4,x5,x6,se);
_exit(e);
}

View File

@ -0,0 +1,12 @@
#include "error.h"
#include "strerr.h"
struct strerr strerr_sys;
void strerr_sysinit(void)
{
strerr_sys.who = 0;
strerr_sys.x = error_str(errno);
strerr_sys.y = "";
strerr_sys.z = "";
}

View File

@ -0,0 +1,35 @@
#include "uint32.h"
#include "scan.h"
#include "strerr.h"
#include "cdb_make.h"
#define FATAL "testzero: fatal: "
void die_write(void)
{
strerr_die2sys(111,FATAL,"unable to write: ");
}
static char key[4];
static char data[65536];
struct cdb_make c;
main(int argc,char **argv)
{
int fd;
unsigned long loop;
if (!*argv) _exit(0);
if (!*++argv) _exit(0);
scan_ulong(*argv,&loop);
if (cdb_make_start(&c,1) == -1) die_write();
while (loop) {
uint32_pack(key,--loop);
if (cdb_make_add(&c,key,4,data,sizeof data) == -1) die_write();
}
if (cdb_make_finish(&c) == -1) die_write();
_exit(0);
}

View File

@ -0,0 +1,7 @@
main()
{
#ifdef NeXT
printf("nextstep\n"); exit(0);
#endif
printf("unknown\n"); exit(0);
}

View File

@ -0,0 +1,11 @@
void main()
{
unsigned long u;
u = 1;
u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
if (!u) _exit(0);
_exit(1);
}

View File

@ -0,0 +1,11 @@
#ifndef UINT32_H
#define UINT32_H
typedef unsigned int uint32;
extern void uint32_pack(char *,uint32);
extern void uint32_pack_big(char *,uint32);
extern void uint32_unpack(char *,uint32 *);
extern void uint32_unpack_big(char *,uint32 *);
#endif

View File

@ -0,0 +1,11 @@
#ifndef UINT32_H
#define UINT32_H
typedef unsigned long uint32;
extern void uint32_pack(char *,uint32);
extern void uint32_pack_big(char *,uint32);
extern void uint32_unpack(char *,uint32 *);
extern void uint32_unpack_big(char *,uint32 *);
#endif

View File

@ -0,0 +1,21 @@
#include "uint32.h"
void uint32_pack(char s[4],uint32 u)
{
s[0] = u & 255;
u >>= 8;
s[1] = u & 255;
u >>= 8;
s[2] = u & 255;
s[3] = u >> 8;
}
void uint32_pack_big(char s[4],uint32 u)
{
s[3] = u & 255;
u >>= 8;
s[2] = u & 255;
u >>= 8;
s[1] = u & 255;
s[0] = u >> 8;
}

View File

@ -0,0 +1,31 @@
#include "uint32.h"
void uint32_unpack(char s[4],uint32 *u)
{
uint32 result;
result = (unsigned char) s[3];
result <<= 8;
result += (unsigned char) s[2];
result <<= 8;
result += (unsigned char) s[1];
result <<= 8;
result += (unsigned char) s[0];
*u = result;
}
void uint32_unpack_big(char s[4],uint32 *u)
{
uint32 result;
result = (unsigned char) s[0];
result <<= 8;
result += (unsigned char) s[1];
result <<= 8;
result += (unsigned char) s[2];
result <<= 8;
result += (unsigned char) s[3];
*u = result;
}

View File

@ -0,0 +1,2 @@
#!/bin/sh
# WARNING: This file was auto-generated. Do not edit!

View File

@ -0,0 +1,38 @@
#include <signal.h>
void nope()
{
exit(1);
}
main()
{
unsigned long x[4];
unsigned long y[4];
int i;
int j;
char c;
signal(SIGILL,nope);
x[0] = 0;
x[1] = 0;
x[2] = 0;
x[3] = 0;
asm volatile(".byte 15;.byte 162" : "=a"(x[0]),"=b"(x[1]),"=c"(x[3]),"=d"(x[2]) : "0"(0) );
if (!x[0]) return 0;
asm volatile(".byte 15;.byte 162" : "=a"(y[0]),"=b"(y[1]),"=c"(y[2]),"=d"(y[3]) : "0"(1) );
for (i = 1;i < 4;++i)
for (j = 0;j < 4;++j) {
c = x[i] >> (8 * j);
if (c < 32) c = 32;
if (c > 126) c = 126;
putchar(c);
}
printf("-%08x-%08x\n",y[0],y[3]);
return 0;
}

View File

@ -20,6 +20,7 @@
* Changes:
*
* 1.00 08.10.1999 lt Initial Version
* 1.01 26.07.2000 lt Added cdb support
*/
/* #define DEBUG */
@ -68,7 +69,7 @@ char *Strncat(char *dest, const char *src, int len);
#define min(x,y) (x)<(y)?(x):(y)
#endif
static char version[] = "1.00";
static char version[] = "1.01";
static _DB db; /* our dest.db */
static int init_ok=0;
@ -162,8 +163,9 @@ int initDest(char *path, char **msg)
if ((db = OPEN(path, READ)) == 0) {
if (msg)
snprintf(message, LENGTH,
"Dest V%s: Error: gdbm_open '%s': '%s'",
"Dest V%s: Error: open '%s': '%s'",
version, path, GET_ERR);
return -1;
}
/* read info */
key.dptr = vinfo;
@ -422,13 +424,13 @@ int main(int argc, char *argv[])
TELNUM num;
int i = 1, res;
if (initDest("./dest.gdbm", &msg)) {
if (initDest("./dest" RDBEXT, &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]));
fprintf(stderr, "Usage:\n\t%s number|name ...\n", basename(argv[0]));
exit(EXIT_FAILURE);
}
memset(&num, 0, sizeof(num));

View File

@ -0,0 +1,289 @@
.rn '' }`
''' $RCSfile: CDB_File_Dump.3pm,v $$Revision: 1.1 $$Date: 2000/08/01 20:31:40 $
'''
''' $Log: CDB_File_Dump.3pm,v $
''' Revision 1.1 2000/08/01 20:31:40 akool
''' isdnlog-4.37
''' - removed "09978 Schoenthal Oberpfalz" from "zone-de.dtag.cdb". Entry was
''' totally buggy.
'''
''' - isdnlog/isdnlog/processor.c ... added err msg for failing IIOCGETCPS
'''
''' - isdnlog/tools/cdb ... (NEW DIR) cdb Constant Data Base
''' - isdnlog/Makefile.in ... cdb Constant Data Base
''' - isdnlog/configure{,.in}
''' - isdnlog/policy.h.in
''' - isdnlog/FAQ sic!
''' - isdnlog/NEWS
''' - isdnlog/README
''' - isdnlog/tools/NEWS
''' - isdnlog/tools/dest.c
''' - isdnlog/tools/isdnrate.man
''' - isdnlog/tools/zone/Makefile.in
''' - isdnlog/tools/zone/configure{,.in}
''' - isdnlog/tools/zone/config.h.in
''' - isdnlog/tools/zone/common.h
''' - isdnlog/tools/dest/Makefile.in
''' - isdnlog/tools/dest/configure{,.in}
''' - isdnlog/tools/dest/makedest
''' - isdnlog/tools/dest/CDB_File_Dump.{pm,3pm} ... (NEW) writes cdb dump files
''' - isdnlog/tools/dest/mcdb ... (NEW) convert testdest dumps to cdb dumps
'''
''' - isdnlog/tools/Makefile ... clean:-target fixed
''' - isdnlog/tools/telnum{.c,.h} ... TELNUM.vbn was not always initialized
''' - isdnlog/tools/rate.c ... fixed bug with R:tag and isdnlog not always
''' calculating correct rates (isdnrate worked)
'''
''' s. isdnlog/tools/NEWS on details for using cdb. and
''' isdnlog/README 20.a Datenbanken for a note about databases (in German).
'''
''' As this is the first version with cdb and a major patch there could be
''' still some problems. If you find something let me know. <lt@toetsch.at>
'''
'''
.de Sh
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp
.if t .sp .5v
.if n .sp
..
.de Ip
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.de Vb
.ft CW
.nf
.ne \\$1
..
.de Ve
.ft R
.fi
..
'''
'''
''' Set up \*(-- to give an unbreakable dash;
''' string Tr holds user defined translation string.
''' Bell System Logo is used as a dummy character.
'''
.tr \(*W-|\(bv\*(Tr
.ie n \{\
.ds -- \(*W-
.ds PI pi
.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
.ds L" ""
.ds R" ""
''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of
''' \*(L" and \*(R", except that they are used on ".xx" lines,
''' such as .IP and .SH, which do another additional levels of
''' double-quote interpretation
.ds M" """
.ds S" """
.ds N" """""
.ds T" """""
.ds L' '
.ds R' '
.ds M' '
.ds S' '
.ds N' '
.ds T' '
'br\}
.el\{\
.ds -- \(em\|
.tr \*(Tr
.ds L" ``
.ds R" ''
.ds M" ``
.ds S" ''
.ds N" ``
.ds T" ''
.ds L' `
.ds R' '
.ds M' `
.ds S' '
.ds N' `
.ds T' '
.ds PI \(*p
'br\}
.\" If the F register is turned on, we'll generate
.\" index entries out stderr for the following things:
.\" TH Title
.\" SH Header
.\" Sh Subsection
.\" Ip Item
.\" X<> Xref (embedded
.\" Of course, you have to process the output yourself
.\" in some meaninful fashion.
.if \nF \{
.de IX
.tm Index:\\$1\t\\n%\t"\\$2"
..
.nr % 0
.rr F
.\}
.TH CDB_File_Dump 3pm "perl 5.005, patch 02" "27/Jul/00" "User Contributed Perl Doc"
.UC
.if n .hy 0
.if n .na
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.de CQ \" put $1 in typewriter font
.ft CW
'if n "\c
'if t \\&\\$1\c
'if n \\&\\$1\c
'if n \&"
\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7
'.ft R
..
.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2
. \" AM - accent mark definitions
.bd B 3
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds ? ?
. ds ! !
. ds /
. ds q
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10'
. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#]
.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u'
.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u'
.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#]
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.ds oe o\h'-(\w'o'u*4/10)'e
.ds Oe O\h'-(\w'O'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds v \h'-1'\o'\(aa\(ga'
. ds _ \h'-1'^
. ds . \h'-1'.
. ds 3 3
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
. ds oe oe
. ds Oe OE
.\}
.rm #[ #] #H #V #F C
.SH "NAME"
CDB_File_Dump \- Write cdb dump files
.SH "DESCRIPTION"
This is a AnyDBM_File implementation to write cdb dump files. As cdb can
only be written in one step, this produces (and appends) dump files, which
can be fed into cdbmake to produce the final database.
.SH "SYNOPSIS"
.PP
.Vb 1
\& use AnyDBM_File;
.Ve
.Vb 3
\& BEGIN {
\& @AnyDBM_File::ISA = qw( CDB_File_Dump );
\& }
.Ve
.Vb 5
\& my(%db)
\& tie(%db, 'AnyDBM_File','dump_file', O_RDWR ,0644); # write
\& $db{'key'} = 'value';
\& ...
\& untie(%db);
.Ve
.SH "AUTHOR"
Copyright 1999 by Leopold Toetsch <lt@toetsch.at>
.PP
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.
.PP
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.
.PP
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.
.SH "BUGS"
rereading dumpfiles (on opening an existing cdb) doesn't check
length of keys and values, they are just matched like this:
/(.*)\->(.*)/
.SH "SEE ALSO"
\fIAnyDBM_File\fR\|(3pm) \fITie::Hash\fR\|(3pm) http://cr.yp.to/cdb.html
.rn }` ''
.IX Title "CDB_File_Dump 3pm"
.IX Name "CDB_File_Dump - Write cdb dump files"
.IX Header "NAME"
.IX Header "DESCRIPTION"
.IX Header "SYNOPSIS"
.IX Header "AUTHOR"
.IX Header "BUGS"
.IX Header "SEE ALSO"

View File

@ -0,0 +1,99 @@
package CDB_File_Dump;
=head1 NAME
CDB_File_Dump - Write cdb dump files
=head1 DESCRIPTION
This is a AnyDBM_File implementation to write cdb dump files. As cdb can
only be written in one step, this produces (and appends) dump files, which
can be fed into cdbmake to produce the final database.
=head1 SYNOPSIS
use AnyDBM_File;
BEGIN {
@AnyDBM_File::ISA = qw( CDB_File_Dump );
}
my(%db)
tie(%db, 'AnyDBM_File','dump_file', O_RDWR ,0644); # write
$db{'key'} = 'value';
...
untie(%db);
=head1 AUTHOR
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.
=head1 BUGS
rereading dumpfiles (on opening an existing cdb) doesn't check
length of keys and values, they are just matched like this:
/(.*)->(.*)/
=head1 SEE ALSO
AnyDBM_File(3pm) Tie::Hash(3pm) http://cr.yp.to/cdb.html
=cut
use strict;
use vars qw(@ISA);
require Tie::Hash;
BEGIN {
@ISA=qw(Tie::StdHash);
}
sub TIEHASH {
my $proto = shift;
my $class = ref($proto) || $proto;
my $file = shift;
my $self = {};
$self->{file} = $file;
if (-e "$file") { # read old
open (FH, $file);
while (<FH>) {
chomp;
if(/\+\d+,\d+:(.*)->(.*)/) {
$self->{$1}=$2;
}
}
close FH;
}
open(FH, ">>$file");
$self->{'fh'} = \*FH;
bless $self, $class;
$self;
}
sub STORE {
my ($self, $key, $value) = @_;
$self->{$key} = $value;
my $fh = $self->{fh};
print $fh "+",length($key),",",length($value),":",$key,"->",$value,"\n";
}
# this should be inherited but seems not to be
sub FETCH {
$_[0]->{$_[1]};
}
1;

View File

@ -11,6 +11,7 @@ INCLUDES =
LDFLAGS = @DBMLIB@
DBEXT = @DBEXT@
RDBEXT = @RDBEXT@
CDBEXTRALIBS = @CDBEXTRALIBS@
PROGRAM = dest
MODULES = $(PROGRAM).o
MANPAGE = $(PROGRAM).8
@ -52,8 +53,8 @@ Makefile: Makefile.in config.status
config.status: configure
./config.status --recheck
dest: ../dest.c $(HEADERS) Makefile
$(CC) -DSTANDALONE -DDESTTEST $(DEFS) $(CFLAGS) ../dest.c $(LDFLAGS) -o $@
dest: ../dest.c $(HEADERS) Makefile $(CDBEXTRALIBS)
$(CC) -DSTANDALONE -DDESTTEST $(DEFS) $(CFLAGS) ../dest.c $(LDFLAGS) -o $@ $(CDBEXTRALIBS)
#install-man: $(PROGRAM).man
# mkdir -p $(DESTDIR)$(MAN8DIR)
@ -69,7 +70,7 @@ clean:
rm -f *.o *~ $(PROGRAM)
dataclean:
rm -f *.{gdbm,db}
rm -f *.{gdbm,db,cdb}
distclean: clean
rm -f config.status config.cache config.log *.man Makefile
@ -81,6 +82,11 @@ DEST_LANG= -en
endif
data:
ifeq ($(DBEXT),.cdb)
@if [ -e dest.cdb.dump ] ; then \
rm dest.cdb.dump ; \
fi
endif
@if [ ! -e dest$(DBEXT) ] ; then \
./makedest -v $(DEST_LANG) ; \
./makedest -v -gcities.dat -a $(DEST_LANG) ; \
@ -97,8 +103,21 @@ data:
./makedest -v -a ch || true; \
fi ; \
fi
ifeq ($(DBEXT),.cdb)
@if [ ! -e dest.cdb ] ; then \
echo "" >> dest.cdb.dump ; \
echo Running cdbmake ; \
../cdb/cdbmake < dest.cdb.dump dest.cdb dest.temp ; \
rm dest.cdb.dump ;\
fi
endif
alldata:
ifeq ($(DBEXT),.cdb)
if [ -e dest.cdb.dump ] ; then \
rm dest.cdb.dump ; \
fi
endif
./makedest -v $(DEST_LANG)
./makedest -v -gcities.dat -a $(DEST_LANG)
@cd ../zone ; all=`ls -d ??` ; cd ../dest ; \
@ -107,3 +126,11 @@ alldata:
./makedest -v -a $$cc ; \
fi ; \
done
ifeq ($(DBEXT),.cdb)
@if [ ! -e dest.cdb ] ; then \
echo "" >> dest.cdb.dump ; \
echo Running cdbmake ; \
../cdb/cdbmake < dest.cdb.dump dest.cdb dest.temp ; \
rm dest.cdb.dump ;\
fi
endif

View File

@ -811,8 +811,18 @@ if test "$BZIP2" = "bzip2_not_found_or_installed" ; then
{ echo "configure: error: bzip2 not found please install it." 1>&2; exit 1; }
fi
if test -e ../cdb/i4l_cdb.c ; then
cat >> confdefs.h <<\EOF
#define USE_CDB 1
EOF
CDBEXTRALIBS="../cdb/i4l_cdb.a ../cdb/cdb.a ../cdb/buffer.a ../cdb/unix.a ../cdb/byte.a ../cdb/alloc.a"
DBEXT=".cdb"
RDBEXT=".cdb"
echo "$ac_t""Using 'cdb' as database" 1>&6
else
echo $ac_n "checking for gdbm_open in -lgdbm""... $ac_c" 1>&6
echo "configure:816: checking for gdbm_open in -lgdbm" >&5
echo "configure:826: checking for gdbm_open in -lgdbm" >&5
ac_lib_var=`echo gdbm'_'gdbm_open | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -820,7 +830,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lgdbm $LIBS"
cat > conftest.$ac_ext <<EOF
#line 824 "configure"
#line 834 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -831,7 +841,7 @@ int main() {
gdbm_open()
; return 0; }
EOF
if { (eval echo configure:835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -853,7 +863,7 @@ EOF
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6
echo "configure:857: checking for dbm_open in -ldbm" >&5
echo "configure:867: checking for dbm_open in -ldbm" >&5
ac_lib_var=`echo dbm'_'dbm_open | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -861,7 +871,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldbm $LIBS"
cat > conftest.$ac_ext <<EOF
#line 865 "configure"
#line 875 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -872,7 +882,7 @@ int main() {
dbm_open()
; return 0; }
EOF
if { (eval echo configure:876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -894,7 +904,7 @@ EOF
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dbm_open in -ldb""... $ac_c" 1>&6
echo "configure:898: checking for dbm_open in -ldb" >&5
echo "configure:908: checking for dbm_open in -ldb" >&5
ac_lib_var=`echo db'_'dbm_open | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -902,7 +912,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldb $LIBS"
cat > conftest.$ac_ext <<EOF
#line 906 "configure"
#line 916 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -913,7 +923,7 @@ int main() {
dbm_open()
; return 0; }
EOF
if { (eval echo configure:917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -942,8 +952,9 @@ fi
fi
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:947: checking how to run the C preprocessor" >&5
echo "configure:958: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -958,13 +969,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 962 "configure"
#line 973 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:979: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@ -975,13 +986,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 979 "configure"
#line 990 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:996: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@ -1004,12 +1015,12 @@ fi
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:1008: checking for ANSI C header files" >&5
echo "configure:1019: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1013 "configure"
#line 1024 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@ -1017,7 +1028,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1021: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1032: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1034,7 +1045,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 1038 "configure"
#line 1049 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@ -1052,7 +1063,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 1056 "configure"
#line 1067 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@ -1073,7 +1084,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 1077 "configure"
#line 1088 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@ -1084,7 +1095,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
if { (eval echo configure:1088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
:
else
@ -1111,17 +1122,17 @@ for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1115: checking for $ac_hdr" >&5
echo "configure:1126: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1120 "configure"
#line 1131 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1125: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1136: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1149,12 +1160,12 @@ done
echo $ac_n "checking for size_t""... $ac_c" 1>&6
echo "configure:1153: checking for size_t" >&5
echo "configure:1164: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1158 "configure"
#line 1169 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1185,12 +1196,12 @@ fi
for ac_func in strdup strtoul
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1189: checking for $ac_func" >&5
echo "configure:1200: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1194 "configure"
#line 1205 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1213,7 +1224,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -1245,6 +1256,7 @@ done
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
@ -1396,6 +1408,7 @@ s%@CPP@%$CPP%g
s%@DBMLIB@%$DBMLIB%g
s%@DBEXT@%$DBEXT%g
s%@RDBEXT@%$RDBEXT%g
s%@CDBEXTRALIBS@%$CDBEXTRALIBS%g
s%@INSTALL@%$INSTALL%g
s%@CONFIG_SBINDIR@%$CONFIG_SBINDIR%g
s%@CONFIG_MANDIR@%$CONFIG_MANDIR%g

View File

@ -13,6 +13,13 @@ if test "$BZIP2" = "bzip2_not_found_or_installed" ; then
AC_MSG_ERROR(bzip2 not found please install it.)
fi
if test -e ../cdb/i4l_cdb.c ; then
AC_DEFINE(USE_CDB)
CDBEXTRALIBS="../cdb/i4l_cdb.a ../cdb/cdb.a ../cdb/buffer.a ../cdb/unix.a ../cdb/byte.a ../cdb/alloc.a"
DBEXT=".cdb"
RDBEXT=".cdb"
AC_MSG_RESULT(Using 'cdb' as database)
else
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),
@ -21,6 +28,7 @@ AC_CHECK_LIB(gdbm, gdbm_open, DBMLIB=-lgdbm;DBEXT=".gdbm";RDBEXT=".gdbm"; AC_DEF
AC_MSG_ERROR('No db found'))))
dnl Checks for header files.
fi
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
@ -33,6 +41,7 @@ AC_CHECK_FUNCS(strdup strtoul)
AC_SUBST(DBMLIB)
AC_SUBST(DBEXT)
AC_SUBST(RDBEXT)
AC_SUBST(CDBEXTRALIBS)
AC_SUBST(CC)
AC_SUBST(INSTALL)
AC_SUBST(CONFIG_SBINDIR)

Some files were not shown because too many files have changed in this diff Show More