Added the feature, that environment variables are allowed in the config files.
This commit is contained in:
parent
0a1cb4392b
commit
d1997beda6
27
HOWTO
27
HOWTO
|
@ -67,6 +67,8 @@ Mit folgenden Schritten kommt man in den Genuss von isdnlog-2.99.2:
|
||||||
eine SQL-Relation eintragen. Dies darf nur eingeschaltet werden,
|
eine SQL-Relation eintragen. Dies darf nur eingeschaltet werden,
|
||||||
wenn postgres95 einsatzbereit installiert ist!
|
wenn postgres95 einsatzbereit installiert ist!
|
||||||
|
|
||||||
|
Zur Zeit sind die naechsten beiden Schalter ueberfluessig, da der
|
||||||
|
xisdn voruebergehend aus der Distribution genommen wurde!!!!
|
||||||
# export NEED_GDBM=1
|
# export NEED_GDBM=1
|
||||||
Falls man _nicht_ LIBAREA=1 eingeschaltet hat, und zudem
|
Falls man _nicht_ LIBAREA=1 eingeschaltet hat, und zudem
|
||||||
keine Datei "/usr/lib/libdbm.a", dafuer aber "/usr/lib/libgdbm.a"
|
keine Datei "/usr/lib/libdbm.a", dafuer aber "/usr/lib/libgdbm.a"
|
||||||
|
@ -122,14 +124,14 @@ Mit folgenden Schritten kommt man in den Genuss von isdnlog-2.99.2:
|
||||||
|
|
||||||
Der neue isdnlog arbeitet mit einer vollstaendig anderen
|
Der neue isdnlog arbeitet mit einer vollstaendig anderen
|
||||||
Konfigurationsdatei.
|
Konfigurationsdatei.
|
||||||
|
Diese wird automatisch aus der bestehenden generiert.
|
||||||
|
Es wird das alte Verzeichnis "etc/isdnlog" nach "etc/isdn" umkopiert.
|
||||||
|
|
||||||
isdnlog-2.99.2 versucht daher beim ersten Start, die alte
|
isdnlog-2.99.2 versucht daher beim ersten Start, die alte
|
||||||
Konfigurationsdatei "isdnlog.conf" in die neue Syntax umzuwandeln.
|
Konfigurationsdatei "isdnlog.conf" in die neue Syntax umzuwandeln.
|
||||||
Damit isdnlog-2.99.2 die alte Konfigurationsdatei finden kann, muss diese
|
Dieses passiert automatisch mit make install
|
||||||
evtl. in das in "policy.h" unter "I4LCONFDIR" angegebene Verzeichnis
|
Es werden in dieser Version alle Telefonnummern in der Datei callerid.conf
|
||||||
kopiert werden:
|
ausgelagert, so dass die isdn.conf sehr klien wird.
|
||||||
|
|
||||||
$ cp /etc/isdnlog/isdnlog.conf /etc/isdn
|
|
||||||
|
|
||||||
|
|
||||||
6. Erster Start des neuen isdnlog:
|
6. Erster Start des neuen isdnlog:
|
||||||
|
|
||||||
|
@ -196,11 +198,10 @@ Mit folgenden Schritten kommt man in den Genuss von isdnlog-2.99.2:
|
||||||
Daher muessen diese von Hand uebernommen werden.
|
Daher muessen diese von Hand uebernommen werden.
|
||||||
|
|
||||||
In der Section [GLOBAL]
|
In der Section [GLOBAL]
|
||||||
muessen die beiden Eintraege
|
werden automatisch mit make install die beiden Eintraege
|
||||||
COUNTRYCODE = +49
|
COUNTRYCODE = +49
|
||||||
AREACODE = xxxx
|
AREACODE = xxxx
|
||||||
eingefuegt werden - bei AREACODE ist die eigene Vorwahl _ohne_
|
eingefuegt, wenn vorher diese Daten im Menue eingegeben wurden.
|
||||||
vorlaufende "0" einzutragen.
|
|
||||||
|
|
||||||
Nachdem die neue Konfigurationsdatei fuer gut befunden wurde, sollte
|
Nachdem die neue Konfigurationsdatei fuer gut befunden wurde, sollte
|
||||||
die alte Konfigurationsdatei "isdnlog.conf" geloescht werden, da
|
die alte Konfigurationsdatei "isdnlog.conf" geloescht werden, da
|
||||||
|
@ -212,12 +213,13 @@ Mit folgenden Schritten kommt man in den Genuss von isdnlog-2.99.2:
|
||||||
ausstossen! Nun ist es endlich an der Zeit,
|
ausstossen! Nun ist es endlich an der Zeit,
|
||||||
|
|
||||||
|
|
||||||
7.1 Es gibt nun zwei neue Konfigurationsdateien:
|
7.1 Es gibt nun zwei (oder sogar drei!?!) neue Konfigurationsdateien:
|
||||||
/etc/isdn/isdn.conf
|
/etc/isdn/isdn.conf
|
||||||
/etc/isdn/callerid.conf
|
/etc/isdn/callerid.conf
|
||||||
|
~/.isdn
|
||||||
Wobei sich in der "isdn.conf" nur noch die rein auf isdnlog beziehenden
|
Wobei sich in der "isdn.conf" nur noch die rein auf isdnlog beziehenden
|
||||||
Eintraege befinden, und in der "callerid.conf" die von isdnlog und
|
Eintraege befinden, und in der "callerid.conf" die von isdnlog und
|
||||||
vbox gemeinsam verwendeten Eintraege!
|
(bald!?!) vbox gemeinsam verwendeten Eintraege!
|
||||||
|
|
||||||
|
|
||||||
8. Die neuen Features von isdnlog erkunden
|
8. Die neuen Features von isdnlog erkunden
|
||||||
|
@ -255,6 +257,9 @@ Mit folgenden Schritten kommt man in den Genuss von isdnlog-2.99.2:
|
||||||
- ESTIC
|
- ESTIC
|
||||||
diese Library, weitere Applikationen werden sicherlich folgen!
|
diese Library, weitere Applikationen werden sicherlich folgen!
|
||||||
|
|
||||||
|
Wer unbedingt auf seine AVON besteht, kann diese natuerlich
|
||||||
|
weiterverwenden. Dieses muss dann allerdings im Menu angegeben werden.
|
||||||
|
|
||||||
- chargeint (auflegen kurz vor dem naechsten Gebuehrenimpuls) ist
|
- chargeint (auflegen kurz vor dem naechsten Gebuehrenimpuls) ist
|
||||||
mittlerweile offizieller Bestandteil von isdn4linux, und damit
|
mittlerweile offizieller Bestandteil von isdn4linux, und damit
|
||||||
aus dem "Patch" Stadium heraus. Die Steuerung durch isdnlog
|
aus dem "Patch" Stadium heraus. Die Steuerung durch isdnlog
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
## $Id: Makefile.in,v 1.10 1997/04/08 21:56:42 luethje Exp $
|
## $Id: Makefile.in,v 1.11 1997/04/10 23:32:04 luethje Exp $
|
||||||
##
|
##
|
||||||
## ISDN accounting for isdn4linux.
|
## ISDN accounting for isdn4linux.
|
||||||
##
|
##
|
||||||
|
@ -19,6 +19,9 @@
|
||||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
##
|
##
|
||||||
## $Log: Makefile.in,v $
|
## $Log: Makefile.in,v $
|
||||||
|
## Revision 1.11 1997/04/10 23:32:04 luethje
|
||||||
|
## Added the feature, that environment variables are allowed in the config files.
|
||||||
|
##
|
||||||
## Revision 1.10 1997/04/08 21:56:42 luethje
|
## Revision 1.10 1997/04/08 21:56:42 luethje
|
||||||
## Create the file isdn.conf
|
## Create the file isdn.conf
|
||||||
## some bug fixes for pid and lock file
|
## some bug fixes for pid and lock file
|
||||||
|
@ -106,6 +109,7 @@ LIBISDNDIR := @LIBISDNDIR@
|
||||||
I4LCONFDIR := @I4LCONFDIR@
|
I4LCONFDIR := @I4LCONFDIR@
|
||||||
CONFFILE := @CONFFILE@
|
CONFFILE := @CONFFILE@
|
||||||
OLDCONFDIR := @OLDCONFDIR@
|
OLDCONFDIR := @OLDCONFDIR@
|
||||||
|
OLDCONFFILE := @OLDCONFFILE@
|
||||||
LIBAREA := @LIBAREA@
|
LIBAREA := @LIBAREA@
|
||||||
RUNDIR := @RUNDIR@
|
RUNDIR := @RUNDIR@
|
||||||
DBMLIB := @DBMLIB@
|
DBMLIB := @DBMLIB@
|
||||||
|
@ -162,7 +166,7 @@ SERVICEFILE = /etc/services
|
||||||
# DON'T EDIT BELOW THIS LINE
|
# DON'T EDIT BELOW THIS LINE
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
VERSION = 2.99.6
|
VERSION = 2.99.7
|
||||||
|
|
||||||
ifeq ($(POSTGRES),1)
|
ifeq ($(POSTGRES),1)
|
||||||
DEFS += -DPOSTGRES
|
DEFS += -DPOSTGRES
|
||||||
|
@ -253,7 +257,8 @@ installdirs: rootperm
|
||||||
install: depend all rootperm installdirs
|
install: depend all rootperm installdirs
|
||||||
if ps -x | fgrep $(ISDNLOG) >/dev/null; then kill `cat $(RUNDIR)/isdnlog.pid`; fi
|
if ps -x | fgrep $(ISDNLOG) >/dev/null; then kill `cat $(RUNDIR)/isdnlog.pid`; fi
|
||||||
-test ! -d $(OLDCONFDIR) || (cp -auv $(OLDCONFDIR)/* $(I4LCONFDIR) \
|
-test ! -d $(OLDCONFDIR) || (cp -auv $(OLDCONFDIR)/* $(I4LCONFDIR) \
|
||||||
&& $(ISDNREP) 1>/dev/null 2>&1)
|
&& $(ISDNREP) 1>/dev/null 2>&1) \
|
||||||
|
&& mv $(I4LCONFDIR)/$(OLDCONFFILE) $(I4LCONFDIR)/$(OLDCONFFILE).old
|
||||||
$(GENCONF) $(I4LCONFDIR)/$(CONFFILE)
|
$(GENCONF) $(I4LCONFDIR)/$(CONFFILE)
|
||||||
$(INSTALL_BIN) $(ISDNLOG) $(SBINDIR)
|
$(INSTALL_BIN) $(ISDNLOG) $(SBINDIR)
|
||||||
$(INSTALL_BIN) $(ISDNREP) $(BINDIR)
|
$(INSTALL_BIN) $(ISDNREP) $(BINDIR)
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
# Lock und PID-Files
|
||||||
|
# Beschreibung, was bei der Installation genau gemacht werden muss
|
||||||
|
# (isdn.conf vorhanden oder neu)
|
||||||
ISDNLOG - Version 3.0 - 31-Mar-97 22:09
|
ISDNLOG - Version 3.0 - 31-Mar-97 22:09
|
||||||
|
|
||||||
|
|
||||||
|
@ -754,6 +757,35 @@ anlegen kann, wo auch die Nummer nur beim isdnrep angezeigt werden.
|
||||||
Es koennen hier aber die [MSN]-Eintraege ueberschrieben werden fuer die
|
Es koennen hier aber die [MSN]-Eintraege ueberschrieben werden fuer die
|
||||||
beiden Programme isdnconf und isdnrep.
|
beiden Programme isdnconf und isdnrep.
|
||||||
|
|
||||||
|
Es koennen hier Variablen verwendet werden, die entweder in der isdn.conf
|
||||||
|
gesetzt wurden oder vorher (z.b. auf Shellebene).
|
||||||
|
In den Dateien "callerid.conf" und "~/.isdn" koennen keine Variablen mehr
|
||||||
|
gesetzt werden. Das bedeutet also, dass es dort keine Sektion [VARIABLES]
|
||||||
|
gibt.
|
||||||
|
|
||||||
|
Eine Variable wird allerdings nur ab dem Gleichheitszeichen ersetzt.
|
||||||
|
|
||||||
|
Wenn man an die Variable noch etwas anhaengen will, dann muss man den
|
||||||
|
Variablenname in geschweifte Klammern setzen.
|
||||||
|
Im Gegensatz zur frueheren Version koennen die Variablen an beliebiger Stelle
|
||||||
|
kommen.
|
||||||
|
|
||||||
|
Beispiele:
|
||||||
|
|
||||||
|
[$num] # wobei num=NUMBER ist geht nicht!!!!
|
||||||
|
$alias=fred # wobei alias=ALIAS ist geht nicht!!!!
|
||||||
|
|
||||||
|
[NUMBER]
|
||||||
|
NUMBER=$MSN1 # MSN1=1234 -> "1234"
|
||||||
|
ALIAS=${PHONE}1 # PHONE=Telefon -> "Telefon1"
|
||||||
|
|
||||||
|
...
|
||||||
|
PROGRAM= auplay ${MY_PATH}ring.au # MY_PATH=/home/fred/ -> "/home/fred/ring.au"
|
||||||
|
PROGRAM= auplay $MY_PATHring.au # geht nicht!!
|
||||||
|
PROGRAM= auplay ${MY_PATH}ring.au ${SOUND_PATH}/$RING_FILE
|
||||||
|
# SOUND_PATH=/home/sound RING_FILE=ring.au -> "/home/sound/ring.au"
|
||||||
|
...
|
||||||
|
|
||||||
Es gibt bestimmte Regeln, nachdem Eintraege aus der Datei "~/.isdn" die
|
Es gibt bestimmte Regeln, nachdem Eintraege aus der Datei "~/.isdn" die
|
||||||
Eintraege der "callerid.conf" ueberschreiben:
|
Eintraege der "callerid.conf" ueberschreiben:
|
||||||
|
|
||||||
|
@ -1278,9 +1310,6 @@ Info-Arg
|
||||||
Hier wird das Info-Argument angegeben. Es steht dort der gesamte zu
|
Hier wird das Info-Argument angegeben. Es steht dort der gesamte zu
|
||||||
startende Befehl
|
startende Befehl
|
||||||
|
|
||||||
Es koennen hier Variablen verwendet werden, die entweder in der isdn.conf
|
|
||||||
gesetzt wurden oder vorher (z.b. auf Shellebene).
|
|
||||||
|
|
||||||
Es gibt aber drei zusaetzliche Variablen, die verwendet werden duerfen:
|
Es gibt aber drei zusaetzliche Variablen, die verwendet werden duerfen:
|
||||||
|
|
||||||
$1 : Sind die Flags, die den Programmstart ausgeloest haben.
|
$1 : Sind die Flags, die den Programmstart ausgeloest haben.
|
||||||
|
@ -1336,14 +1365,6 @@ Ausgehendes Gspraech (O), Ereignis CONNECT (C)
|
||||||
Nummer des Anrufenden (also Meine)
|
Nummer des Anrufenden (also Meine)
|
||||||
Nummer des Angerufenden
|
Nummer des Angerufenden
|
||||||
|
|
||||||
Eine Variable muss immer am Anfang eines Argumentes stehen. Also
|
|
||||||
"/bin$PROG" und "/bin${MYPATH}prog" gehen nicht.
|
|
||||||
|
|
||||||
Wenn ich an die Variable noch etwas anhaengen will, dann muss ich den
|
|
||||||
Variablenname in geschweifte Klammern setzen:
|
|
||||||
"${MY_PATH}/ring.au"
|
|
||||||
"$MY_PATH/ring.au" geht nicht.
|
|
||||||
|
|
||||||
Die Variablen von isdnlog ($1, $2, ..) kann man nicht in geschweiften Klammern
|
Die Variablen von isdnlog ($1, $2, ..) kann man nicht in geschweiften Klammern
|
||||||
setzen. Also auch nicht anhaengen.
|
setzen. Also auch nicht anhaengen.
|
||||||
|
|
||||||
|
|
|
@ -1950,6 +1950,7 @@ s%@RUNDIR@%$RUNDIR%g
|
||||||
s%@SERV_PORT@%$SERV_PORT%g
|
s%@SERV_PORT@%$SERV_PORT%g
|
||||||
s%@USERFILE@%$USERFILE%g
|
s%@USERFILE@%$USERFILE%g
|
||||||
s%@OLDCONFDIR@%$OLDCONFDIR%g
|
s%@OLDCONFDIR@%$OLDCONFDIR%g
|
||||||
|
s%@OLDCONFFILE@%$OLDCONFFILE%g
|
||||||
s%@CONFFILE@%$CONFIG_CONFFILE%g
|
s%@CONFFILE@%$CONFIG_CONFFILE%g
|
||||||
s%@LOGFILE@%$LOGFILE%g
|
s%@LOGFILE@%$LOGFILE%g
|
||||||
s%@COUNTRYCODE@%$COUNTRYCODE%g
|
s%@COUNTRYCODE@%$COUNTRYCODE%g
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: isdnconf.c,v 1.4 1997/04/06 21:06:08 luethje Exp $
|
/* $Id: isdnconf.c,v 1.5 1997/04/10 23:32:15 luethje Exp $
|
||||||
*
|
*
|
||||||
* ISDN accounting for isdn4linux. (Report-module)
|
* ISDN accounting for isdn4linux. (Report-module)
|
||||||
*
|
*
|
||||||
|
@ -19,6 +19,9 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
* $Log: isdnconf.c,v $
|
* $Log: isdnconf.c,v $
|
||||||
|
* Revision 1.5 1997/04/10 23:32:15 luethje
|
||||||
|
* Added the feature, that environment variables are allowed in the config files.
|
||||||
|
*
|
||||||
* Revision 1.4 1997/04/06 21:06:08 luethje
|
* Revision 1.4 1997/04/06 21:06:08 luethje
|
||||||
* problem with empty/not existing file resolved.
|
* problem with empty/not existing file resolved.
|
||||||
*
|
*
|
||||||
|
@ -284,7 +287,7 @@ int look_data(section **conf_dat)
|
||||||
{
|
{
|
||||||
int Cnt = 0;
|
int Cnt = 0;
|
||||||
auto entry *CEPtr;
|
auto entry *CEPtr;
|
||||||
char *_number = NULL, *_alias;
|
char *_number = NULL, *_alias = NULL;
|
||||||
char _si[SHORT_STRING_SIZE];
|
char _si[SHORT_STRING_SIZE];
|
||||||
section *old_conf_dat = NULL;
|
section *old_conf_dat = NULL;
|
||||||
|
|
||||||
|
@ -297,18 +300,20 @@ int look_data(section **conf_dat)
|
||||||
{
|
{
|
||||||
int Ret = 0;
|
int Ret = 0;
|
||||||
|
|
||||||
|
free(_number);
|
||||||
|
free(_alias);
|
||||||
_number = _alias = NULL;
|
_number = _alias = NULL;
|
||||||
_si[0] = '\0';
|
_si[0] = '\0';
|
||||||
|
|
||||||
if ((CEPtr = Get_Entry((*conf_dat)->entries,CONF_ENT_NUM)) != NULL)
|
if ((CEPtr = Get_Entry((*conf_dat)->entries,CONF_ENT_NUM)) != NULL)
|
||||||
_number = CEPtr->value;
|
_number = strdup(Replace_Variable(CEPtr->value));
|
||||||
|
|
||||||
if ((CEPtr = Get_Entry((*conf_dat)->entries,CONF_ENT_ALIAS)) != NULL)
|
if ((CEPtr = Get_Entry((*conf_dat)->entries,CONF_ENT_ALIAS)) != NULL)
|
||||||
_alias = CEPtr->value;
|
_alias = strdup(Replace_Variable(CEPtr->value));
|
||||||
|
|
||||||
if ((CEPtr = Get_Entry((*conf_dat)->entries,CONF_ENT_SI)) != NULL &&
|
if ((CEPtr = Get_Entry((*conf_dat)->entries,CONF_ENT_SI)) != NULL &&
|
||||||
CEPtr->value != NULL)
|
CEPtr->value != NULL)
|
||||||
sprintf(_si,"%ld",strtol(CEPtr->value, NIL, 0));
|
sprintf(_si,"%ld",strtol(Replace_Variable(CEPtr->value), NIL, 0));
|
||||||
|
|
||||||
if (and)
|
if (and)
|
||||||
Ret = 1;
|
Ret = 1;
|
||||||
|
@ -371,6 +376,8 @@ int look_data(section **conf_dat)
|
||||||
if (Cnt == 0 && quiet && !del)
|
if (Cnt == 0 && quiet && !del)
|
||||||
find_data(NULL,_number,*conf_dat);
|
find_data(NULL,_number,*conf_dat);
|
||||||
|
|
||||||
|
free(_number);
|
||||||
|
free(_alias);
|
||||||
return Cnt;
|
return Cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,6 +636,9 @@ int main(int argc, char *argv[], char *envp[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!add && !del && Replace_Variables(conf_dat))
|
||||||
|
exit(8);
|
||||||
|
|
||||||
if (add)
|
if (add)
|
||||||
Cnt = add_data(&conf_dat);
|
Cnt = add_data(&conf_dat);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: start_prog.c,v 1.2 1997/04/03 22:58:34 luethje Exp $
|
/* $Id: start_prog.c,v 1.3 1997/04/10 23:32:19 luethje Exp $
|
||||||
*
|
*
|
||||||
* ISDN accounting for isdn4linux.
|
* ISDN accounting for isdn4linux.
|
||||||
*
|
*
|
||||||
|
@ -20,6 +20,9 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
* $Log: start_prog.c,v $
|
* $Log: start_prog.c,v $
|
||||||
|
* Revision 1.3 1997/04/10 23:32:19 luethje
|
||||||
|
* Added the feature, that environment variables are allowed in the config files.
|
||||||
|
*
|
||||||
* Revision 1.2 1997/04/03 22:58:34 luethje
|
* Revision 1.2 1997/04/03 22:58:34 luethje
|
||||||
* some primitve changes.
|
* some primitve changes.
|
||||||
*
|
*
|
||||||
|
@ -217,7 +220,6 @@ static int GetArgs(char *Line, char *Args[], char *Opts[], int MaxArgs)
|
||||||
char *Arg = NULL;
|
char *Arg = NULL;
|
||||||
char *Use = Line;
|
char *Use = Line;
|
||||||
char *Ptr = NULL;
|
char *Ptr = NULL;
|
||||||
char *Ptr2 = NULL;
|
|
||||||
char *Org_Arg;
|
char *Org_Arg;
|
||||||
int MaxOpts= 0;
|
int MaxOpts= 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -265,31 +267,8 @@ static int GetArgs(char *Line, char *Args[], char *Opts[], int MaxArgs)
|
||||||
Arg = NULL;
|
Arg = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (*Arg == '$')
|
if (*Arg == '$' && Opts != NULL && (Num = atoi(Arg+1)) > 0 && Num <= MaxOpts)
|
||||||
{
|
|
||||||
if (Opts != NULL && (Num = atoi(Arg+1)) > 0 && Num <= MaxOpts)
|
|
||||||
Arg = Opts[Num-1];
|
Arg = Opts[Num-1];
|
||||||
else
|
|
||||||
if (strlen(Arg) > 3 && Arg[1] == '{' && (Ptr = strrchr(Arg,'}')) != NULL)
|
|
||||||
{
|
|
||||||
*Ptr = '\0';
|
|
||||||
|
|
||||||
if ((Ptr2 = getenv(To_Upper(Arg+2))) != NULL)
|
|
||||||
{
|
|
||||||
strcpy(HelpString,Ptr2);
|
|
||||||
strcat(HelpString,Ptr+1);
|
|
||||||
Arg = strdup(HelpString);
|
|
||||||
|
|
||||||
MemPtr = (char**) realloc(MemPtr,sizeof(char*)*(j+2));
|
|
||||||
MemPtr[j++] = Arg;
|
|
||||||
MemPtr[j] = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Arg = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Arg = getenv(To_Upper(Arg+1));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Arg == NULL || *Arg == '\0')
|
if (Arg == NULL || *Arg == '\0')
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: isdnconf.c,v 1.3 1997/04/03 22:58:39 luethje Exp $
|
/* $Id: isdnconf.c,v 1.4 1997/04/10 23:32:24 luethje Exp $
|
||||||
*
|
*
|
||||||
* ISDN accounting for isdn4linux. (Utilities)
|
* ISDN accounting for isdn4linux. (Utilities)
|
||||||
*
|
*
|
||||||
|
@ -913,6 +913,9 @@ static int _readconfig(char *_myname)
|
||||||
if ((SPtr = read_isdnconf(&conf_dat)) == NULL)
|
if ((SPtr = read_isdnconf(&conf_dat)) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (Replace_Variables(conf_dat))
|
||||||
|
return -1;
|
||||||
|
|
||||||
Set_Globals(conf_dat);
|
Set_Globals(conf_dat);
|
||||||
|
|
||||||
while (SPtr != NULL)
|
while (SPtr != NULL)
|
||||||
|
|
|
@ -96,15 +96,22 @@ zurueckgeliefert.
|
||||||
|
|
||||||
Funktion:
|
Funktion:
|
||||||
|
|
||||||
int create_runfile(const char *progname)
|
int handle_runfile(const char *progname, char **devices, int flag)
|
||||||
|
|
||||||
Legt eine PID-Datei im Verzeichnis RUNDIR (/var/run) an. In der Datei
|
Legt eine PID-Datei im Verzeichnis RUNDIR (/var/run) und die
|
||||||
steht im ASCII-Format die Prozess-ID des aktuellen Prozesses.
|
entsprechenden LOCK-Dateien im Verszeichnis LOCKDIR (/var/lock) an. In den
|
||||||
|
Dateien steht im ASCII-Format die Prozess-ID des aktuellen Prozesses.
|
||||||
|
Oder Loescht alle angelegt Dateien.
|
||||||
|
|
||||||
progname: Ist der Name, der als PID-Datei angelegt wird.
|
progname: Ist der Name, der als PID-Datei angelegt wird. Es wird dort noch
|
||||||
"fred" -> "/var/run/fred.pid"
|
der erste Name des Devices angehaengt.
|
||||||
"isdnlog.tty2" -> "/var/run/isdnlog.tty2.pid"
|
progname = "fred", devices[0] = "null" -> "/var/run/fred.null.pid"
|
||||||
|
|
||||||
|
devices: Ist eine List mit den verwendeten Devices. Das letzte Element der
|
||||||
|
Liste muss NULL enthalten.
|
||||||
|
|
||||||
|
flag: Kann zwei Werte beinhalten: START_PROG (legt die o.g. Dateien an) oder
|
||||||
|
STOP_PROG (loescht die angelegten Dateien wieder).
|
||||||
|
|
||||||
Rueckgabewert:
|
Rueckgabewert:
|
||||||
Wenn schon ein gueltiger/laufender Prozess mit der ID besteht liefert
|
Wenn schon ein gueltiger/laufender Prozess mit der ID besteht liefert
|
||||||
|
@ -116,21 +123,6 @@ andernfalls -1.
|
||||||
|
|
||||||
Funktion:
|
Funktion:
|
||||||
|
|
||||||
int delete_runfile(const char *progname)
|
|
||||||
|
|
||||||
Loescht eine PID-Datei im Verzeichnis RUNDIR (/var/run).
|
|
||||||
|
|
||||||
progname: Ist der Name, der als PID-Datei geloescht werden soll.
|
|
||||||
"fred" -> "/var/run/fred.pid"
|
|
||||||
"isdnlog.tty2" -> "/var/run/isdnlog.tty2.pid"
|
|
||||||
|
|
||||||
Rueckgabewert:
|
|
||||||
Im Erfolgsfall 0, sonst -1.
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Funktion:
|
|
||||||
|
|
||||||
int Set_Codes(section* Section)
|
int Set_Codes(section* Section)
|
||||||
|
|
||||||
Setzt die Eintraege der Section [GLOBAL] in die entsprechenden
|
Setzt die Eintraege der Section [GLOBAL] in die entsprechenden
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: conffile.c,v 1.11 1997/04/03 22:39:11 luethje Exp $
|
/* $Id: conffile.c,v 1.12 1997/04/10 23:32:33 luethje Exp $
|
||||||
*
|
*
|
||||||
* ISDN accounting for isdn4linux.
|
* ISDN accounting for isdn4linux.
|
||||||
*
|
*
|
||||||
|
@ -19,6 +19,9 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
* $Log: conffile.c,v $
|
* $Log: conffile.c,v $
|
||||||
|
* Revision 1.12 1997/04/10 23:32:33 luethje
|
||||||
|
* Added the feature, that environment variables are allowed in the config files.
|
||||||
|
*
|
||||||
* Revision 1.11 1997/04/03 22:39:11 luethje
|
* Revision 1.11 1997/04/03 22:39:11 luethje
|
||||||
* bug fixes: environ variables are working again, no seg. 11 :-)
|
* bug fixes: environ variables are working again, no seg. 11 :-)
|
||||||
* improved performance for reading the config files.
|
* improved performance for reading the config files.
|
||||||
|
@ -1529,3 +1532,37 @@ static char* Delete_Chars(char *String, char *Quote)
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int Replace_Variables(section *Section)
|
||||||
|
{
|
||||||
|
entry *Entry;
|
||||||
|
char *Ptr = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
while(Section != NULL)
|
||||||
|
{
|
||||||
|
Entry = Section->entries;
|
||||||
|
|
||||||
|
while(Entry != NULL)
|
||||||
|
{
|
||||||
|
if (Entry->value != NULL && (Ptr = Replace_Variable(Entry->value)) != NULL)
|
||||||
|
{
|
||||||
|
free(Entry->value);
|
||||||
|
|
||||||
|
if ((Entry->value = strdup(Ptr)) == NULL)
|
||||||
|
{
|
||||||
|
print_msg("%s","Can not allocate memory!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Entry = Entry->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
Section = Section->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
/* $Id: conffile.h,v 1.5 1997/04/03 22:39:12 luethje Exp $
|
/* $Id: conffile.h,v 1.6 1997/04/10 23:32:34 luethje Exp $
|
||||||
*
|
*
|
||||||
* ISDN accounting for isdn4linux.
|
* ISDN accounting for isdn4linux.
|
||||||
*
|
*
|
||||||
|
@ -20,6 +20,9 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
* $Log: conffile.h,v $
|
* $Log: conffile.h,v $
|
||||||
|
* Revision 1.6 1997/04/10 23:32:34 luethje
|
||||||
|
* Added the feature, that environment variables are allowed in the config files.
|
||||||
|
*
|
||||||
* Revision 1.5 1997/04/03 22:39:12 luethje
|
* Revision 1.5 1997/04/03 22:39:12 luethje
|
||||||
* bug fixes: environ variables are working again, no seg. 11 :-)
|
* bug fixes: environ variables are working again, no seg. 11 :-)
|
||||||
* improved performance for reading the config files.
|
* improved performance for reading the config files.
|
||||||
|
@ -138,6 +141,7 @@ _EXTERN section* Get_Section_Match(section* Section, char *Path, char* Value, in
|
||||||
_EXTERN char *Get_Value(section *Section, char *Path);
|
_EXTERN char *Get_Value(section *Section, char *Path);
|
||||||
_EXTERN int _Get_Type_Match(section *Section, char *Path, char* Pattern, int (*_match)(char*, char*), int Type, void **Pointer);
|
_EXTERN int _Get_Type_Match(section *Section, char *Path, char* Pattern, int (*_match)(char*, char*), int Type, void **Pointer);
|
||||||
_EXTERN int _Get_Type_Value(section *Section, char *Path, int Type, void **Pointer);
|
_EXTERN int _Get_Type_Value(section *Section, char *Path, int Type, void **Pointer);
|
||||||
|
_EXTERN int Replace_Variables(section *Section);
|
||||||
|
|
||||||
#undef _EXTERN
|
#undef _EXTERN
|
||||||
|
|
||||||
|
|
113
lib/libtools.c
113
lib/libtools.c
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: libtools.c,v 1.3 1997/03/20 00:28:02 luethje Exp $
|
/* $Id: libtools.c,v 1.4 1997/04/10 23:32:35 luethje Exp $
|
||||||
* ISDN accounting for isdn4linux.
|
* ISDN accounting for isdn4linux.
|
||||||
*
|
*
|
||||||
* Copyright 1996 by Stefan Luethje (luethje@sl-gw.lake.de)
|
* Copyright 1996 by Stefan Luethje (luethje@sl-gw.lake.de)
|
||||||
|
@ -18,6 +18,9 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
* $Log: libtools.c,v $
|
* $Log: libtools.c,v $
|
||||||
|
* Revision 1.4 1997/04/10 23:32:35 luethje
|
||||||
|
* Added the feature, that environment variables are allowed in the config files.
|
||||||
|
*
|
||||||
* Revision 1.3 1997/03/20 00:28:02 luethje
|
* Revision 1.3 1997/03/20 00:28:02 luethje
|
||||||
* Inserted lines into the files for the revision tool.
|
* Inserted lines into the files for the revision tool.
|
||||||
*
|
*
|
||||||
|
@ -28,6 +31,7 @@
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
|
@ -120,7 +124,7 @@ char *FGets(char *String, int StringLen, FILE *fp, int *Line)
|
||||||
|
|
||||||
strcat(String,Help);
|
strcat(String,Help);
|
||||||
|
|
||||||
if ((Len = strlen(String)) > 0 && String[Len-1] == '\\' )
|
if ((Len = strlen(String)) > 0 && String[Len-1] == C_QUOTE_CHAR )
|
||||||
String[Len-1] = '\0';
|
String[Len-1] = '\0';
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
@ -152,7 +156,7 @@ char *Check_Quote(char *String, char *Quote, int Flag)
|
||||||
|
|
||||||
while ((Ptr = Strpbrk(Ptr,Quote)) != NULL)
|
while ((Ptr = Strpbrk(Ptr,Quote)) != NULL)
|
||||||
{
|
{
|
||||||
if (Ptr != String && *(Ptr - 1) == '\\')
|
if (Ptr != String && *(Ptr - 1) == C_QUOTE_CHAR)
|
||||||
{
|
{
|
||||||
if (Flag == QUOTE_IGNORE)
|
if (Flag == QUOTE_IGNORE)
|
||||||
{
|
{
|
||||||
|
@ -210,7 +214,7 @@ const char* Quote_Chars(char *string)
|
||||||
for (i = strlen(Ptr); i >= Index; i--)
|
for (i = strlen(Ptr); i >= Index; i--)
|
||||||
Ptr[i+1] = Ptr[i];
|
Ptr[i+1] = Ptr[i];
|
||||||
|
|
||||||
Ptr[Index] = '\\';
|
Ptr[Index] = C_QUOTE_CHAR;
|
||||||
|
|
||||||
Index += 2;
|
Index += 2;
|
||||||
}
|
}
|
||||||
|
@ -501,3 +505,104 @@ int is_integer (char *string, long int *value)
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
char *Replace_Variable(char *String)
|
||||||
|
{
|
||||||
|
static char *RetCode = NULL;
|
||||||
|
char *Begin = NULL;
|
||||||
|
char *Var = NULL;
|
||||||
|
char *End = NULL;
|
||||||
|
char *Value = NULL;
|
||||||
|
int num;
|
||||||
|
|
||||||
|
|
||||||
|
if (RetCode != NULL)
|
||||||
|
free(RetCode);
|
||||||
|
|
||||||
|
if ((RetCode = strdup(String)) == NULL ||
|
||||||
|
(Var = strdup(RetCode)) == NULL ||
|
||||||
|
(End = strdup(RetCode)) == NULL ||
|
||||||
|
(Begin = strdup(RetCode)) == NULL )
|
||||||
|
{
|
||||||
|
print_msg("%s!\n","Can not alllocate memory!\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Begin[0] ='\0';
|
||||||
|
|
||||||
|
while ((num = sscanf(RetCode,"%[^$]$%[0-9a-zA-Z]%[^\n]",Begin,Var,End)+1) > 2 ||
|
||||||
|
(num = sscanf(RetCode,"%[^$]${%[0-9a-zA-Z]}%[^\n]",Begin,Var,End)+1) > 2 ||
|
||||||
|
(num = sscanf(RetCode,"$%[0-9a-zA-Z]%[^\n]",Var,End)) > 0 ||
|
||||||
|
(num = sscanf(RetCode,"${%[0-9a-zA-Z]}%[^\n]",Var,End)) > 0 )
|
||||||
|
{
|
||||||
|
if ((num > 2 && Begin[strlen(Begin)-1] == C_QUOTE_CHAR) || (Value = getenv(Var)) == NULL)
|
||||||
|
{
|
||||||
|
RetCode[strlen(Begin)] = 1;
|
||||||
|
|
||||||
|
if (strlen(Begin) > 0)
|
||||||
|
memmove(RetCode+strlen(Begin)-1,RetCode+strlen(Begin),strlen(RetCode)-strlen(Begin)+1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Value != NULL)
|
||||||
|
{
|
||||||
|
if ((RetCode = (char*) realloc(RetCode,sizeof(char)*(strlen(RetCode)+strlen(Value)-strlen(Var)))) == NULL)
|
||||||
|
{
|
||||||
|
print_msg("%s!\n","Can not alllocate memory!\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(num)
|
||||||
|
{
|
||||||
|
case 1: sprintf(RetCode,"%s",Value);
|
||||||
|
break;
|
||||||
|
case 2: sprintf(RetCode,"%s%s",Value,End);
|
||||||
|
break;
|
||||||
|
case 3: sprintf(RetCode,"%s%s",Begin,Value);
|
||||||
|
break;
|
||||||
|
case 4: sprintf(RetCode,"%s%s%s",Begin,Value,End);
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(Begin);
|
||||||
|
free(Var);
|
||||||
|
free(End);
|
||||||
|
|
||||||
|
if ((Var = strdup(RetCode)) == NULL ||
|
||||||
|
(End = strdup(RetCode)) == NULL ||
|
||||||
|
(Begin = strdup(RetCode)) == NULL )
|
||||||
|
{
|
||||||
|
print_msg("%s!\n","Can not alllocate memory!\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Begin[0] ='\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print_msg("Invalid variable `%s'!\n",Var);
|
||||||
|
free(RetCode);
|
||||||
|
RetCode = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(Begin);
|
||||||
|
free(Var);
|
||||||
|
free(End);
|
||||||
|
|
||||||
|
if ((Begin = RetCode) != NULL)
|
||||||
|
{
|
||||||
|
while (*Begin != '\0')
|
||||||
|
{
|
||||||
|
if (*Begin == 1)
|
||||||
|
*Begin = '$';
|
||||||
|
|
||||||
|
Begin++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return RetCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: libtools.h,v 1.3 1997/03/20 00:28:03 luethje Exp $
|
/* $Id: libtools.h,v 1.4 1997/04/10 23:32:35 luethje Exp $
|
||||||
*
|
*
|
||||||
* ISDN accounting for isdn4linux.
|
* ISDN accounting for isdn4linux.
|
||||||
*
|
*
|
||||||
|
@ -19,6 +19,9 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
* $Log: libtools.h,v $
|
* $Log: libtools.h,v $
|
||||||
|
* Revision 1.4 1997/04/10 23:32:35 luethje
|
||||||
|
* Added the feature, that environment variables are allowed in the config files.
|
||||||
|
*
|
||||||
* Revision 1.3 1997/03/20 00:28:03 luethje
|
* Revision 1.3 1997/03/20 00:28:03 luethje
|
||||||
* Inserted lines into the files for the revision tool.
|
* Inserted lines into the files for the revision tool.
|
||||||
*
|
*
|
||||||
|
@ -56,6 +59,8 @@ extern char *basename __P((__const char *__name));
|
||||||
#define QUOTE_IGNORE 0
|
#define QUOTE_IGNORE 0
|
||||||
#define QUOTE_DELETE 1
|
#define QUOTE_DELETE 1
|
||||||
|
|
||||||
|
#define C_QUOTE_CHAR '\\'
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
#define F_IGNORE_CASE 1024
|
#define F_IGNORE_CASE 1024
|
||||||
|
@ -89,6 +94,7 @@ _EXTERN int _delete_element(void ***elem, int deep);
|
||||||
_EXTERN int match(register char *p, register char *s, int flags);
|
_EXTERN int match(register char *p, register char *s, int flags);
|
||||||
_EXTERN int is_double (char *string, double *value);
|
_EXTERN int is_double (char *string, double *value);
|
||||||
_EXTERN int is_integer (char *string, long int *value);
|
_EXTERN int is_integer (char *string, long int *value);
|
||||||
|
_EXTERN char *Replace_Variable(char *String);
|
||||||
|
|
||||||
#undef _EXTERN
|
#undef _EXTERN
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ CONFIG_USERCONFFILE='~/.isdn'
|
||||||
CONFIG_COUNTRY_PREFIX='+'
|
CONFIG_COUNTRY_PREFIX='+'
|
||||||
CONFIG_AREA_PREFIX='0'
|
CONFIG_AREA_PREFIX='0'
|
||||||
CONFIG_COUNTRYCODE='49'
|
CONFIG_COUNTRYCODE='49'
|
||||||
CONFIG_AREACODE='040'
|
CONFIG_AREACODE=''
|
||||||
CONFIG_LIB_AREACODE=y
|
CONFIG_LIB_AREACODE=y
|
||||||
CONFIG_AREACODE_DATA='/usr/lib/isdn'
|
CONFIG_AREACODE_DATA='/usr/lib/isdn'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue