isdnrep and lib: bugfixes
This commit is contained in:
parent
742d69001f
commit
e1d10fddbf
|
@ -1,4 +1,4 @@
|
|||
/* $Id: isdnrep.c,v 1.46 1998/10/04 12:04:21 akool Exp $
|
||||
/* $Id: isdnrep.c,v 1.47 1998/10/13 21:53:17 luethje Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux. (Report-module)
|
||||
*
|
||||
|
@ -24,6 +24,9 @@
|
|||
*
|
||||
*
|
||||
* $Log: isdnrep.c,v $
|
||||
* Revision 1.47 1998/10/13 21:53:17 luethje
|
||||
* isdnrep and lib: bugfixes
|
||||
*
|
||||
* Revision 1.46 1998/10/04 12:04:21 akool
|
||||
* - README
|
||||
* New entries "CALLFILE" and "CALLFMT" documented
|
||||
|
@ -1150,9 +1153,10 @@ static int print_bottom(double unit, char *start, char *stop)
|
|||
else
|
||||
if ((p = get_areacode(unknown[i].num, &l, flag)) != 0) {
|
||||
if (l > 1) {
|
||||
strncpy(areacode, unknown[i].num, 2 + prefix);
|
||||
/* Sehr gefaehrlich, was ist mit Laendern, die einen dreistelligen Code haben??? */
|
||||
Strncpy(areacode, unknown[i].num, 3 + prefix);
|
||||
if ((l - (2 + prefix)) > 0) {
|
||||
strncpy(vorwahl, unknown[i].num + 2 + prefix, l - (2 + prefix));
|
||||
Strncpy(vorwahl, unknown[i].num + 2 + prefix, l - (2 + prefix) + 1);
|
||||
vorwahl[l - (2 + prefix)] = 0;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: isdntools.c,v 1.22 1998/09/26 18:30:30 akool Exp $
|
||||
/* $Id: isdntools.c,v 1.23 1998/10/13 21:53:26 luethje Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux. (Utilities)
|
||||
*
|
||||
|
@ -19,6 +19,9 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: isdntools.c,v $
|
||||
* Revision 1.23 1998/10/13 21:53:26 luethje
|
||||
* isdnrep and lib: bugfixes
|
||||
*
|
||||
* Revision 1.22 1998/09/26 18:30:30 akool
|
||||
* - quick and dirty Call-History in "-m" Mode (press "h" for more info) added
|
||||
* - eat's one more socket, Stefan: sockets[3] now is STDIN, FIRST_DESCR=4 !!
|
||||
|
@ -298,9 +301,9 @@ char *expand_number(char *s)
|
|||
{
|
||||
int all_allowed = 0;
|
||||
char *Ptr;
|
||||
int Index;
|
||||
char Help[SHORT_STRING_SIZE];
|
||||
static char Num[SHORT_STRING_SIZE];
|
||||
int Index = 0;
|
||||
char Help[NUMBER_SIZE] = "";
|
||||
static char Num[NUMBER_SIZE];
|
||||
|
||||
|
||||
Help[0] = '\0';
|
||||
|
@ -314,12 +317,17 @@ char *expand_number(char *s)
|
|||
|
||||
if (*Ptr == '+')
|
||||
{
|
||||
strcpy(Help,countryprefix);
|
||||
Strncpy(Help,countryprefix,NUMBER_SIZE);
|
||||
Ptr++;
|
||||
}
|
||||
|
||||
Index = strlen(Help);
|
||||
|
||||
while(*Ptr != '\0')
|
||||
{
|
||||
if (*Ptr == ',' || Index >= NUMBER_SIZE)
|
||||
break;
|
||||
|
||||
if (isdigit(*Ptr) || *Ptr == '?' || *Ptr == '*'||
|
||||
*Ptr == '[' || *Ptr == ']' || all_allowed )
|
||||
{
|
||||
|
@ -329,14 +337,14 @@ char *expand_number(char *s)
|
|||
if (*Ptr == ']')
|
||||
all_allowed = 0;
|
||||
|
||||
Index = strlen(Help);
|
||||
Help[Index] = *Ptr;
|
||||
Help[Index+1] = '\0';
|
||||
Help[Index++] = *Ptr;
|
||||
}
|
||||
|
||||
Ptr++;
|
||||
}
|
||||
|
||||
Help[Index] = '\0';
|
||||
|
||||
if (Help[0] == '\0')
|
||||
return s;
|
||||
|
||||
|
@ -740,7 +748,7 @@ char *get_areacode(char *code, int *Len, int flag)
|
|||
{
|
||||
char *ptr = expand_number(code);
|
||||
|
||||
if ((code = alloca(strlen(ptr))) == NULL)
|
||||
if ((code = alloca(strlen(ptr)+1)) == NULL)
|
||||
print_msg("Can not allocate memory!\n");
|
||||
|
||||
strcpy(code,ptr);
|
||||
|
@ -1061,8 +1069,8 @@ const char* area_diff_string(char* number1, char* number2)
|
|||
int area_diff(char* _code, char *_diffcode)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
char code[40];
|
||||
char diffcode[40];
|
||||
char code[NUMBER_SIZE];
|
||||
char diffcode[NUMBER_SIZE];
|
||||
char value[15];
|
||||
int index;
|
||||
int number;
|
||||
|
@ -1075,11 +1083,11 @@ int area_diff(char* _code, char *_diffcode)
|
|||
|
||||
if (_code == NULL)
|
||||
{
|
||||
strcpy(code,mycountry);
|
||||
strcat(code,myarea);
|
||||
Strncpy(code,mycountry,NUMBER_SIZE);
|
||||
Strncat(code,myarea,NUMBER_SIZE);
|
||||
}
|
||||
else
|
||||
strcpy(code,expand_number(_code));
|
||||
Strncpy(code,expand_number(_code),NUMBER_SIZE);
|
||||
|
||||
if (strncmp(mycountry,code,strlen(mycountry)))
|
||||
return AREA_UNKNOWN;
|
||||
|
@ -1087,7 +1095,7 @@ int area_diff(char* _code, char *_diffcode)
|
|||
if (_diffcode == NULL)
|
||||
return AREA_ERROR;
|
||||
else
|
||||
strcpy(diffcode,expand_number(_diffcode));
|
||||
Strncpy(diffcode,expand_number(_diffcode),NUMBER_SIZE);
|
||||
|
||||
if ((index = area_get_index(code)) == -1)
|
||||
return AREA_ERROR;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
/* $Id: libisdn.h,v 1.9 1998/05/11 19:43:51 luethje Exp $
|
||||
/* $Id: libisdn.h,v 1.10 1998/10/13 21:53:33 luethje Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux.
|
||||
*
|
||||
|
@ -20,6 +20,9 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: libisdn.h,v $
|
||||
* Revision 1.10 1998/10/13 21:53:33 luethje
|
||||
* isdnrep and lib: bugfixes
|
||||
*
|
||||
* Revision 1.9 1998/05/11 19:43:51 luethje
|
||||
* Some changes for "vorwahlen.dat"
|
||||
*
|
||||
|
@ -66,7 +69,13 @@ extern char *basename __P((__const char *__name));
|
|||
|
||||
/****************************************************************************/
|
||||
|
||||
#define CONFDIR_VAR "ISDN_CONF_PATH"
|
||||
#ifndef NUMBER_SIZE
|
||||
# define NUMBER_SIZE 40
|
||||
#endif
|
||||
|
||||
#ifndef CONFDIR_VAR
|
||||
# define CONFDIR_VAR "ISDN_CONF_PATH"
|
||||
#endif
|
||||
|
||||
#define C_SLASH '/'
|
||||
/* #define C_SLASH '\\' */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: libtools.c,v 1.6 1997/05/09 23:31:09 luethje Exp $
|
||||
/* $Id: libtools.c,v 1.7 1998/10/13 21:53:36 luethje Exp $
|
||||
* ISDN accounting for isdn4linux.
|
||||
*
|
||||
* Copyright 1996 by Stefan Luethje (luethje@sl-gw.lake.de)
|
||||
|
@ -18,6 +18,9 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: libtools.c,v $
|
||||
* Revision 1.7 1998/10/13 21:53:36 luethje
|
||||
* isdnrep and lib: bugfixes
|
||||
*
|
||||
* Revision 1.6 1997/05/09 23:31:09 luethje
|
||||
* isdnlog: new switch -O
|
||||
* isdnrep: new format %S
|
||||
|
@ -650,3 +653,28 @@ char *int2str(int value, int prec)
|
|||
|
||||
/****************************************************************************/
|
||||
|
||||
char *Strncat(char *dest, const char *src, int len)
|
||||
{
|
||||
int destlen = strlen(dest);
|
||||
|
||||
return Strncpy(dest+destlen,src,len-destlen);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
char *Strncpy(char *dest, const char *src, int len)
|
||||
{
|
||||
int l = strlen(src);
|
||||
|
||||
if (l > len - 1)
|
||||
l = len - 1;
|
||||
|
||||
strncpy(dest,src,l);
|
||||
|
||||
dest[l] = '\0';
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: libtools.h,v 1.6 1997/05/09 23:31:10 luethje Exp $
|
||||
/* $Id: libtools.h,v 1.7 1998/10/13 21:53:37 luethje Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux.
|
||||
*
|
||||
|
@ -19,6 +19,9 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: libtools.h,v $
|
||||
* Revision 1.7 1998/10/13 21:53:37 luethje
|
||||
* isdnrep and lib: bugfixes
|
||||
*
|
||||
* Revision 1.6 1997/05/09 23:31:10 luethje
|
||||
* isdnlog: new switch -O
|
||||
* isdnrep: new format %S
|
||||
|
@ -105,6 +108,8 @@ _EXTERN int is_double (char *string, double *value);
|
|||
_EXTERN int is_integer (char *string, long int *value);
|
||||
_EXTERN char *Replace_Variable(char *String);
|
||||
_EXTERN char *int2str(int value, int prec);
|
||||
_EXTERN char *Strncpy(char *dest, const char *src, int len);
|
||||
_EXTERN char *Strncat(char *dest, const char *src, int len);
|
||||
|
||||
#undef _EXTERN
|
||||
|
||||
|
|
Loading…
Reference in New Issue