some bugfixes, README completed

This commit is contained in:
luethje 1997-04-16 22:22:43 +00:00
parent bfe3a6891d
commit 811bd4b9b6
7 changed files with 188 additions and 24 deletions

View File

@ -1,4 +1,4 @@
## $Id: Makefile.in,v 1.13 1997/04/15 22:36:58 luethje Exp $
## $Id: Makefile.in,v 1.14 1997/04/16 22:22:43 luethje Exp $
##
## ISDN accounting for isdn4linux.
##
@ -19,6 +19,9 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Log: Makefile.in,v $
## Revision 1.14 1997/04/16 22:22:43 luethje
## some bugfixes, README completed
##
## Revision 1.13 1997/04/15 22:36:58 luethje
## allows the character `"' in the program argument like the shell.
## some bugfixes.
@ -173,7 +176,7 @@ SERVICEFILE = /etc/services
# DON'T EDIT BELOW THIS LINE
######################################################################
VERSION = 2.99.9
VERSION = 2.99.10
ifeq ($(POSTGRES),1)
DEFS += -DPOSTGRES

View File

@ -1370,15 +1370,26 @@ Es gibt aber drei zusaetzliche Variablen, die verwendet werden duerfen:
\$2 : Gibt als String die Telefonnummer (mit Vorwahl) des Anrufenden an.
\$3 : Gibt als String die Telefonnummer (mit Vorwahl) des Angerufenden an.
Es ist zu beachten, dass hier das Zeichen "$" gequotet werden muss,
da dieses sonst zu einem Warning fuehrt!
Wenn bei "\$2" und "\$3" die Telefonnummer nicht bekannt ist, dann wird dort
ein "?" eingesetzt.
Es fallen also alle Blanks und Tabulatoren vor und nach dem "=" heraus.
"IORK = /bin/auplay..." wird also zu "IORK=/bin/auplay...".
Folgende Punkte sind zu beachten:
- Diese Variablen koennen auch innerhalb eines Argumentes stehen.
- Wenn diese Variablen innerhalb eines Strings verwendet werden, muss der
Name (hier z.B. "1", "2") in geschweiften Klammern gesetzt werden.
- Es koennen wie auf der Shell die Hochkommata verwendet werden, um Argumente
zu kapseln (allderings nur die Hochkommata!). Wenn das Hochkomma im
Argument erscheinen soll, muss es gequotet werden.
Beispiele:
PROGRAM=/bin/auplay "Arg 1" "Arg 2" Arg3 "Arg\"4"
PROGRAM=/bin/auplay "Hier kommt der Anrufer:\${2}test"
PROGRAM=/bin/auplay "Der folgende Ausdruck wird nicht ausgewertet: \\$3"
Eine (zwei) Section [NUMBER] (oder [MSN]) kann also wie folgt aussehen:

View File

@ -1,4 +1,4 @@
/* $Id: start_prog.c,v 1.4 1997/04/15 22:37:10 luethje Exp $
/* $Id: start_prog.c,v 1.5 1997/04/16 22:22:51 luethje Exp $
*
* ISDN accounting for isdn4linux.
*
@ -20,6 +20,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: start_prog.c,v $
* Revision 1.5 1997/04/16 22:22:51 luethje
* some bugfixes, README completed
*
* Revision 1.4 1997/04/15 22:37:10 luethje
* allows the character `"' in the program argument like the shell.
* some bugfixes.
@ -58,6 +61,9 @@
#define C_TAB '\t'
#define C_SPACE ' '
#define C_AT '@'
#define S_AT "@"
/*************************************************************************/
@ -271,7 +277,7 @@ static int GetArgs(char *Line, char *Args[], char *Opts[], int MaxArgs)
MemPtr[j] = NULL;
}
if (*Arg == '@')
if (*Arg == C_AT)
{
FILE *fp = fopen(Arg+1,"r");
@ -301,11 +307,9 @@ static int GetArgs(char *Line, char *Args[], char *Opts[], int MaxArgs)
Arg = "?";
}
/*
Ptr = Arg;
while((Ptr = Check_Quote(Ptr, S_QUOTES, QUOTE_DELETE)) != NULL && Ptr[0] != '\0')
while((Ptr = Check_Quote(Ptr, S_AT, QUOTE_DELETE)) != NULL && Ptr[0] != '\0')
Ptr++;
*/
if (i < MaxArgs) Args[i++] = Arg;
}
@ -379,7 +383,6 @@ static char *Replace_Opts(char *String, char *Opts[], int MaxOpts)
char *Begin = NULL;
char *Var = NULL;
char *End = NULL;
char *Value = NULL;
char *Ptr = String;
int cnt = 0;
int num = 0;
@ -433,7 +436,7 @@ static char *Replace_Opts(char *String, char *Opts[], int MaxOpts)
Begin[Ptr-RetCode] = '\0';
if ((RetCode = (char*) realloc(RetCode,sizeof(char)*strlen(RetCode)+strlen(Value)-strlen(Var))) == NULL)
if ((RetCode = (char*) realloc(RetCode,sizeof(char)*strlen(RetCode)+strlen(Opts[Num-1])-strlen(Var))) == NULL)
{
print_msg(PRT_ERR,"%s!\n","Error: Can not allocate memory!\n");
return NULL;

View File

@ -1,4 +1,4 @@
/* $Id: isdnrep.c,v 1.9 1997/04/08 21:56:53 luethje Exp $
/* $Id: isdnrep.c,v 1.10 1997/04/16 22:22:57 luethje Exp $
*
* ISDN accounting for isdn4linux. (Report-module)
*
@ -20,6 +20,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnrep.c,v $
* Revision 1.10 1997/04/16 22:22:57 luethje
* some bugfixes, README completed
*
* Revision 1.9 1997/04/08 21:56:53 luethje
* Create the file isdn.conf
* some bug fixes for pid and lock file
@ -145,6 +148,22 @@
/*****************************************************************************/
#define C_BEGIN_FMT '%'
#define FMT_FMT 1
#define FMT_STR 2
/*****************************************************************************/
typedef struct {
int type;
char *string;
char s_type;
char *range;
} prt_fmt;
/*****************************************************************************/
static time_t get_month(char *String, int TimeStatus);
static time_t get_time(char *String, int TimeStatus);
static int show_msn(one_call *cur_call);
@ -162,6 +181,7 @@ static int print_entries(one_call *cur_call, double unit, int *nx, char *myname)
static int print_bottom(double unit, char *start, char *stop);
static char *get_time_value(time_t t, int *day, int flag);
static char **string_to_array(char *string);
static prt_fmt** get_format(char *format);
/*****************************************************************************/
@ -220,6 +240,11 @@ int read_logfile(char *myname)
one_call cur_call;
/*
get_format(lineformat);
exit(0);
*/
clear_sum(&day_sum);
clear_sum(&day_com_sum);
clear_sum(&all_sum);
@ -534,6 +559,118 @@ static int print_bottom(double unit, char *start, char *stop)
/*****************************************************************************/
static int print_line(int flags, char *format)
{
return 0;
}
/*****************************************************************************/
static prt_fmt** get_format(char *format)
{
static prt_fmt **RetCode = NULL;
prt_fmt *fmt = NULL;
char *Ptr = NULL;
char *string = NULL;
char *start = NULL;
char *End = NULL;
char Range[20] = "";
int num;
char Type;
if (format == NULL)
return RetCode;
if ((End = (char*) alloca(sizeof(char)*(strlen(format)+1))) == NULL ||
(string = (char*) alloca(sizeof(char)*(strlen(format)+1))) == NULL )
{
print_msg(PRT_ERR, nomemory);
return NULL;
}
Ptr = start = strcpy(string,format);
do
{
if (*Ptr == C_BEGIN_FMT)
{
if (Ptr[1] != C_BEGIN_FMT)
{
if (Ptr != start)
{
if ((fmt = (prt_fmt*) calloc(1,sizeof(prt_fmt))) == NULL)
{
print_msg(PRT_ERR, nomemory);
delete_element(&RetCode,0);
return NULL;
}
*Ptr = '\0';
fmt->string= strdup(start);
fmt->type = FMT_STR;
append_element(&RetCode,fmt);
}
*End = '\0';
if ((num = sscanf(Ptr+1,"%[^a-zA-Z]%c%[^\n]",Range,&Type,End)) > 1 ||
(num = sscanf(Ptr+1,"%c%[^\n]",&Type,End)) > 0 )
{
if ((fmt = (prt_fmt*) calloc(1,sizeof(prt_fmt))) == NULL)
{
print_msg(PRT_ERR, nomemory);
delete_element(&RetCode,0);
return NULL;
}
fmt->s_type= Type;
fmt->range = strdup(Range);
fmt->type = FMT_FMT;
append_element(&RetCode,fmt);
*Range = '\0';
if (*End != '\0')
Ptr = start = strcpy(string,End);
else
Ptr = start = "";
}
else
{
print_msg(PRT_ERR, "Error: Invalid token in format string `%s'!\n",format);
return NULL;
}
}
else
{
memmove(Ptr,Ptr+1,strlen(Ptr));
Ptr++;
}
}
else
Ptr++;
}
while(*Ptr != '\0');
if (Ptr != start)
{
if ((fmt = (prt_fmt*) calloc(1,sizeof(prt_fmt))) == NULL)
{
print_msg(PRT_ERR, nomemory);
delete_element(&RetCode,0);
return NULL;
}
fmt->string= strdup(start);
fmt->type = FMT_STR;
append_element(&RetCode,fmt);
}
return RetCode;
}
/*****************************************************************************/
static int print_entries(one_call *cur_call, double unit, int *nx, char *myname)
{
auto time_t t1, t2;
@ -551,8 +688,8 @@ static int print_entries(one_call *cur_call, double unit, int *nx, char *myname)
if (cur_call->pay && !cur_call->eh)
/* Falls Betrag vorhanden und Einheiten nicht, Einheiten berechnen */
cur_call->eh = cur_call->pay/unit;
else if (cur_call->currency_factor &&
cur_call->currency_factor != unit && cur_call->eh>0 )
else if (cur_call->currency_factor &&
cur_call->currency_factor != unit && cur_call->eh>0 )
/* Falls Einheiten sich auf anderen Einheiten-Faktor beziehen, Einheiten korrigieren */
cur_call->eh /= unit / cur_call->currency_factor;
@ -817,8 +954,7 @@ static int set_alias(one_call *cur_call, int *nx, char *myname)
if (cc) {
if (!numbers)
strcpy(cur_call->num[n], known[i]->who);
strcpy(cur_call->who[n], known[i]->who);
nx[n] = i;
@ -895,6 +1031,8 @@ static int set_caller_infos(one_call *cur_call, char *string, time_t from)
cur_call->pay = 0.0;
cur_call->si = cur_call->si1 = 0;
cur_call->dir = DIALOUT;
cur_call->who[0][0] = '\0';
cur_call->who[1][0] = '\0';
for (i = 1; array[i] != NULL; i++)
{

View File

@ -1,4 +1,4 @@
/* $Id: isdnrep.h,v 1.4 1997/04/03 22:30:03 luethje Exp $
/* $Id: isdnrep.h,v 1.5 1997/04/16 22:23:00 luethje Exp $
*
* ISDN accounting for isdn4linux.
*
@ -20,6 +20,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnrep.h,v $
* Revision 1.5 1997/04/16 22:23:00 luethje
* some bugfixes, README completed
*
* Revision 1.4 1997/04/03 22:30:03 luethje
* improved performance
*
@ -92,6 +95,7 @@ _EXTERN int delentries _SET_0;
_EXTERN int numbers _SET_0;
_EXTERN int header _SET_1;
_EXTERN char timestring[256] _SET_EMPTY;
_EXTERN char *lineformat _SET_NULL;
_EXTERN time_t begintime;
_EXTERN time_t endtime;

View File

@ -1,4 +1,4 @@
/* $Id: tools.c,v 1.6 1997/04/08 21:56:59 luethje Exp $
/* $Id: tools.c,v 1.7 1997/04/16 22:23:04 luethje Exp $
*
* ISDN accounting for isdn4linux. (Utilities)
*
@ -19,6 +19,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: tools.c,v $
* Revision 1.7 1997/04/16 22:23:04 luethje
* some bugfixes, README completed
*
* Revision 1.6 1997/04/08 21:56:59 luethje
* Create the file isdn.conf
* some bug fixes for pid and lock file
@ -775,7 +778,9 @@ go: if (!ndigit)
int print_version(char *myname)
{
_print_msg("%s Version %s, Copyright (C) 1995, 1996, 1997 Andreas Kool\n",myname,VERSION);
_print_msg("%s Version %s, Copyright (C) 1995, 1996, 1997\n",myname,VERSION);
_print_msg(" Andreas Kool (akool@Kool.f.EUnet.de)\n");
_print_msg(" and Stefan Luethje (luethje@sl-gw.lake.de)\n\n");
_print_msg("%s comes with ABSOLUTELY NO WARRANTY; for details see COPYING.\n", myname);
_print_msg("This is free software, and you are welcome to redistribute it\n");
_print_msg("under certain conditions; see COPYING for details.\n");

View File

@ -44,7 +44,7 @@ Gross und Kleinschreibung unterschieden.
In den Sektions- und Eintragnamen duerfen folgende Zeichen nicht verwendet
werden: "*?|&/"
Wenn diese Zeichen werden beim Einlesen ignoriert.
Wenn diese Zeichen erscheinen, werden sie beim Einlesen ignoriert.
Am Anfang einer Zeile (sowohl Sektionsname als auch einem Eintrag) koennen
beliebig viele Leerzeichen als auch Tabulatoren stehen:
@ -67,7 +67,7 @@ BEGIN-OF-FILE
[SECTION1]
ENTRY1=blabla1
entry2 = blabla2
# ^^^-------- Es duerfen vor und nach dem Gleichheitszeichen beliebig
# ^-^-------- Es duerfen vor und nach dem Gleichheitszeichen beliebig
# Spaces und Tabulatoren verwendet werden.
# Diese werden vom Interpreter ignoriert.
# Das erste Zeichen des Wertes der Variablen
@ -120,8 +120,8 @@ Dann wird nach der Datei /etc/myinclude gesucht. Es ist voellig
unabhaengig davon, in welchem Verzeichnis das Programm gestartet wurde,
das die Konfigurationsdatei lesen soll.
In der Include Datei muessen immer genau so viele gescheifte Klammern
zugehen, wie aufgemacht worden sind. Eine Datei darf nich folgenden Inhalt
In der Include Datei muessen immer genau so viele geschweifte Klammern
zugehen, wie aufgemacht worden sind. Eine Datei darf nicht folgenden Inhalt
haben:
[TEST1]