isdnlog Version 3.25
- README: isdnconf: new features explained - rate-de.dat: many new rates from the I4L-Tarifdatenbank-Crew - added the ability to directly enter a country-name into "rate-xx.dat"
This commit is contained in:
parent
dff262e0d3
commit
4b136222a3
|
@ -19,6 +19,14 @@
|
|||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
##
|
||||
## $Log$
|
||||
## Revision 1.77 1999/05/04 19:32:02 akool
|
||||
## isdnlog Version 3.24
|
||||
##
|
||||
## - fully removed "sondernummern.c"
|
||||
## - removed "gcc -Wall" warnings in ASN.1 Parser
|
||||
## - many new entries for "rate-de.dat"
|
||||
## - better "isdnconf" utility
|
||||
##
|
||||
## Revision 1.76 1999/04/30 19:07:28 akool
|
||||
## isdnlog Version 3.23
|
||||
##
|
||||
|
@ -607,7 +615,7 @@ SERVICEFILE = /etc/services
|
|||
# DON'T EDIT BELOW THIS LINE
|
||||
######################################################################
|
||||
|
||||
VERSION = 3.24
|
||||
VERSION = 3.25
|
||||
|
||||
MANPAGES = isdnlog/callerid.conf.5 isdnlog/isdn.conf.5 \
|
||||
isdnlog/isdnformat.5 isdnlog/isdnlog.5 isdnlog/isdnlog.8 \
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
ISDNLOG - Version 3.24 - 03-May-99 14:12
|
||||
ISDNLOG - Version 3.25 - 06-May-99 21:59
|
||||
|
||||
|
||||
isdnlog ist ein Utility zur Auswertung des D-Kanals eines
|
||||
ISDN-BRI Anschlusses.
|
||||
|
||||
isdnlog-3.24 wurde ausgiebig mit Linux-2.0.36 getestet.
|
||||
isdnlog-3.25 wurde ausgiebig mit Linux-2.0.36 getestet.
|
||||
|
||||
|
||||
Fuer alle, die es nun ueberhaupt nicht mehr abwarten koennen, hier das
|
||||
|
@ -3149,10 +3149,6 @@ Unter einen Eintrag ist eine eigene MSN ([MSN]) oder eine Telefonnummer
|
|||
Dieses Programm hat seine Staerken als ein Suchprogramm in einem persoenlichem
|
||||
Telefonbuch.
|
||||
|
||||
Hier nun die Optionen des Programmes:
|
||||
|
||||
Befehle:
|
||||
|
||||
ACHTUNG:
|
||||
|
||||
Dieses Programm besitzt zwar die Faehigkeit, die Nummerndateien zu veraendern.
|
||||
|
@ -3162,6 +3158,74 @@ Es wird aber dringend davon abgeraten die Schalter -A und -D zu verwenden!!
|
|||
Hierbei wird die gesamte Struktur der Datei zerstoert (include), so wie alle
|
||||
Kommentare werden geloescht.
|
||||
|
||||
Das Utility "isdnconf" kann weiterhin zur gezielten Befragung der
|
||||
Tarifdatenbank eingesetzt werden. Dazu gilt folgende Syntax:
|
||||
|
||||
isdnconf -c <Ziel>[,Dauer]
|
||||
|
||||
Wird keine Dauer (L„nge der Verbindung) angegeben, nimmt isdnconf
|
||||
153 Sekunden an.
|
||||
|
||||
"isdnconf" blickt immer von "hier", d.h. dem Ort, in dem man sich
|
||||
aktuell befindet (oder genauer, dem Ort, der durch die Eintraege
|
||||
COUNTRYCODE sowie AREACODE in der Config-Datei angegeben wurden).
|
||||
|
||||
|
||||
Als Ziel darf entweder ein ".", eine Telefonnummer oder eine
|
||||
Landesbezeichnung angegeben werden.
|
||||
|
||||
Bei einem "." gibt isdnconf eine 7 Tage/24-Stunden LCR-Tabelle aus, die man
|
||||
sich z.b. neben das Telefon legen kann:
|
||||
|
||||
$ isdnconf -c .
|
||||
Least-Cost-Routing-Table [Verbindungsdauer:153 Sekunden]:
|
||||
|
||||
Werktag:
|
||||
RegioCall:
|
||||
07:00 .. 07:59 01055:Esprit (DEM 0.050/60.0s = DEM 0.050/Min (Esprit, Region 50, Workday (Thursday), Late night))
|
||||
08:00 .. 08:59 01070:Arcor CbC (DEM 0.075/60.0s = DEM 0.075/Min (Arcor CbC, Regio Plus, Workday (Thursday)))
|
||||
09:00 .. 17:59 01051:01051 (DEM 0.090/60.0s = DEM 0.090/Min (01051, Ferngespräche, Workday (Thursday)))
|
||||
18:00 .. 18:59 01070:Arcor CbC (DEM 0.075/60.0s = DEM 0.075/Min (Arcor CbC, Regio Plus, Workday (Thursday)))
|
||||
19:00 .. 19:59 01013:Tele 2 (DEM 0.070/60.0s = DEM 0.070/Min (Tele 2, National, Workday (Thursday)))
|
||||
20:00 .. 20:59 01078:3U (DEM 0.001/1.0s = DEM 0.059/Min (3U, Fern, Workday (Thursday)))
|
||||
21:00 .. 21:59 01070:Arcor CbC (DEM 0.040/60.0s = DEM 0.040/Min (Arcor CbC, Regio Plus, Workday (Thursday)))
|
||||
22:00 .. 06:59 01019:Mobilcom CbC (DEM 0.040/60.0s = DEM 0.040/Min (Mobilcom CbC, Ferngespräche bundesweit, Workday (Thursday), Nacht))
|
||||
...
|
||||
|
||||
D.h. es wird ausgegeben, ueber welchen Provider um welche Uhrzeit eine
|
||||
Verbindung am guestigsten ist.
|
||||
|
||||
Daneben kann eine Telefonnummer angegeben werden, woraufhin isdnconf
|
||||
die Tarife der einzelnen Provider fuer eine Verbindung "jetzt gerade"
|
||||
ausgibt:
|
||||
|
||||
$ isdnconf -c +4989
|
||||
Ein 153 Sekunden langes Gespraech nach Muenchen (Zone 4) kostet am Thu May 6 21:52:24 1999
|
||||
01055 DEM 0.150 (DEM 0.050/60.0s = DEM 0.050/Min (Esprit, Fern, Workday (Thursday), Late night))
|
||||
01078 DEM 0.150 (DEM 0.001/1.0s = DEM 0.059/Min (3U, Fern, Workday (Thursday)))
|
||||
01030 DEM 0.153 (DEM 0.001/1.0s = DEM 0.060/Min (TelDaFax, Deutschland, Workday (Thursday)))
|
||||
|
||||
$ isdnconf -c +45
|
||||
Ein 153 Sekunden langes Gespraech nach Daenemark (+45) kostet am Thu May 6 21:54:21 1999
|
||||
01078 DEM 0.660 (DEM 0.004/1.0s = DEM 0.259/Min (3U, Daenemark,Finnland,Frankreich,Schweiz))
|
||||
01013 DEM 1.170 (DEM 0.390/60.0s = DEM 0.390/Min (Tele 2, Euro 1 / USA, Kanada))
|
||||
01019 DEM 1.470 (DEM 0.490/60.0s = DEM 0.490/Min (Mobilcom CbC, Gruppe A))
|
||||
01033 DEM 1.920 (DEM 0.120/10.0s = DEM 0.720/Min (DTAG, Euro 1))
|
||||
|
||||
Last but not least kann anstelle einer Telefonnummer eine Landesbezeichnung
|
||||
angegeben werden:
|
||||
|
||||
$ isdnconf -c Italien
|
||||
Ein 153 Sekunden langes Gespraech nach Italien (+39) kostet am Thu May 6 21:56:17 1999
|
||||
01078 DEM 0.915 (DEM 0.006/1.0s = DEM 0.359/Min (3U, Zone 110))
|
||||
01013 DEM 1.170 (DEM 0.390/60.0s = DEM 0.390/Min (Tele 2, Euro 1 / USA, Kanada))
|
||||
01019 DEM 1.470 (DEM 0.490/60.0s = DEM 0.490/Min (Mobilcom CbC, Gruppe A))
|
||||
|
||||
|
||||
Hier nun die Optionen des Programmes:
|
||||
|
||||
Befehle:
|
||||
|
||||
-A "add" Es wird ein neuer Eintrag hinzugefuegt. Dieser wird ueber
|
||||
Standardinput eingelesen. Es werden folgende Angaben
|
||||
abgefragt:
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
00267 Botsuana
|
||||
00225 Cote d'Ivoire
|
||||
0082 Südkorea
|
||||
00850 Nordkorea
|
||||
0085 Nordkorea
|
||||
006723 Norfolk-Inseln
|
||||
0095 Myanmar
|
||||
00886 Taiwan
|
||||
|
@ -63,3 +63,10 @@
|
|||
00808 Wake Island
|
||||
00649 Pitcairn Islands
|
||||
00649 Pitcairn-Inseln
|
||||
003120 Amsterdam
|
||||
00322 Brüssel
|
||||
0044171 London
|
||||
003902 Mailand
|
||||
00331 Paris
|
||||
00411 Zürich
|
||||
00496102 Frankfurt
|
||||
|
|
|
@ -20,6 +20,14 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.24 1999/05/04 19:32:23 akool
|
||||
* isdnlog Version 3.24
|
||||
*
|
||||
* - fully removed "sondernummern.c"
|
||||
* - removed "gcc -Wall" warnings in ASN.1 Parser
|
||||
* - many new entries for "rate-de.dat"
|
||||
* - better "isdnconf" utility
|
||||
*
|
||||
* Revision 1.23 1999/04/30 19:07:46 akool
|
||||
* isdnlog Version 3.23
|
||||
*
|
||||
|
@ -993,11 +1001,12 @@ int main(int argc, char *argv[], char *envp[])
|
|||
if (areacode[0] != '\0')
|
||||
{
|
||||
char *ptr;
|
||||
int len, i, zone = UNKNOWN, zone2, duration = TESTDURATION;
|
||||
int len, i, zone = UNKNOWN, zone2 = UNKNOWN, duration = TESTDURATION;
|
||||
|
||||
|
||||
initHoliday(holifile, NULL);
|
||||
initRate("/etc/isdn/rate.conf", "/usr/lib/isdn/rate-de.dat", NULL);
|
||||
/* initRate(NULL, "/usr/lib/isdn/rate-de.dat", NULL); */
|
||||
currency = strdup("DEM");
|
||||
|
||||
if (1 /* FIXME: (*areacode == '.') || (ptr = get_areacode(areacode,&len,quiet?C_NO_ERROR|C_NO_WARN:0)) != NULL */ )
|
||||
|
@ -1023,6 +1032,11 @@ int main(int argc, char *argv[], char *envp[])
|
|||
} /* else */
|
||||
}
|
||||
else {
|
||||
if (isalpha(*areacode)) {
|
||||
if (abroad(areacode, country))
|
||||
strcpy(areacode, country);
|
||||
} /* if */
|
||||
|
||||
zone = area_diff(NULL, areacode);
|
||||
|
||||
switch (zone) {
|
||||
|
@ -1042,18 +1056,30 @@ int main(int argc, char *argv[], char *envp[])
|
|||
|
||||
if (zone != UNKNOWN)
|
||||
zone2 = zone;
|
||||
#if 0
|
||||
else
|
||||
zone2 = getZone(DTAG, areacode);
|
||||
#endif
|
||||
|
||||
if (zone2 == UNKNOWN) {
|
||||
abroad(areacode, country);
|
||||
if (*country)
|
||||
print_msg(PRT_NORMAL, "Ein %d Sekunden langes Gespraech nach %s (%s) kostet am %s", duration, country, areacode, ctime(&Rate.start));
|
||||
if (abroad(areacode, country))
|
||||
print_msg(PRT_NORMAL, "Ein %d Sekunden langes Gespraech nach %s (%s) kostet am %s",
|
||||
duration, country, areacode, ctime(&Rate.start));
|
||||
else
|
||||
print_msg(PRT_NORMAL, "Ein %d Sekunden langes Gespraech in Zone Welt (%s) kostet am %s", duration, areacode, ctime(&Rate.start));
|
||||
print_msg(PRT_NORMAL, "Ein %d Sekunden langes Gespraech in Zone Welt (%s) kostet am %s",
|
||||
duration, areacode, ctime(&Rate.start));
|
||||
}
|
||||
else
|
||||
print_msg(PRT_NORMAL, "Ein %d Sekunden langes Gespraech in Zone %d kostet am %s", duration, zone2, ctime(&Rate.start));
|
||||
else {
|
||||
auto int ll;
|
||||
auto char *p;
|
||||
|
||||
if ((p = get_areacode(areacode, &ll, C_NO_WARN | C_NO_EXPAND | C_NO_ERROR)) != 0)
|
||||
print_msg(PRT_NORMAL, "Ein %d Sekunden langes Gespraech nach %s (Zone %d) kostet am %s",
|
||||
duration, p, zone2, ctime(&Rate.start));
|
||||
else
|
||||
print_msg(PRT_NORMAL, "Ein %d Sekunden langes Gespraech in Zone %d kostet am %s",
|
||||
duration, zone2, ctime(&Rate.start));
|
||||
} /* else */
|
||||
|
||||
for (Rate.prefix = 0; Rate.prefix < MAXPROVIDER; Rate.prefix++) {
|
||||
if (zone != UNKNOWN)
|
||||
|
|
|
@ -294,7 +294,7 @@ A:+595 # Paraguay
|
|||
A:+598 # Uruguay
|
||||
A:+62 # Indonesien
|
||||
A:+675 # Papua-Neuguinea
|
||||
A:+850 # Nordkorea
|
||||
A:+85 # Nordkorea
|
||||
A:+91 # Indien
|
||||
A:+94 # Sri Lanka
|
||||
|
||||
|
@ -708,7 +708,7 @@ A:+595 # Paraguay
|
|||
A:+598 # Uruguay
|
||||
A:+62 # Indonesien
|
||||
A:+675 # Papua-Neuguinea
|
||||
A:+850 # Nordkorea
|
||||
A:+85 # Nordkorea
|
||||
A:+91 # Indien
|
||||
A:+94 # Sri Lanka
|
||||
|
||||
|
@ -1122,7 +1122,7 @@ A:+595 # Paraguay
|
|||
A:+598 # Uruguay
|
||||
A:+62 # Indonesien
|
||||
A:+675 # Papua-Neuguinea
|
||||
A:+850 # Nordkorea
|
||||
A:+85 # Nordkorea
|
||||
A:+91 # Indien
|
||||
A:+94 # Sri Lanka
|
||||
|
||||
|
@ -1536,7 +1536,7 @@ A:+595 # Paraguay
|
|||
A:+598 # Uruguay
|
||||
A:+62 # Indonesien
|
||||
A:+675 # Papua-Neuguinea
|
||||
A:+850 # Nordkorea
|
||||
A:+85 # Nordkorea
|
||||
A:+91 # Indien
|
||||
A:+94 # Sri Lanka
|
||||
|
||||
|
@ -1904,7 +1904,7 @@ A:+679 # Fidschi
|
|||
A:+683 # Niue
|
||||
A:+686 # Kiribati
|
||||
A:+689 # Französisch-Polynesien
|
||||
A:+850 # Nordkorea
|
||||
A:+85 # Nordkorea
|
||||
A:+886 # Taiwan
|
||||
A:+91 # Indien
|
||||
A:+94 # Sri Lanka
|
||||
|
@ -2225,7 +2225,7 @@ A:+688 # Tuvalu
|
|||
A:+692 # Marshall Islands
|
||||
A:+808 # Wake Island
|
||||
A:+84 # Vietnam
|
||||
A:+850 # Nordkorea
|
||||
A:+85 # Nordkorea
|
||||
A:+855 # Cambodia
|
||||
A:+880 # Bangladesh
|
||||
A:+93 # Afghanistan
|
||||
|
@ -2549,7 +2549,7 @@ A:+595 # Paraguay
|
|||
A:+598 # Uruguay
|
||||
A:+62 # Indonesien
|
||||
A:+675 # Papua-Neuguinea
|
||||
A:+850 # Nordkorea
|
||||
A:+85 # Nordkorea
|
||||
A:+91 # Indien
|
||||
A:+94 # Sri Lanka
|
||||
Z:15 Ausland Zone 12
|
||||
|
@ -2859,7 +2859,7 @@ A:+595 # Paraguay
|
|||
A:+598 # Uruguay
|
||||
A:+62 # Indonesien
|
||||
A:+675 # Papua-Neuguinea
|
||||
A:+850 # Nordkorea
|
||||
A:+85 # Nordkorea
|
||||
A:+91 # Indien
|
||||
A:+94 # Sri Lanka
|
||||
Z:15 Ausland Zone 12
|
||||
|
@ -3337,6 +3337,14 @@ Z:6 Euro City
|
|||
T:1-5/8-18=3.76(60)/4.79/1 Tag
|
||||
T:1-5/18-8=3.46(60)/5.20/1 Nacht
|
||||
T:E,H/*=3.46(60)/5.20/1 Weekend
|
||||
A:+3120 # Amsterdam
|
||||
A:+322 # Brüssel
|
||||
A:+331 # Paris
|
||||
A:+352 # Luxemburg
|
||||
A:+3902 # Mailand
|
||||
A:+411 # Zürich
|
||||
A:+44171 # London
|
||||
A:+496102 # Frankfurt
|
||||
Z:7 Welt 1
|
||||
T:*/*=6.66(60)/2.70/1 rund um die Uhr
|
||||
A:+1 # Vereinigte Staaten (USA), Kanada
|
||||
|
@ -3455,7 +3463,7 @@ A:+687 # Neukaledonien
|
|||
A:+689 # Französisch-Polynesien
|
||||
A:+692 # Marshallinseln
|
||||
A:+74 # Tadschikistan
|
||||
A:+850 # Nordkorea
|
||||
A:+85 # Nordkorea
|
||||
A:+853 # Macau
|
||||
A:+856 # Laos
|
||||
A:+86 # China
|
||||
|
|
1441
isdnlog/rate-de.dat
1441
isdnlog/rate-de.dat
File diff suppressed because it is too large
Load Diff
|
@ -19,6 +19,12 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.10 1999/04/29 19:03:37 akool
|
||||
* isdnlog Version 3.22
|
||||
*
|
||||
* - T-Online corrected
|
||||
* - more online rates for rate-at.dat (Thanks to Leopold Toetsch <lt@toetsch.at>)
|
||||
*
|
||||
* Revision 1.9 1999/04/26 22:12:14 akool
|
||||
* isdnlog Version 3.21
|
||||
*
|
||||
|
@ -415,6 +421,7 @@ int isDay(struct tm *tm, bitfield mask, char **name)
|
|||
}
|
||||
|
||||
if (mask & (1<<EVERYDAY)) {
|
||||
if (name) *(*name=buffer)='\0';
|
||||
return day;
|
||||
}
|
||||
|
||||
|
|
|
@ -232,15 +232,6 @@ void print_area(char *area)
|
|||
} else if (strcmp(a,"19440")==0) {
|
||||
Area[nArea].code=strdup("+43*19440");
|
||||
Area[nArea].name=strdup("A-Online");
|
||||
} else if (strcmp(a,"07189")==0) {
|
||||
Area[nArea].code=strdup("+437189");
|
||||
Area[nArea].name=strdup("Online-Zone");
|
||||
} else if (strcmp(a,"19430")==0) {
|
||||
Area[nArea].code=strdup("+43*19430");
|
||||
Area[nArea].name=strdup("Magnet");
|
||||
} else if (strcmp(a,"19440")==0) {
|
||||
Area[nArea].code=strdup("+43*19440");
|
||||
Area[nArea].name=strdup("A-Online");
|
||||
} else {
|
||||
Area[nArea].code=strdup(findArea(a));
|
||||
Area[nArea].name=strdup(a);
|
||||
|
@ -961,7 +952,7 @@ void rate_1066(void) {
|
|||
{ "Mobilfunk", "0663,0664,0676,0699" },
|
||||
{ "Euro 1", "Deutschland, Frankreich, Großbritannien, Nordirland, Italien, Liechtenstein, Schweiz, Slowakei, Slowenien, Tschechien, Ungarn" },
|
||||
{ "Euro 2", "Andorra, Belarus, Belgien, Bosnien-Herzegowina, Bulgarien, Dänemark, Estland, Finnland, Griechenland, Irland, Jugoslawien, Kroatien, Luxemburg, Monaco, Niederlande, Norwegen, Polen, Portugal, Rumänien, San Marino, Schweden, Spanien, Tunesien, Türkei, Ukraine, Vatikanstadt, Zypern" },
|
||||
{ "Euro City", "" }, /* Amsterdam, Brüssel, Frankfurt, London, Luxemburg, Mailand, Paris, Zürich */
|
||||
{ "Euro City", "Amsterdam, Brüssel, Frankfurt, London, Luxemburg, Mailand, Paris, Zürich" },
|
||||
{ "Welt 1", "Hawaii, Amerikanische Jungferninseln, Puerto Rico, Vereinigte Staaten (USA), Kanada" },
|
||||
{ "Welt 2", "Albanien, Antarktis, Armenien, Aserbaidschan, Australien, Bahamas, Chile, Weihnachtsinseln, Kokosinseln, Dominikanische Republik, Georgien, Gibraltar, Guadeloupe, Französisch-Guayana, Hongkong, Island, Israel, Japan, Lettland, Libyen, Litauen, Mazedonien, Malaysia, Malta, Marokko, Martinique, Mayotte, Moldau, Neuseeland, Niederländische Antillen, Philippinen, Russische Föderation, Reunion, St. Pierre und Miquelon, Singapur, Südafrika, Südkorea, Saipan" },
|
||||
{ "Welt 3", "Ägypten, Angola, Argentinien, Aruba, Ascension, Bahrain, Barbados, Belize, Benin, Bermuda, Bhutan, Bolivien, Botsuana, Brasilien, Brunei, Burkina Faso, Burundi, Caymaninseln, China, Costa Rica, Dschibuti, Dominica, Ecuador, El Salvador, Färöer-Inseln, Falklandinseln, Fidschi, Französisch-Polynesien, Gabun, Gambia, Ghana, Grenada, Grönland, Guatemala, Haiti, Honduras, Indien, Indonesien, Iran, Jamaika, Jordanien, Katar, Kenia, Kirgisistan, Kolumbien, Nordkorea, Kongo, Kuba, Kuwait, Laos, Lesotho, Libanon, Liberia, Macau, Malawi, Malediven, Marshallinseln, Mauretanien, Mauritius, Mexiko, Montserrat, Nepal, Neukaledonien, Nicaragua, Nigeria, Norfolk-Inseln, Panama, Paraguay, Peru, Ruanda, Sambia, Saudi-Arabien, Salomonen, Simbabwe, Somalia, St. Helena, Saint Kitts und Nevis, St. Lucia, Saint Vincent und die Grenadinen, Sudan, Syrien, Tadschikistan, Tansania, Taiwan, Thailand, Trinidad und Tobago, Turkmenistan, Uruguay, Usbekistan, Vanuatu, Venezuela, Vereinigte Arabische Emirate" },
|
||||
|
@ -982,7 +973,6 @@ void rate_1066(void) {
|
|||
|
||||
printf ("\n");
|
||||
rprintf ("MIT 1066", "P:66");
|
||||
rprintf ("Euro City nicht implementiert", "C:Fixme:");
|
||||
for (z=0; z<COUNT(Zone); z++) {
|
||||
rprintf (Zone[z][0], "Z:%d", z+1);
|
||||
if (Tarif[z][0]==Tarif[z][1]) {
|
||||
|
|
|
@ -19,6 +19,14 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.13 1999/05/04 19:33:41 akool
|
||||
* isdnlog Version 3.24
|
||||
*
|
||||
* - fully removed "sondernummern.c"
|
||||
* - removed "gcc -Wall" warnings in ASN.1 Parser
|
||||
* - many new entries for "rate-de.dat"
|
||||
* - better "isdnconf" utility
|
||||
*
|
||||
* Revision 1.12 1999/04/30 19:08:08 akool
|
||||
* isdnlog Version 3.23
|
||||
*
|
||||
|
@ -185,10 +193,17 @@ extern const char *basename (const char *name);
|
|||
|
||||
#define LENGTH 250 /* max length of lines in data file */
|
||||
#ifdef STANDALONE
|
||||
#define TESTDURATION 153
|
||||
#define MAXPROVIDER 1000
|
||||
#define UNKNOWN -1
|
||||
#endif
|
||||
|
||||
#define WMAX 64
|
||||
#define P 1
|
||||
#define Q 1
|
||||
#define R 1
|
||||
#define DISTANCE 2
|
||||
|
||||
typedef struct _STACK {
|
||||
int data;
|
||||
struct _STACK *next;
|
||||
|
@ -196,7 +211,7 @@ typedef struct _STACK {
|
|||
|
||||
typedef struct {
|
||||
double Duration;
|
||||
int Delay;
|
||||
double Delay;
|
||||
double Price;
|
||||
} UNIT;
|
||||
|
||||
|
@ -230,9 +245,17 @@ typedef struct {
|
|||
AREA *Area;
|
||||
} PROVIDER;
|
||||
|
||||
typedef struct {
|
||||
char *prefix;
|
||||
char *name;
|
||||
char *match;
|
||||
} COUNTRY;
|
||||
|
||||
static PROVIDER *Provider=NULL;
|
||||
static COUNTRY *Country = (COUNTRY *)NULL;
|
||||
static int nProvider=0;
|
||||
static int line=0;
|
||||
static int nCountry = 0;
|
||||
|
||||
static void warning (char *file, char *fmt, ...)
|
||||
{
|
||||
|
@ -249,6 +272,172 @@ static void warning (char *file, char *fmt, ...)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void initCountry(char *fn)
|
||||
{
|
||||
register char *p1, *p2;
|
||||
auto char s[BUFSIZ];
|
||||
auto FILE *f;
|
||||
|
||||
|
||||
if ((f = fopen(fn, "r")) != (FILE *)NULL) {
|
||||
while (fgets(s, BUFSIZ, f)) {
|
||||
if ((p1 = strchr(s, ':'))) {
|
||||
*p1 = 0;
|
||||
|
||||
if ((p2 = strchr(p1 + 1, '\n')))
|
||||
*p2 = 0;
|
||||
|
||||
Country = realloc(Country, (nCountry + 1) * sizeof(COUNTRY));
|
||||
Country[nCountry].prefix = strdup(s);
|
||||
Country[nCountry].name = strdup(p1 + 1);
|
||||
p2 = Country[nCountry].match = strdup(p1 + 1);
|
||||
nCountry++;
|
||||
|
||||
while (*p2) {
|
||||
*p2 = tolower(*p2);
|
||||
|
||||
if ((*p2 < 'a') || (*p2 > 'z'))
|
||||
*p2 = ' ';
|
||||
|
||||
p2++;
|
||||
} /* while */
|
||||
} /* if */
|
||||
} /* while */
|
||||
|
||||
fclose(f);
|
||||
|
||||
} /* if */
|
||||
} /* initCountry */
|
||||
|
||||
|
||||
static int min3(register int x, register int y, register int z)
|
||||
{
|
||||
if (x < y)
|
||||
y = x;
|
||||
if (y < z)
|
||||
z = y;
|
||||
|
||||
return(z);
|
||||
} /* min */
|
||||
|
||||
|
||||
static int wld(register char *nadel, register char *heuhaufen) /* weighted Levenshtein distance */
|
||||
{
|
||||
register int i, j;
|
||||
auto int l1 = strlen(nadel);
|
||||
auto int l2 = strlen(heuhaufen);
|
||||
auto int dw[WMAX + 1][WMAX + 1];
|
||||
|
||||
|
||||
dw[0][0] = 0;
|
||||
|
||||
for (j = 1; j <= WMAX; j++)
|
||||
dw[0][j] = dw[0][j - 1] + Q;
|
||||
|
||||
for (i = 1; i <= WMAX; i++)
|
||||
dw[i][0] = dw[i - 1][0] + R;
|
||||
|
||||
for (i = 1; i <= l1; i++)
|
||||
for (j = 1; j <= l2; j++)
|
||||
dw[i][j] = min3(dw[i - 1][j - 1] + ((nadel[i - 1] == heuhaufen[j - 1]) ? 0 : P), dw[i][j - 1] + Q, dw[i - 1][j] + R);
|
||||
|
||||
return(dw[l1][l2]);
|
||||
} /* wld */
|
||||
|
||||
|
||||
static int countrymatch(char *name, char *num)
|
||||
{
|
||||
register char *p;
|
||||
register int i, test = (num == NULL);
|
||||
auto char k[BUFSIZ];
|
||||
|
||||
|
||||
strcpy(k, name);
|
||||
p = k;
|
||||
|
||||
while (*p) {
|
||||
*p = tolower(*p);
|
||||
|
||||
if ((*p < 'a') || (*p > 'z'))
|
||||
*p = ' ';
|
||||
|
||||
p++;
|
||||
} /* while */
|
||||
|
||||
for (i = 0; i < nCountry; i++)
|
||||
if (strstr(Country[i].match, k) && (test || !strncmp(Country[i].prefix, num, strlen(Country[i].prefix))))
|
||||
return(nCountry);
|
||||
|
||||
for (i = 0; i < nCountry; i++)
|
||||
if ((wld(k, Country[i].match) <= DISTANCE) && (test || !strncmp(Country[i].prefix, num, strlen(Country[i].prefix))))
|
||||
return(nCountry);
|
||||
|
||||
return(0);
|
||||
} /* countymatch */
|
||||
|
||||
|
||||
/* INPUT: "+372"
|
||||
OUTPUT: "Estland"
|
||||
|
||||
INPUT: "Estland"
|
||||
OUTPUT: "+372"
|
||||
*/
|
||||
|
||||
int abroad(char *key, char *result)
|
||||
{
|
||||
register char *p;
|
||||
register int i;
|
||||
auto int mode, match = 0, res = 0;
|
||||
|
||||
|
||||
*result = 0;
|
||||
|
||||
if (!memcmp(key, countryprefix, strlen(countryprefix))) /* +xxx */
|
||||
mode = 1;
|
||||
else { /* "Estland" */
|
||||
mode = 2;
|
||||
|
||||
p = key;
|
||||
|
||||
while (*p) {
|
||||
*p = tolower(*p);
|
||||
|
||||
if ((*p < 'a') || (*p > 'z'))
|
||||
*p = ' ';
|
||||
|
||||
p++;
|
||||
} /* while */
|
||||
|
||||
} /* else */
|
||||
|
||||
for (i = 0; i < nCountry; i++) {
|
||||
if (mode == 1) {
|
||||
res = strlen(Country[i].prefix);
|
||||
match = !strncmp(Country[i].prefix, key, res);
|
||||
}
|
||||
else {
|
||||
res = 1;
|
||||
match = (strstr(Country[i].match, key) != NULL);
|
||||
|
||||
if (!match)
|
||||
match = (wld(key, Country[i].match) <= DISTANCE);
|
||||
} /* else */
|
||||
|
||||
if (match) {
|
||||
if (mode == 1)
|
||||
strcpy(result, Country[i].name);
|
||||
else
|
||||
strcpy(result, Country[i].prefix);
|
||||
|
||||
return(res);
|
||||
} /* if */
|
||||
} /* for */
|
||||
|
||||
return(0);
|
||||
} /* abroad */
|
||||
|
||||
|
||||
static char *strip (char *s)
|
||||
{
|
||||
char *p;
|
||||
|
@ -390,6 +579,8 @@ int initRate(char *conf, char *dat, char **msg)
|
|||
variant[i]=UNKNOWN;
|
||||
}
|
||||
|
||||
initCountry("/usr/lib/isdn/ausland.dat");
|
||||
|
||||
if (conf && *conf) {
|
||||
if ((stream=fopen(conf,"r"))==NULL) {
|
||||
if (msg) snprintf (message, LENGTH, "Error: could not load rate configuration from %s: %s",
|
||||
|
@ -611,6 +802,10 @@ int initRate(char *conf, char *dat, char **msg)
|
|||
}
|
||||
if (c) {
|
||||
Provider[prefix].Area=realloc(Provider[prefix].Area, (Provider[prefix].nArea+1)*sizeof(AREA));
|
||||
|
||||
if (isalpha(*c) && !countrymatch(c, NULL))
|
||||
warning(dat, "Unknown country \"%s\"", c);
|
||||
|
||||
Provider[prefix].Area[Provider[prefix].nArea].Code=strdup(c);
|
||||
Provider[prefix].Area[Provider[prefix].nArea].Zone=zones->data; /* ugly: use first zone */
|
||||
Provider[prefix].nArea++;
|
||||
|
@ -768,8 +963,8 @@ int initRate(char *conf, char *dat, char **msg)
|
|||
}
|
||||
price=strtod(s,&s);
|
||||
while (isblank(*s)) s++;
|
||||
divider=0;
|
||||
duration=1;
|
||||
divider=0.0;
|
||||
duration=1.0;
|
||||
if (*s=='(') {
|
||||
s++; while (isblank(*s)) s++;
|
||||
if (!isdigit(*s)) {
|
||||
|
@ -811,7 +1006,10 @@ int initRate(char *conf, char *dat, char **msg)
|
|||
warning(dat, "last rate must not have a delay, will be ignored!");
|
||||
delay=UNKNOWN;
|
||||
}
|
||||
|
||||
if (duration==0.0 && delay!=0 && delay != UNKNOWN) {
|
||||
warning(dat, "zero duration must not have a delay, duration set to %d!", delay);
|
||||
duration=delay;
|
||||
}
|
||||
zp=zones;
|
||||
while (zp) {
|
||||
z=pop(&zp);
|
||||
|
@ -891,14 +1089,21 @@ int getZone (int prefix, char *number)
|
|||
max=0;
|
||||
z=UNKNOWN;
|
||||
for (a=0; a<Provider[prefix].nArea; a++) {
|
||||
|
||||
if (isalpha(*Provider[prefix].Area[a].Code)) {
|
||||
if (countrymatch(Provider[prefix].Area[a].Code, number))
|
||||
return(Provider[prefix].Area[a].Zone);
|
||||
}
|
||||
else
|
||||
{
|
||||
m=strmatch(Provider[prefix].Area[a].Code, number);
|
||||
if (m>max) {
|
||||
z=Provider[prefix].Area[a].Zone;
|
||||
max=m;
|
||||
}
|
||||
l=m;
|
||||
} /* else */
|
||||
}
|
||||
|
||||
return z;
|
||||
}
|
||||
|
||||
|
@ -910,8 +1115,9 @@ int getRate(RATE *Rate, char **msg)
|
|||
HOUR *Hour;
|
||||
UNIT *Unit;
|
||||
int prefix, zone, hour, i;
|
||||
time_t now, run, end;
|
||||
double now, run, end;
|
||||
struct tm tm;
|
||||
time_t time;
|
||||
|
||||
if (msg)
|
||||
*(*msg=message)='\0';
|
||||
|
@ -947,9 +1153,10 @@ int getRate(RATE *Rate, char **msg)
|
|||
now=Rate->start;
|
||||
end=Rate->now;
|
||||
Rate->Time=end-now;
|
||||
run=0;
|
||||
run=0.0;
|
||||
while (end>=now) {
|
||||
tm=*localtime(&now);
|
||||
time=now;
|
||||
tm=*localtime(&time);
|
||||
if (hour!=tm.tm_hour) { /* Neuberechnung bei Stundenwechsel */
|
||||
hour=tm.tm_hour;
|
||||
hourBits=1<<tm.tm_hour;
|
||||
|
@ -973,11 +1180,11 @@ int getRate(RATE *Rate, char **msg)
|
|||
Rate->Rest+=Unit->Duration;
|
||||
now+=Unit->Duration;
|
||||
run+=Unit->Duration;
|
||||
if (run==0 && Unit->Duration==0)
|
||||
if (run==0.0 && Unit->Duration==0.0)
|
||||
Rate->Basic=Unit->Price;
|
||||
else
|
||||
Rate->Price=Unit->Price;
|
||||
if (Unit->Duration>0)
|
||||
if (Unit->Duration>0.0)
|
||||
Rate->Units++;
|
||||
if (Unit->Delay!=UNKNOWN && Unit->Delay<=run)
|
||||
Unit++;
|
||||
|
@ -1073,11 +1280,11 @@ void main (int argc, char *argv[])
|
|||
initHoliday ("../holiday-at.dat", &msg);
|
||||
printf ("%s\n", msg);
|
||||
|
||||
initRate ("/etc/isdn/rate.conf", "../rate-at.dat", &msg);
|
||||
initRate ("/etc/isdn/rate.conf", "../auskunft.dat", &msg);
|
||||
printf ("%s\n", msg);
|
||||
|
||||
Rate.prefix = 1;
|
||||
Rate.zone = 4;
|
||||
Rate.zone = 1;
|
||||
|
||||
if (argc==2) {
|
||||
z=getZone(01, argv[1]);
|
||||
|
@ -1090,27 +1297,35 @@ void main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
time(&Rate.start);
|
||||
time(&Rate.now);
|
||||
if (getRate(&Rate, &msg)==UNKNOWN) {
|
||||
printf ("Ooops: %s\n", msg);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
printf ("%s\n\n", explainRate(&Rate));
|
||||
printf ("---Date--- --Time-- --Charge-- ( Basic Price) Unit Dur Time Rest\n");
|
||||
|
||||
while (1) {
|
||||
time(&Rate.now);
|
||||
if (getRate(&Rate, &msg)==UNKNOWN)
|
||||
if (getRate(&Rate, &msg)==UNKNOWN) {
|
||||
printf ("Ooops: %s\n", msg);
|
||||
else {
|
||||
now=*localtime(&Rate.now);
|
||||
printf ("%02d.%02d.%04d %02d:%02d:%02d %s %6.2f sec %7.3f + %7.3f öS %3d EH %6.2f öS %3ld sec %3ld sec\n",
|
||||
now.tm_mday, now.tm_mon+1, now.tm_year+1900,
|
||||
now.tm_hour, now.tm_min, now.tm_sec,
|
||||
explainRate(&Rate),
|
||||
Rate.Duration, Rate.Basic, Rate.Price, Rate.Units, Rate.Charge, Rate.Time, Rate.Rest);
|
||||
|
||||
LCR=Rate;
|
||||
#if 0
|
||||
if (getLeastCost(&LCR,-1)!=UNKNOWN) {
|
||||
printf ("least cost would be: %s %6.2f %7.3f %3d %6.2f %3ld %3ld\n",
|
||||
explainRate(&LCR),
|
||||
LCR.Duration, LCR.Price, LCR.Units, LCR.Charge, LCR.Time, LCR.Rest);
|
||||
}
|
||||
#endif
|
||||
exit (1);
|
||||
}
|
||||
now=*localtime(&Rate.now);
|
||||
printf ("%02d.%02d.%04d %02d:%02d:%02d ATS %6.3f (%6.3f %6.3f) %4d %4.1f %4ld %4ld\n",
|
||||
now.tm_mday, now.tm_mon+1, now.tm_year+1900,
|
||||
now.tm_hour, now.tm_min, now.tm_sec,
|
||||
Rate.Charge, Rate.Basic, Rate.Price, Rate.Units, Rate.Duration, Rate.Time, Rate.Rest);
|
||||
|
||||
LCR=Rate;
|
||||
#if 0
|
||||
if (getLeastCost(&LCR,-1)!=UNKNOWN) {
|
||||
printf ("least cost would be: %s %6.2f %7.3f %3d %6.2f %3ld %3ld\n",
|
||||
explainRate(&LCR),
|
||||
LCR.Duration, LCR.Price, LCR.Units, LCR.Charge, LCR.Time, LCR.Rest);
|
||||
}
|
||||
#endif
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,13 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.5 1999/04/14 13:17:26 akool
|
||||
* isdnlog Version 3.14
|
||||
*
|
||||
* - "make install" now install's "rate-xx.dat", "rate.conf" and "ausland.dat"
|
||||
* - "holiday-xx.dat" Version 1.1
|
||||
* - many rate fixes (Thanks again to Michael Reinelt <reinelt@eunet.at>)
|
||||
*
|
||||
* Revision 1.4 1999/04/10 16:36:42 akool
|
||||
* isdnlog Version 3.13
|
||||
*
|
||||
|
@ -92,6 +99,7 @@ typedef struct {
|
|||
time_t Rest; /* bezahlte, aber noch nicht verbrauchte Zeit */
|
||||
} RATE;
|
||||
|
||||
int abroad(char *key, char *result);
|
||||
void exitRate(void);
|
||||
int initRate(char *conf, char *dat, char **msg);
|
||||
char *getProvidername(int prefix);
|
||||
|
|
|
@ -19,6 +19,14 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.25 1999/05/04 19:33:47 akool
|
||||
* isdnlog Version 3.24
|
||||
*
|
||||
* - fully removed "sondernummern.c"
|
||||
* - removed "gcc -Wall" warnings in ASN.1 Parser
|
||||
* - many new entries for "rate-de.dat"
|
||||
* - better "isdnconf" utility
|
||||
*
|
||||
* Revision 1.24 1999/04/14 13:17:28 akool
|
||||
* isdnlog Version 3.14
|
||||
*
|
||||
|
@ -580,40 +588,6 @@ char *double2clock(double n)
|
|||
|
||||
/****************************************************************************/
|
||||
|
||||
void abroad(char *num, char *area)
|
||||
{
|
||||
*area = 0;
|
||||
|
||||
if (!memcmp(num, countryprefix, strlen(countryprefix))) { /* Ausland */
|
||||
auto FILE *f = fopen("/usr/lib/isdn/ausland.dat", "r");
|
||||
register char *p, *p1;
|
||||
auto char s[BUFSIZ];
|
||||
|
||||
|
||||
if (f != (FILE *)NULL) {
|
||||
while (fgets(s, BUFSIZ, f)) {
|
||||
if ((p = strchr(s, ':'))) {
|
||||
*p = 0;
|
||||
|
||||
if (!memcmp(num, s, strlen(s))) {
|
||||
if ((p1 = strchr(p + 1, '\n')))
|
||||
*p1 = 0;
|
||||
|
||||
strcpy(area, p + 1);
|
||||
|
||||
fclose(f);
|
||||
return;
|
||||
} /* if */
|
||||
} /* if */
|
||||
} /* while */
|
||||
|
||||
fclose(f);
|
||||
} /* if */
|
||||
} /* if */
|
||||
} /* abroad */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
char *vnum(int chan, int who)
|
||||
{
|
||||
register int l = strlen(call[chan].num[who]), got = 0;
|
||||
|
@ -672,37 +646,24 @@ char *vnum(int chan, int who)
|
|||
}
|
||||
else {
|
||||
if (!memcmp(call[chan].num[who], countryprefix, strlen(countryprefix))) { /* Ausland */
|
||||
auto FILE *f = fopen("/usr/lib/isdn/ausland.dat", "r");
|
||||
register char *p, *p1;
|
||||
auto char s[BUFSIZ];
|
||||
register int i;
|
||||
auto char s[BUFSIZ];
|
||||
|
||||
|
||||
if (f != (FILE *)NULL) {
|
||||
while (fgets(s, BUFSIZ, f)) {
|
||||
if ((p = strchr(s, ':'))) {
|
||||
*p = 0;
|
||||
i = abroad(call[chan].num[who], s);
|
||||
|
||||
if (!memcmp(call[chan].num[who], s, strlen(s))) {
|
||||
if ((p1 = strchr(p + 1, '\n')))
|
||||
*p1 = 0;
|
||||
if (i) {
|
||||
Strncpy(call[chan].areacode[who], call[chan].num[who], i + 1);
|
||||
strcpy(call[chan].rufnummer[who], call[chan].num[who] + i);
|
||||
*call[chan].vorwahl[who] = 0;
|
||||
strcpy(call[chan].area[who], s);
|
||||
|
||||
strcpy(call[chan].areacode[who], s);
|
||||
strcpy(call[chan].rufnummer[who], call[chan].num[who] + strlen(s));
|
||||
*call[chan].vorwahl[who] = 0;
|
||||
strcpy(call[chan].area[who], p + 1);
|
||||
sprintf(retstr[retnum], "%s %s, %s",
|
||||
call[chan].areacode[who],
|
||||
call[chan].rufnummer[who],
|
||||
call[chan].area[who]);
|
||||
|
||||
sprintf(retstr[retnum], "%s %s, %s",
|
||||
call[chan].areacode[who],
|
||||
call[chan].rufnummer[who],
|
||||
call[chan].area[who]);
|
||||
|
||||
fclose(f);
|
||||
return(retstr[retnum]);
|
||||
} /* if */
|
||||
} /* if */
|
||||
} /* while */
|
||||
|
||||
fclose(f);
|
||||
return(retstr[retnum]);
|
||||
} /* if */
|
||||
} /* if */
|
||||
|
||||
|
|
|
@ -20,6 +20,14 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.39 1999/05/04 19:33:50 akool
|
||||
* isdnlog Version 3.24
|
||||
*
|
||||
* - fully removed "sondernummern.c"
|
||||
* - removed "gcc -Wall" warnings in ASN.1 Parser
|
||||
* - many new entries for "rate-de.dat"
|
||||
* - better "isdnconf" utility
|
||||
*
|
||||
* Revision 1.38 1999/04/30 19:08:27 akool
|
||||
* isdnlog Version 3.23
|
||||
*
|
||||
|
@ -1017,7 +1025,6 @@ _EXTERN char *double2str(double n, int l, int d, int flags);
|
|||
_EXTERN char *double2byte(double bytes);
|
||||
_EXTERN char *time2str(time_t sec);
|
||||
_EXTERN char *double2clock(double n);
|
||||
_EXTERN void abroad(char *num, char *area);
|
||||
_EXTERN char *vnum(int chan, int who);
|
||||
_EXTERN char *i2a(int n, int l, int base);
|
||||
_EXTERN int iprintf(char *obuf, int chan, register char *fmt, ...);
|
||||
|
|
Loading…
Reference in New Issue