diff --git a/isdnlog/isdnrep/isdnrep.c b/isdnlog/isdnrep/isdnrep.c index 8faa82eb..75f028b8 100644 --- a/isdnlog/isdnrep/isdnrep.c +++ b/isdnlog/isdnrep/isdnrep.c @@ -24,6 +24,22 @@ * * * $Log$ + * Revision 1.46 1998/10/04 12:04:21 akool + * - README + * New entries "CALLFILE" and "CALLFMT" documented + * Small Correction from Markus Werner + * cosmetics + * + * - isdnrep.c + * Bugfix (Thanks to Arnd Bergmann ) + * + * - processor.c + * Patch from Oliver Lauer + * Makes CHARGEMAX work without AOC-D + * + * Patch from Stefan Gruendel + * gcc 2.7.2.1 Optimizer-Bug workaround + * * Revision 1.45 1998/10/03 18:06:35 akool * - processor.c, takt_at.c : Patch from Michael Reinelt * try to guess the zone of the calling/called party @@ -1134,9 +1150,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 diff --git a/lib/isdntools.c b/lib/isdntools.c index 89801ae9..9a748c82 100644 --- a/lib/isdntools.c +++ b/lib/isdntools.c @@ -19,6 +19,29 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log$ + * 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 !! + * - Support for tesion)) Baden-Wuerttemberg Tarif + * - more Providers + * - Patches from Wilfried Teiken + * - better zone-info support in "tools/isdnconf.c" + * - buffer-overrun in "isdntools.c" fixed + * - big Austrian Patch from Michael Reinelt + * - added $(DESTDIR) in any "Makefile.in" + * - new Configure-Switches "ISDN_AT" and "ISDN_DE" + * - splitted "takt.c" and "tools.c" into + * "takt_at.c" / "takt_de.c" ... + * "tools_at.c" / "takt_de.c" ... + * - new feature + * CALLFILE = /var/log/caller.log + * CALLFMT = %b %e %T %N7 %N3 %N4 %N5 %N6 + * in "isdn.conf" + * - ATTENTION: + * 1. "isdnrep" dies with an seg-fault, if not HTML-Mode (Stefan?) + * 2. "isdnlog/Makefile.in" now has hardcoded "ISDN_DE" in "DEFS" + * should be fixed soon + * * Revision 1.21 1998/06/07 21:03:26 akool * Renamed old to new zone-names (CityCall, RegioCall, GermanCall, GlobalCall) * @@ -275,9 +298,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'; @@ -291,12 +314,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 ) { @@ -306,14 +334,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; @@ -717,7 +745,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); @@ -1038,8 +1066,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; @@ -1052,11 +1080,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; @@ -1064,7 +1092,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; diff --git a/lib/libisdn.h b/lib/libisdn.h index 61c3d6f2..0d4154d5 100644 --- a/lib/libisdn.h +++ b/lib/libisdn.h @@ -20,6 +20,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log$ + * Revision 1.9 1998/05/11 19:43:51 luethje + * Some changes for "vorwahlen.dat" + * * Revision 1.8 1998/05/10 22:12:04 luethje * Added support for VORWAHLEN2.EXE * @@ -63,7 +66,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 '\\' */ diff --git a/lib/libtools.c b/lib/libtools.c index 822b468c..7d5075d6 100644 --- a/lib/libtools.c +++ b/lib/libtools.c @@ -18,6 +18,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log$ + * Revision 1.6 1997/05/09 23:31:09 luethje + * isdnlog: new switch -O + * isdnrep: new format %S + * bugfix in handle_runfiles() + * * Revision 1.5 1997/04/15 00:20:18 luethje * replace variables: some bugfixes, README comleted * @@ -645,3 +650,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; +} + +/****************************************************************************/ + diff --git a/lib/libtools.h b/lib/libtools.h index 8377c13f..b2a852ae 100644 --- a/lib/libtools.h +++ b/lib/libtools.h @@ -19,6 +19,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log$ + * Revision 1.6 1997/05/09 23:31:10 luethje + * isdnlog: new switch -O + * isdnrep: new format %S + * bugfix in handle_runfiles() + * * Revision 1.5 1997/04/15 00:20:19 luethje * replace variables: some bugfixes, README comleted * @@ -100,6 +105,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