inserted the line #include <errno.h> in avmb1/avmcapictrl.c and imon/imon.c,
some bugfixes, new structure in isdnlog/isdnrep/isdnrep.c.
This commit is contained in:
parent
4fe31b8de1
commit
3d80500d19
|
@ -1,11 +1,15 @@
|
||||||
/*
|
/*
|
||||||
* $Id: avmcapictrl.c,v 1.1 1997/03/04 22:46:32 calle Exp $
|
* $Id: avmcapictrl.c,v 1.2 1997/03/20 00:18:57 luethje Exp $
|
||||||
*
|
*
|
||||||
* AVM-B1-ISDN driver for Linux. (Control-Utility)
|
* AVM-B1-ISDN driver for Linux. (Control-Utility)
|
||||||
*
|
*
|
||||||
* Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
|
* Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
|
||||||
*
|
*
|
||||||
* $Log: avmcapictrl.c,v $
|
* $Log: avmcapictrl.c,v $
|
||||||
|
* Revision 1.2 1997/03/20 00:18:57 luethje
|
||||||
|
* inserted the line #include <errno.h> in avmb1/avmcapictrl.c and imon/imon.c,
|
||||||
|
* some bugfixes, new structure in isdnlog/isdnrep/isdnrep.c.
|
||||||
|
*
|
||||||
* Revision 1.1 1997/03/04 22:46:32 calle
|
* Revision 1.1 1997/03/04 22:46:32 calle
|
||||||
* Added program to add and download firmware to AVM-B1 card
|
* Added program to add and download firmware to AVM-B1 card
|
||||||
*
|
*
|
||||||
|
@ -18,6 +22,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
|
@ -1,14 +1,20 @@
|
||||||
/* $Id: imon.c,v 1.1 1997/02/17 00:09:03 fritz Exp $
|
/* $Id: imon.c,v 1.2 1997/03/20 00:19:01 luethje Exp $
|
||||||
*
|
*
|
||||||
* iMON , extended version.
|
* iMON , extended version.
|
||||||
* original iMON source (c) Michael Knigge
|
* original iMON source (c) Michael Knigge
|
||||||
* heavily modified and extended by Fritz Elfert
|
* heavily modified and extended by Fritz Elfert
|
||||||
*
|
*
|
||||||
* $Log: imon.c,v $
|
* $Log: imon.c,v $
|
||||||
|
* Revision 1.2 1997/03/20 00:19:01 luethje
|
||||||
|
* inserted the line #include <errno.h> in avmb1/avmcapictrl.c and imon/imon.c,
|
||||||
|
* some bugfixes, new structure in isdnlog/isdnrep/isdnrep.c.
|
||||||
|
*
|
||||||
* Revision 1.1 1997/02/17 00:09:03 fritz
|
* Revision 1.1 1997/02/17 00:09:03 fritz
|
||||||
* New CVS tree
|
* New CVS tree
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -756,6 +756,7 @@ folgen. Das gleiche gilt fuer die Sektionen innerhalb einer Datei.
|
||||||
Im folgenden werden nun die einzelnen Eintraege unter den Sektionen MSN
|
Im folgenden werden nun die einzelnen Eintraege unter den Sektionen MSN
|
||||||
und NUMBER erwaehnt:
|
und NUMBER erwaehnt:
|
||||||
|
|
||||||
|
******** Was ist das? *************
|
||||||
MSN Alias Zone Interface Info-Args
|
MSN Alias Zone Interface Info-Args
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
4711,1 Phone 1 - IORA=auplay dingdong.au,,18-21;
|
4711,1 Phone 1 - IORA=auplay dingdong.au,,18-21;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: isdnrep.c,v 1.1 1997/03/16 20:59:05 luethje Exp $
|
/* $Id: isdnrep.c,v 1.2 1997/03/20 00:19:13 luethje Exp $
|
||||||
*
|
*
|
||||||
* ISDN accounting for isdn4linux. (Report-module)
|
* ISDN accounting for isdn4linux. (Report-module)
|
||||||
*
|
*
|
||||||
|
@ -19,6 +19,10 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
* $Log: isdnrep.c,v $
|
* $Log: isdnrep.c,v $
|
||||||
|
* Revision 1.2 1997/03/20 00:19:13 luethje
|
||||||
|
* inserted the line #include <errno.h> in avmb1/avmcapictrl.c and imon/imon.c,
|
||||||
|
* some bugfixes, new structure in isdnlog/isdnrep/isdnrep.c.
|
||||||
|
*
|
||||||
* Revision 1.1 1997/03/16 20:59:05 luethje
|
* Revision 1.1 1997/03/16 20:59:05 luethje
|
||||||
* Added the source code isdnlog. isdnlog is not working yet.
|
* Added the source code isdnlog. isdnlog is not working yet.
|
||||||
* A workaround for that problem:
|
* A workaround for that problem:
|
||||||
|
@ -116,6 +120,15 @@
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define C_DELIM '|'
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define print_msg(a,b) print_string(b,a)
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static int read_logfile(char *myname);
|
||||||
static time_t get_month(char *String, int TimeStatus);
|
static time_t get_month(char *String, int TimeStatus);
|
||||||
static time_t get_time(char *String, int TimeStatus);
|
static time_t get_time(char *String, int TimeStatus);
|
||||||
static int get_term (char *String, time_t *Begin, time_t *End,int delentries);
|
static int get_term (char *String, time_t *Begin, time_t *End,int delentries);
|
||||||
|
@ -165,46 +178,27 @@ static char *lfnam = LOGFILE;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static int incomingonly = 0;
|
||||||
|
static int outgoingonly = 0;
|
||||||
|
static int verbose = 0;
|
||||||
|
static int timearea = 0, phonenumberonly = 0;
|
||||||
|
static int compute = 0;
|
||||||
|
static time_t begintime, endtime;
|
||||||
|
static int delentries = 0;
|
||||||
|
static int numbers = 0;
|
||||||
|
static char timestring[256] = "";
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
int main(int argc, char *argv[], char *envp[])
|
int main(int argc, char *argv[], char *envp[])
|
||||||
{
|
{
|
||||||
register char *p, *p1, *p2;
|
auto char tmp_string[256];
|
||||||
register int i, j, k, n, cc;
|
auto int c;
|
||||||
auto FILE *fi, *ftmp = NULL;
|
auto char *myname = basename(argv[0]);
|
||||||
auto char string[BUFSIZ], s[BUFSIZ], s1[BUFSIZ];
|
|
||||||
auto char start[20], stop[20], timestring[256] = "";
|
|
||||||
auto char tmp_string[256];
|
|
||||||
auto char tmpfile[256];
|
|
||||||
auto int hit, lday = -1;
|
|
||||||
auto double restdm = 0.0;
|
|
||||||
auto int computed, go, zone = 1;
|
|
||||||
auto int compute = 0, zeit;
|
|
||||||
extern int errno;
|
|
||||||
auto time_t now, from = (time_t)0;
|
|
||||||
auto time_t begintime, endtime;
|
|
||||||
auto double t1, t2, takt;
|
|
||||||
auto struct tm *tm;
|
|
||||||
auto double einheit = 0.23;
|
|
||||||
auto int nx[2];
|
|
||||||
auto int Tarif96 = 0, Tarif962 = 0, c, notforus, resteh = 0;
|
|
||||||
auto double restdur = 0.0, restidur = 0.0;
|
|
||||||
auto int numbers = 0, restusage = 0;
|
|
||||||
auto int restiusage = 0;
|
|
||||||
auto int verbose = 0;
|
|
||||||
auto int timearea = 0, phonenumberonly = 0;
|
|
||||||
auto int delentries = 0;
|
|
||||||
auto int incomingonly = 0;
|
|
||||||
auto int outgoingonly = 0;
|
|
||||||
one_call cur_call;
|
|
||||||
sum_calls day_sum, day_com_sum, all_sum, all_com_sum, tmp_sum;
|
|
||||||
char *myname = basename(argv[0]);
|
|
||||||
|
|
||||||
|
|
||||||
set_print_fct_for_tools(printf);
|
set_print_fct_for_tools(printf);
|
||||||
|
|
||||||
clear_sum(&day_sum);
|
|
||||||
clear_sum(&day_com_sum);
|
|
||||||
clear_sum(&all_sum);
|
|
||||||
clear_sum(&all_com_sum);
|
|
||||||
|
|
||||||
use_new_config = 1;
|
use_new_config = 1;
|
||||||
|
|
||||||
|
@ -215,7 +209,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'a' : timearea++;
|
case 'a' : timearea++;
|
||||||
begintime = 0;
|
begintime = 0;
|
||||||
time(&endtime);
|
time(&endtime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c' : compute = strtol(optarg, NIL, 0);
|
case 'c' : compute = strtol(optarg, NIL, 0);
|
||||||
|
@ -267,22 +261,60 @@ int main(int argc, char *argv[], char *envp[])
|
||||||
if (readconfig(myname) != 0)
|
if (readconfig(myname) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
return (read_logfile(myname) == 0?1:0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static int read_logfile(char *myname)
|
||||||
|
{
|
||||||
|
auto int Tarif96 = 0, Tarif962 = 0, notforus, resteh = 0;
|
||||||
|
auto double restdur = 0.0, restidur = 0.0;
|
||||||
|
auto int restiusage = 0;
|
||||||
|
auto double einheit = 0.23;
|
||||||
|
auto int nx[2];
|
||||||
|
auto time_t now, from = (time_t)0;
|
||||||
|
auto double t1, t2, takt;
|
||||||
|
auto struct tm *tm;
|
||||||
|
auto int computed, go, zone = 1;
|
||||||
|
auto double restdm = 0.0;
|
||||||
|
auto int hit, lday = -1;
|
||||||
|
auto char tmp_string[256];
|
||||||
|
auto char start[20], stop[20];
|
||||||
|
auto char* tmpfile = NULL;
|
||||||
|
auto FILE *fi, *ftmp = NULL;
|
||||||
|
auto char string[BUFSIZ], s[BUFSIZ], s1[BUFSIZ];
|
||||||
|
register char *p = NULL, *p1, *p2;
|
||||||
|
register int i, j, k, n, cc;
|
||||||
|
auto int zeit;
|
||||||
|
auto int restusage = 0;
|
||||||
|
auto char** array;
|
||||||
|
one_call cur_call;
|
||||||
|
sum_calls day_sum, day_com_sum, all_sum, all_com_sum, tmp_sum;
|
||||||
|
|
||||||
|
|
||||||
|
clear_sum(&day_sum);
|
||||||
|
clear_sum(&day_com_sum);
|
||||||
|
clear_sum(&all_sum);
|
||||||
|
clear_sum(&all_com_sum);
|
||||||
|
|
||||||
if (delentries)
|
if (delentries)
|
||||||
if(begintime)
|
if(begintime)
|
||||||
{
|
{
|
||||||
sprintf(tmp_string, wrongdate2, timestring);
|
sprintf(tmp_string, wrongdate2, timestring);
|
||||||
print_string(tmp_string,ERROUT);
|
print_string(tmp_string,ERROUT);
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(tmpfile,"/tmp/isdnrep%d",getpid());
|
if ((tmpfile = tmpnam(NULL)) == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if ((ftmp = fopen(tmpfile, "w")) == (FILE *)NULL)
|
if ((ftmp = fopen(tmpfile, "w")) == (FILE *)NULL)
|
||||||
{
|
{
|
||||||
sprintf(tmp_string, msg1, tmpfile, strerror(errno));
|
sprintf(tmp_string, msg1, tmpfile, strerror(errno));
|
||||||
print_string(tmp_string,ERROUT);
|
print_string(tmp_string,ERROUT);
|
||||||
return(1);
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,6 +338,33 @@ int main(int argc, char *argv[], char *envp[])
|
||||||
while (fgets(s, BUFSIZ, fi)) {
|
while (fgets(s, BUFSIZ, fi)) {
|
||||||
strcpy(string,s);
|
strcpy(string,s);
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (*s == '#')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((array = String_to_Array(p,C_DELIM)) == NULL)
|
||||||
|
{
|
||||||
|
print_msg(ERROUT,"Can not allocate memory!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (array[0] == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
cur_call.eh = notforus = 0;
|
||||||
|
cur_call.dir = -1;
|
||||||
|
cur_call.cause = -1;
|
||||||
|
cur_call.ibytes = cur_call.obytes = 0L;
|
||||||
|
cur_call.version = 0.0;
|
||||||
|
cur_call.si = cur_call.si1 = 0;
|
||||||
|
|
||||||
|
if (array[1] == NULL || array[2] == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
strcpy(cur_call.num[0], Kill_Blanks(array[1]));
|
||||||
|
strcpy(cur_call.num[1], Kill_Blanks(array[2]));
|
||||||
|
*/
|
||||||
|
|
||||||
if ((*s != '#') && (p = strchr(s, '|'))) {
|
if ((*s != '#') && (p = strchr(s, '|'))) {
|
||||||
/* hier wird das erste Trennzeichen gesucht */
|
/* hier wird das erste Trennzeichen gesucht */
|
||||||
|
|
||||||
|
@ -314,7 +373,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||||
cur_call.cause = -1;
|
cur_call.cause = -1;
|
||||||
/* Zeigt die Gespraechsrichtung an: rein oder raus */
|
/* Zeigt die Gespraechsrichtung an: rein oder raus */
|
||||||
cur_call.ibytes = cur_call.obytes = 0L;
|
cur_call.ibytes = cur_call.obytes = 0L;
|
||||||
cur_call.version = 0.0;
|
cur_call.version = 0.0;
|
||||||
cur_call.si = cur_call.si1 = 0;
|
cur_call.si = cur_call.si1 = 0;
|
||||||
|
|
||||||
if ((p1 = p2 = strchr(p + 1, '|'))) {
|
if ((p1 = p2 = strchr(p + 1, '|'))) {
|
||||||
|
@ -398,7 +457,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||||
} /* if */
|
} /* if */
|
||||||
} /* if */
|
} /* if */
|
||||||
} /* if */
|
} /* if */
|
||||||
} /* if */
|
} /* if */
|
||||||
} /* if */
|
} /* if */
|
||||||
} /* if */
|
} /* if */
|
||||||
} /* if */
|
} /* if */
|
||||||
|
@ -560,7 +619,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||||
unknown[i].connects++;
|
unknown[i].connects++;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(tmp_string, "%s: WARNING: Too many unknown connection's from %s\n", argv[0], unknown[i].num);
|
sprintf(tmp_string, "%s: WARNING: Too many unknown connection's from %s\n", myname, unknown[i].num);
|
||||||
print_string(tmp_string,ERROUT);
|
print_string(tmp_string,ERROUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +628,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||||
unknowns++;
|
unknowns++;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(tmp_string, "%s: WARNING: Too many unknown number's\n", argv[0]);
|
sprintf(tmp_string, "%s: WARNING: Too many unknown number's\n", myname);
|
||||||
print_string(tmp_string,ERROUT);
|
print_string(tmp_string,ERROUT);
|
||||||
}
|
}
|
||||||
} /* if */
|
} /* if */
|
||||||
|
@ -691,7 +750,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||||
takt = cheap((time_t)t1, zone);
|
takt = cheap((time_t)t1, zone);
|
||||||
|
|
||||||
if (!takt) {
|
if (!takt) {
|
||||||
sprintf(tmp_string, "%s: OOPS! Abbruch: Zeittakt==0 ???\n", argv[0]);
|
sprintf(tmp_string, "%s: OOPS! Abbruch: Zeittakt==0 ???\n", myname);
|
||||||
print_string(tmp_string,ERROUT);
|
print_string(tmp_string,ERROUT);
|
||||||
break;
|
break;
|
||||||
} /* if */
|
} /* if */
|
||||||
|
@ -953,9 +1012,9 @@ int main(int argc, char *argv[], char *envp[])
|
||||||
} /* if */
|
} /* if */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sprintf(tmp_string, msg1, argv[0], lfnam, strerror(errno));
|
sprintf(tmp_string, msg1, myname, lfnam, strerror(errno));
|
||||||
print_string(tmp_string,ERROUT);
|
print_string(tmp_string,ERROUT);
|
||||||
return(1);
|
return -1;
|
||||||
} /* else */
|
} /* else */
|
||||||
|
|
||||||
|
|
||||||
|
@ -967,13 +1026,13 @@ int main(int argc, char *argv[], char *envp[])
|
||||||
{
|
{
|
||||||
sprintf(tmp_string, msg1, tmpfile, strerror(errno));
|
sprintf(tmp_string, msg1, tmpfile, strerror(errno));
|
||||||
print_string(tmp_string,ERROUT);
|
print_string(tmp_string,ERROUT);
|
||||||
return(1);
|
return -1;
|
||||||
}
|
}
|
||||||
if ((fi = fopen(lfnam, "w")) == (FILE *)NULL)
|
if ((fi = fopen(lfnam, "w")) == (FILE *)NULL)
|
||||||
{
|
{
|
||||||
sprintf(tmp_string, msg1, lfnam, strerror(errno));
|
sprintf(tmp_string, msg1, lfnam, strerror(errno));
|
||||||
print_string(tmp_string,ERROUT);
|
print_string(tmp_string,ERROUT);
|
||||||
return(1);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fgets(s, BUFSIZ, ftmp))
|
while (fgets(s, BUFSIZ, ftmp))
|
||||||
|
@ -985,8 +1044,8 @@ int main(int argc, char *argv[], char *envp[])
|
||||||
unlink(tmpfile);
|
unlink(tmpfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
} /* main */
|
} /* read_logfile */
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: tools.h,v 1.2 1997/03/17 23:21:08 luethje Exp $
|
/* $Id: tools.h,v 1.3 1997/03/20 00:19:18 luethje Exp $
|
||||||
*
|
*
|
||||||
* ISDN accounting for isdn4linux.
|
* ISDN accounting for isdn4linux.
|
||||||
*
|
*
|
||||||
|
@ -19,6 +19,10 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
* $Log: tools.h,v $
|
* $Log: tools.h,v $
|
||||||
|
* Revision 1.3 1997/03/20 00:19:18 luethje
|
||||||
|
* inserted the line #include <errno.h> in avmb1/avmcapictrl.c and imon/imon.c,
|
||||||
|
* some bugfixes, new structure in isdnlog/isdnrep/isdnrep.c.
|
||||||
|
*
|
||||||
* Revision 1.2 1997/03/17 23:21:08 luethje
|
* Revision 1.2 1997/03/17 23:21:08 luethje
|
||||||
* README completed, new funktion Compare_Sections() written, "GNU_SOURCE 1"
|
* README completed, new funktion Compare_Sections() written, "GNU_SOURCE 1"
|
||||||
* added to tools.h and a sample file added.
|
* added to tools.h and a sample file added.
|
||||||
|
@ -81,7 +85,7 @@
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
#define GNU_SOURCE 1
|
#define GNU_SOURCE
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -74,7 +74,7 @@ entry2 = blabla2
|
||||||
# sein.
|
# sein.
|
||||||
Entry3 = {
|
Entry3 = {
|
||||||
# ^----- Dieses Zeichen besagt, das dieser Eintrag ein oder mehrere
|
# ^----- Dieses Zeichen besagt, das dieser Eintrag ein oder mehrere
|
||||||
# Untersectionen beinhaltet. Es MUSS in der gleichen Zeile
|
# Untersektionen beinhaltet. Es MUSS in der gleichen Zeile
|
||||||
# stehen, wie der Eintragsnamen und das Gleichheitszeichen.
|
# stehen, wie der Eintragsnamen und das Gleichheitszeichen.
|
||||||
# ^^^^^^--------- "Entry3", "entry3" und "ENTRY3" sind equivalent!
|
# ^^^^^^--------- "Entry3", "entry3" und "ENTRY3" sind equivalent!
|
||||||
[SUBSECTION1]
|
[SUBSECTION1]
|
||||||
|
@ -118,5 +118,6 @@ Dann wird nach der Datei /etc/myinclude gesucht. Es ist voellig
|
||||||
unabhaengig davon, in welchem Verzeichnis das Programm gestartet wurde,
|
unabhaengig davon, in welchem Verzeichnis das Programm gestartet wurde,
|
||||||
das die Konfigurationsdatei lesen soll.
|
das die Konfigurationsdatei lesen soll.
|
||||||
|
|
||||||
|
ACHTUNG:
|
||||||
Wenn Dateien rekursiv eingebunden werden, fuehrt dieses mit Sicherheit
|
Wenn Dateien rekursiv eingebunden werden, fuehrt dieses mit Sicherheit
|
||||||
zum Absturz des Programmes. Dieses wird von der Library nicht verhindert.
|
zum Absturz des Programmes. Dieses wird von der Library nicht verhindert.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
|
/* $Id: conffile.c,v 1.7 1997/03/20 00:19:24 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)
|
||||||
|
@ -22,6 +21,8 @@
|
||||||
|
|
||||||
#define _CONFFILE_C_
|
#define _CONFFILE_C_
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -184,17 +185,15 @@ section *read_file(section *Section, const char *FileName, int Flags)
|
||||||
|
|
||||||
static section *Read_Lines(section *Section, FILE *fp, const char *FileName, int *Line, int Flags)
|
static section *Read_Lines(section *Section, FILE *fp, const char *FileName, int *Line, int Flags)
|
||||||
{
|
{
|
||||||
|
static int InSubSection = 0;
|
||||||
char String[BUFSIZ];
|
char String[BUFSIZ];
|
||||||
char *Sectionname, *Variable, *Value;
|
char *Sectionname, *Variable, *Value;
|
||||||
int Res;
|
int Res;
|
||||||
int InSubSection = 0;
|
|
||||||
section *Ptr = Section;
|
section *Ptr = Section;
|
||||||
|
|
||||||
|
|
||||||
while (FGets(String, BUFSIZ, fp, Line) != NULL)
|
while (FGets(String, BUFSIZ, fp, Line) != NULL)
|
||||||
{
|
{
|
||||||
InSubSection = 0;
|
|
||||||
|
|
||||||
if ((Sectionname = Find_Section(String)) != NULL)
|
if ((Sectionname = Find_Section(String)) != NULL)
|
||||||
{
|
{
|
||||||
if ((Ptr = Set_Section(&Section,Sectionname,C_OVERWRITE | C_WARN | Flags)) == NULL)
|
if ((Ptr = Set_Section(&Section,Sectionname,C_OVERWRITE | C_WARN | Flags)) == NULL)
|
||||||
|
@ -226,12 +225,15 @@ static section *Read_Lines(section *Section, FILE *fp, const char *FileName, int
|
||||||
{
|
{
|
||||||
if (*Value == C_BEGIN_SUBSECTION && Not_Space(Value+1) == NULL)
|
if (*Value == C_BEGIN_SUBSECTION && Not_Space(Value+1) == NULL)
|
||||||
{
|
{
|
||||||
InSubSection = 1;
|
InSubSection++;
|
||||||
|
Set_SubSection(Ptr,Variable,Read_Lines(NULL,fp,FileName,Line,Flags),C_OVERWRITE | C_WARN);
|
||||||
|
/*
|
||||||
if (Set_SubSection(Ptr,Variable,Read_Lines(NULL,fp,FileName,Line,Flags),C_OVERWRITE | C_WARN) == NULL)
|
if (Set_SubSection(Ptr,Variable,Read_Lines(NULL,fp,FileName,Line,Flags),C_OVERWRITE | C_WARN) == NULL)
|
||||||
{
|
{
|
||||||
free_section(Section);
|
free_section(Section);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (Set_Entry(Ptr,NULL,Variable,Value,C_OVERWRITE | C_WARN) == NULL)
|
if (Set_Entry(Ptr,NULL,Variable,Value,C_OVERWRITE | C_WARN) == NULL)
|
||||||
|
@ -243,15 +245,19 @@ static section *Read_Lines(section *Section, FILE *fp, const char *FileName, int
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (Res == -1 && *(Kill_Blanks(String)) == C_END_SUBSECTION)
|
if (Res == -1 && *(Kill_Blanks(String)) == C_END_SUBSECTION)
|
||||||
|
{
|
||||||
|
InSubSection--;
|
||||||
return Section;
|
return Section;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if (Res == -1)
|
if (Res == -1)
|
||||||
print_msg("Error in file `%s', line %d: there is no valid token!\n",FileName,*Line);
|
print_msg("Error in file `%s', line %d: there is no valid token!\n",FileName,*Line);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InSubSection == 1)
|
if (InSubSection != 0)
|
||||||
{
|
{
|
||||||
print_msg("Error in file `%s': Missing a `%c'!\n",FileName,C_END_SUBSECTION);
|
print_msg("Error in file `%s': Missing a `%c'!\n",FileName,C_END_SUBSECTION);
|
||||||
|
free_section(Section);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: isdntools.c,v 1.6 1997/03/19 00:08:43 luethje Exp $
|
/* $Id: isdntools.c,v 1.7 1997/03/20 00:19:27 luethje Exp $
|
||||||
*
|
*
|
||||||
* ISDN accounting for isdn4linux. (Utilities)
|
* ISDN accounting for isdn4linux. (Utilities)
|
||||||
*
|
*
|
||||||
|
@ -19,6 +19,10 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
* $Log: isdntools.c,v $
|
* $Log: isdntools.c,v $
|
||||||
|
* Revision 1.7 1997/03/20 00:19:27 luethje
|
||||||
|
* inserted the line #include <errno.h> in avmb1/avmcapictrl.c and imon/imon.c,
|
||||||
|
* some bugfixes, new structure in isdnlog/isdnrep/isdnrep.c.
|
||||||
|
*
|
||||||
* Revision 1.6 1997/03/19 00:08:43 luethje
|
* Revision 1.6 1997/03/19 00:08:43 luethje
|
||||||
* README and function expand_number() completed.
|
* README and function expand_number() completed.
|
||||||
*
|
*
|
||||||
|
@ -86,6 +90,7 @@
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -711,7 +716,7 @@ int read_conffiles(section **Section, char *groupfile)
|
||||||
if (!read_again)
|
if (!read_again)
|
||||||
delete_element(&files,0);
|
delete_element(&files,0);
|
||||||
|
|
||||||
delete_element(&vars,1);
|
delete_element(&vars,0);
|
||||||
|
|
||||||
read_again = 1;
|
read_again = 1;
|
||||||
return RetCode;
|
return RetCode;
|
||||||
|
@ -728,6 +733,9 @@ int paranoia_check(char *cmd)
|
||||||
{
|
{
|
||||||
if (stat(cmd, &stbuf))
|
if (stat(cmd, &stbuf))
|
||||||
{
|
{
|
||||||
|
if (errno == ENOENT)
|
||||||
|
return 0;
|
||||||
|
|
||||||
print_msg("stat() failed for file `%s', stay on the safe side!\n", cmd);
|
print_msg("stat() failed for file `%s', stay on the safe side!\n", cmd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue