fix from Michael
This commit is contained in:
parent
4a9a80d97a
commit
7ab336774e
|
@ -24,6 +24,15 @@
|
|||
*
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.70 1999/07/12 11:37:34 calle
|
||||
* Bugfix: isdnrep defined print_msg as function pointer, the object files
|
||||
* in tools directory, declare it as external function.
|
||||
* compiler and linker did not detect the problem.
|
||||
* Now print_msg is a function in rep_main.c and I copied
|
||||
* print_in_modules from isdnconf. Also set_print_fct_for_isdnrep
|
||||
* is removed from isdnrep.c. isdnrep didn´t crash now, but throw
|
||||
* out warning messages about rate.dat and did´t generate output.
|
||||
*
|
||||
* Revision 1.69 1999/06/16 19:12:42 akool
|
||||
* isdnlog Version 3.34
|
||||
* fixed some memory faults
|
||||
|
@ -913,7 +922,8 @@ int read_logfile(char *myname)
|
|||
|
||||
/* FIXME: */
|
||||
initHoliday(holifile, NULL);
|
||||
initRate("/etc/isdn/rate.conf", "/usr/lib/isdn/rate-de.dat", "/usr/lib/isdn/zone-de-%s.gdbm", NULL);
|
||||
initCountry(countryfile, NULL);
|
||||
initRate(rateconf, ratefile, zonefile, NULL);
|
||||
currency = strdup("DM");
|
||||
vbn = strdup("010");
|
||||
interns0 = 3;
|
||||
|
@ -1843,6 +1853,113 @@ static int print_line(int status, one_call *cur_call, int computed, char *overla
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void numsplit(char *num)
|
||||
{
|
||||
register int l1, l3, zone;
|
||||
auto int l2;
|
||||
register char *p;
|
||||
auto char *s;
|
||||
char country[BUFSIZ], area[BUFSIZ], msn[BUFSIZ];
|
||||
|
||||
|
||||
if (!*num)
|
||||
return;
|
||||
|
||||
if ((l1 = getCountrycode(num, &s)) != UNKNOWN) {
|
||||
Strncpy(country, num, l1 + 1);
|
||||
|
||||
if (strcmp(mycountry, country))
|
||||
print_msg(PRT_NORMAL, "%s, ", s);
|
||||
|
||||
if ((p = get_areacode(num, &l2, C_NO_WARN | C_NO_EXPAND | C_NO_ERROR)) && (l2 > 0)) {
|
||||
Strncpy(area, num + l1, l2 + 1 - l1);
|
||||
|
||||
print_msg(PRT_NORMAL, "%s", p);
|
||||
|
||||
strcpy(msn, num + l2);
|
||||
|
||||
} /* if */
|
||||
#if 0
|
||||
p = country;
|
||||
|
||||
while (*p && !isdigit(*p))
|
||||
p++;
|
||||
|
||||
l3 = getAreacode(atoi(p), num + l1, &s);
|
||||
|
||||
if (1 /* l3 != UNKNOWN */) {
|
||||
print_msg(PRT_NORMAL, "getAreacode(%d, %s, %s)=%d", atoi(p), num + l1, s, l3);
|
||||
if (l3 != UNKNOWN)
|
||||
free(s);
|
||||
zone = getZone(DTAG, myarea, num + l1);
|
||||
print_msg(PRT_NORMAL, "getZone(%d,%s,%s)=%d", DTAG, myarea, num + l1, zone);
|
||||
|
||||
switch (zone) {
|
||||
case 1 : print_msg(PRT_NORMAL, "Ortszone\n"); break;
|
||||
case 2 : print_msg(PRT_NORMAL, "Cityzone\n"); break;
|
||||
case 3 : print_msg(PRT_NORMAL, "Regionalzone\n"); break;
|
||||
case 4 : print_msg(PRT_NORMAL, "Fernzone\n"); break;
|
||||
default : print_msg(PRT_NORMAL, "*** BUG ***\n"); break;
|
||||
} /* switch */
|
||||
} /* if */
|
||||
#endif
|
||||
}
|
||||
#if 0
|
||||
else {
|
||||
l3 = getAreacode(49, num, &s);
|
||||
|
||||
if (l3 != UNKNOWN) {
|
||||
print_msg(PRT_NORMAL, "getAreacode(%d, %s, %s)=%d\n", atoi(p), num + l1, s, l3);
|
||||
free(s);
|
||||
|
||||
zone = getZone(DTAG, mynum, num);
|
||||
print_msg(PRT_NORMAL, "getZone=%d\n", zone);
|
||||
} /* if */
|
||||
} /* else */
|
||||
#endif
|
||||
} /* numsplit */
|
||||
|
||||
|
||||
static void bprint(one_call *call)
|
||||
{
|
||||
print_msg(PRT_NORMAL, "%s %s %-16s ",
|
||||
get_time_value(0,NULL,GET_TIME),
|
||||
double2clock(call->duration),
|
||||
call->num[CALLED]);
|
||||
|
||||
if (call->duration) {
|
||||
print_msg(PRT_NORMAL, "%s %-15s",
|
||||
print_currency(call->pay, 0),
|
||||
getProvider(call->provider));
|
||||
numsplit(call->num[CALLED]);
|
||||
print_msg(PRT_NORMAL, "\n");
|
||||
}
|
||||
else
|
||||
print_msg(PRT_NORMAL, "%*s** %s\n", 30, "", qmsg(TYPE_CAUSE, VERSION_EDSS1, call->cause));
|
||||
|
||||
/*
|
||||
int eh;
|
||||
int cause;
|
||||
time_t t;
|
||||
int dir;
|
||||
double duration;
|
||||
char num[2][NUMSIZE];
|
||||
char who[2][NUMSIZE];
|
||||
long ibytes;
|
||||
long obytes;
|
||||
char version[10];
|
||||
int si;
|
||||
int si1;
|
||||
double currency_factor;
|
||||
char currency[32];
|
||||
double pay;
|
||||
int provider;
|
||||
int zone;
|
||||
*/
|
||||
} /* bprint */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static int append_string(char **string, prt_fmt *fmt_ptr, char* value)
|
||||
{
|
||||
char tmpstr[BUFSIZ*3];
|
||||
|
@ -2312,7 +2429,10 @@ static int print_entries(one_call *cur_call, double unit, int *nx, char *myname)
|
|||
|
||||
} /* if */
|
||||
|
||||
print_line(F_BODY_LINE,cur_call,computed,NULL);
|
||||
if (bill)
|
||||
bprint(cur_call);
|
||||
else
|
||||
print_line(F_BODY_LINE,cur_call,computed,NULL);
|
||||
|
||||
return(0);
|
||||
} /* print_entries */
|
||||
|
@ -2327,7 +2447,11 @@ static int print_header(int lday)
|
|||
|
||||
if (lday == UNKNOWN) {
|
||||
time(&now);
|
||||
print_line2(F_1ST_LINE,"I S D N Connection Report - %s", ctime(&now));
|
||||
|
||||
if (bill)
|
||||
print_line2(F_1ST_LINE, "Ihre Verbindungen im einzelnen - %s", ctime(&now));
|
||||
else
|
||||
print_line2(F_1ST_LINE,"I S D N Connection Report - %s", ctime(&now));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2487,7 +2611,7 @@ static int set_alias(one_call *cur_call, int *nx, char *myname)
|
|||
|
||||
/* In der naechsten Schleife werden die unbekannten Nummern
|
||||
registriert */
|
||||
if (!hit) {
|
||||
if (!hit && seeunknowns) {
|
||||
for (i = 0; i < unknowns; i++)
|
||||
if (!strcmp(unknown[i].num, cur_call->num[n])) {
|
||||
hit++;
|
||||
|
@ -3025,6 +3149,7 @@ static int print_sum_calls(sum_calls *s, int computed)
|
|||
one_call *tmp_call;
|
||||
int RetCode;
|
||||
|
||||
|
||||
if ((tmp_call = (one_call*) calloc(1,sizeof(one_call))) == NULL)
|
||||
{
|
||||
print_msg(PRT_ERR, nomemory);
|
||||
|
|
|
@ -20,6 +20,15 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.15 1999/07/12 11:37:37 calle
|
||||
* Bugfix: isdnrep defined print_msg as function pointer, the object files
|
||||
* in tools directory, declare it as external function.
|
||||
* compiler and linker did not detect the problem.
|
||||
* Now print_msg is a function in rep_main.c and I copied
|
||||
* print_in_modules from isdnconf. Also set_print_fct_for_isdnrep
|
||||
* is removed from isdnrep.c. isdnrep didn´t crash now, but throw
|
||||
* out warning messages about rate.dat and did´t generate output.
|
||||
*
|
||||
* Revision 1.14 1999/05/04 19:33:19 akool
|
||||
* isdnlog Version 3.24
|
||||
*
|
||||
|
@ -134,6 +143,7 @@ _EXTERN int print_msg(int Level, const char *, ...);
|
|||
_EXTERN int incomingonly _SET_0;
|
||||
_EXTERN int outgoingonly _SET_0;
|
||||
_EXTERN int verbose _SET_0;
|
||||
_EXTERN int bill _SET_0;
|
||||
_EXTERN int timearea _SET_0;
|
||||
_EXTERN int phonenumberonly _SET_0;
|
||||
_EXTERN int compute _SET_0;
|
||||
|
|
|
@ -20,6 +20,15 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.9 1999/07/12 11:37:38 calle
|
||||
* Bugfix: isdnrep defined print_msg as function pointer, the object files
|
||||
* in tools directory, declare it as external function.
|
||||
* compiler and linker did not detect the problem.
|
||||
* Now print_msg is a function in rep_main.c and I copied
|
||||
* print_in_modules from isdnconf. Also set_print_fct_for_isdnrep
|
||||
* is removed from isdnrep.c. isdnrep didn´t crash now, but throw
|
||||
* out warning messages about rate.dat and did´t generate output.
|
||||
*
|
||||
* Revision 1.8 1999/06/13 14:08:08 akool
|
||||
* isdnlog Version 3.32
|
||||
*
|
||||
|
@ -180,7 +189,7 @@ int main(int argc, char *argv[], char *envp[])
|
|||
auto char fnbuff[512] = "";
|
||||
auto char usage[] = "%s: usage: %s [ -%s ]\n";
|
||||
auto char wrongdate[] = "unknown date: %s\n";
|
||||
auto char options[] = "ac:d:f:hinop:s:t:uvw:NVF:M:R:";
|
||||
auto char options[] = "ac:d:f:hinop:s:t:uvw:NVF:M:R:b";
|
||||
auto char *myname = basename(argv[0]);
|
||||
auto char *ptr = NULL;
|
||||
auto char *linefmt = "";
|
||||
|
@ -258,6 +267,9 @@ int main(int argc, char *argv[], char *envp[])
|
|||
case 'R' : preselect = (int)strtol(optarg, NIL, 0);
|
||||
break;
|
||||
|
||||
case 'b' : bill++;
|
||||
break;
|
||||
|
||||
case 'V' : print_version(myname);
|
||||
exit(0);
|
||||
|
||||
|
@ -323,6 +335,9 @@ int print_msg(int Level, const char *fmt, ...)
|
|||
vsnprintf(String, LONG_STRING_SIZE, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (Level == PRT_ERR)
|
||||
return(1);
|
||||
|
||||
if (Level & PRT_ERR)
|
||||
fprintf(stderr, "%s", String);
|
||||
else
|
||||
|
|
1458
isdnlog/rate-de.dat
1458
isdnlog/rate-de.dat
File diff suppressed because it is too large
Load Diff
|
@ -19,6 +19,9 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.35 1999/07/15 16:42:10 akool
|
||||
* small enhancement's and fixes
|
||||
*
|
||||
* Revision 1.34 1999/07/12 18:50:06 akool
|
||||
* replace "0" by "+49"
|
||||
*
|
||||
|
@ -932,7 +935,7 @@ int initRate(char *conf, char *dat, char *dom, char **msg)
|
|||
i=day2; day2=day1; day1=i;
|
||||
}
|
||||
for (i=day1; i<=day2; i++)
|
||||
day|=(1<<i);
|
||||
day|=(1<<(i+MONDAY-1));
|
||||
} else {
|
||||
warning (dat, "invalid day '%c'", *s);
|
||||
day=0;
|
||||
|
@ -1166,7 +1169,7 @@ int getRate(RATE *Rate, char **msg)
|
|||
HOUR *Hour;
|
||||
UNIT *Unit;
|
||||
int prefix, freeze, hour, cur, max, i, j;
|
||||
double now, run, end;
|
||||
double now, run, end, jmp;
|
||||
char *day;
|
||||
time_t time;
|
||||
struct tm tm;
|
||||
|
@ -1275,6 +1278,11 @@ int getRate(RATE *Rate, char **msg)
|
|||
freeze=Hour->Freeze;
|
||||
Rate->Hour=Hour->Name;
|
||||
Unit=Hour->Unit;
|
||||
jmp=run;
|
||||
while (Unit->Delay!=UNKNOWN && Unit->Delay<=jmp) {
|
||||
jmp-=Unit->Delay;
|
||||
Unit++;
|
||||
}
|
||||
}
|
||||
|
||||
now+=Unit->Duration;
|
||||
|
@ -1428,6 +1436,7 @@ void main (int argc, char *argv[])
|
|||
getNumber (strdup("+43-1-4711"), Rate.dst);
|
||||
}
|
||||
|
||||
#if 1
|
||||
time(&Rate.start);
|
||||
Rate.now=Rate.start+153;
|
||||
|
||||
|
@ -1471,10 +1480,13 @@ void main (int argc, char *argv[])
|
|||
|
||||
exit (0);
|
||||
|
||||
#else
|
||||
|
||||
printf ("---Date--- --Time-- --Charge-- ( Basic Price) Unit Dur Time Rest\n");
|
||||
|
||||
time(&Rate.start)
|
||||
while (1) {
|
||||
time(&Rate.now);
|
||||
time(&Rate.now)
|
||||
if (getRate(&Rate, &msg)==UNKNOWN) {
|
||||
printf ("Ooops: %s\n", msg);
|
||||
exit (1);
|
||||
|
@ -1487,5 +1499,6 @@ void main (int argc, char *argv[])
|
|||
|
||||
sleep(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue