New options -c and -i for overriding the RATECONF and RATEFILE setting

in isdn.conf.  May be useful for rate-file testing.
This commit is contained in:
tobiasb 2004-01-10 16:43:24 +00:00
parent 22c00ee4ae
commit 567611d3af
2 changed files with 34 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $Id: isdnrate.c,v 1.40 2003/09/04 19:45:07 tobiasb Exp $
/* $Id: isdnrate.c,v 1.41 2004/01/10 16:43:24 tobiasb Exp $
* ISDN accounting for isdn4linux. (rate evaluation)
*
@ -19,6 +19,10 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnrate.c,v $
* Revision 1.41 2004/01/10 16:43:24 tobiasb
* New options -c and -i for overriding the RATECONF and RATEFILE setting
* in isdn.conf. May be useful for rate-file testing.
*
* Revision 1.40 2003/09/04 19:45:07 tobiasb
* New option for isdnrate: `-rvNN' requires a vbn starting with NN.
* Suggested by Thomas Richter on isdn4linux mailinglist, for reference see
@ -315,7 +319,7 @@
static void print_header(void);
static char *myname, *myshortname;
static char options[] = "ab:d:f:h:l:op:r:st:v::x:CD::G:HLNP:O:S:TUVX::Z";
static char options[] = "ab:c:d:f:h:i:l:op:r:st:v::x:CD::G:HLNP:O:S:TUVX::Z";
static char usage[] = "%s: usage: %s [ -%s ] Destination ...\n";
static int header = 0, best = MAXPROVIDER, table = 0, explain = 0;
@ -339,6 +343,8 @@ static int all = 0;
static int booked = 0;
static int service = 0;
static char *require_vbn = NULL;
static char *opt_rateconf = 0;
static char *opt_ratefile = 0;
#define SOCKNAME "/tmp/isdnrate"
static int is_daemon = 0;
@ -413,7 +419,8 @@ static void init()
if (verbose && *version)
print_msg(PRT_V, "%s\n", version);
initRate(rateconf, ratefile, zonefile, message);
initRate(opt_rateconf?opt_rateconf:rateconf,
opt_ratefile?opt_ratefile:ratefile, zonefile, message);
if (verbose && *version)
print_msg(PRT_V, "%s\n", version);
@ -500,7 +507,8 @@ static int opts(int argc, char *argv[])
best = strtol(optarg, NIL, 0);
break;
/* case 'c': country */
case 'c':
opt_rateconf = optarg;
break;
case 'd':
@ -544,6 +552,10 @@ static int opts(int argc, char *argv[])
min = 0;
break;
case 'i':
opt_ratefile = optarg;
break;
case 'l':
duration = strtol(optarg, NIL, 0); /* l wie lt */
break;
@ -697,6 +709,12 @@ static int opts(int argc, char *argv[])
is_daemon = 0;
print_msg(PRT_V, "Conflicting options, -D disabled\n");
}
if (is_client && opt_rateconf) {
print_msg(PRT_V, "Conflicting options, -c ignored in client mode (-C)\n");
}
if (is_client && opt_ratefile) {
print_msg(PRT_V, "Conflicting options, -i ignored in client mode (-C)\n");
}
if (list && table) {
table = 0;
print_msg(PRT_V, "Conflicting options, -T disabled\n");
@ -1788,9 +1806,11 @@ int main(int argc, char *argv[], char *envp[])
print_msg(PRT_A, "\n");
print_msg(PRT_A, "\t-a \tall=show old and newer rates (default actual only)\n", MAXPROVIDER);
print_msg(PRT_A, "\t-b best\tshow only the first <best> provider(s) (default %d)\n", MAXPROVIDER);
print_msg(PRT_A, "\t-c file\tuse <file> as rate.conf\n");
print_msg(PRT_A, "\t-d d[.m[.y]] | {W|N|E}\tstart date of call (default now)\n");
print_msg(PRT_A, "\t-f areacode\tyou are calling from <areacode>\n");
print_msg(PRT_A, "\t-h h[:m[:s]]\tstart time of call (default now)\n");
print_msg(PRT_A, "\t-i file\tuse <file> as ratefile (rate-CC.dat)\n");
print_msg(PRT_A, "\t-l duration\tduration of call in seconds (default %d seconds)\n", LCR_DURATION);
print_msg(PRT_A, "\t-o \t show only booked providers\n");
print_msg(PRT_A, "\t-p prov|B[,prov...]\t show only these providers\n");

View File

@ -1,4 +1,4 @@
.\" CHECKIN $Date: 2003/10/29 17:41:35 $
.\" CHECKIN $Date: 2004/01/10 16:43:24 $
.TH ISDNRATE 1 "@MANDATE@" -lt-
.SH NAME
isdnrate \- Print telefon rates and various info from rate\-files(5).
@ -60,6 +60,10 @@ Note also, spaces in country- or service names may be given as underscores.
.BI \-b best
Print only \fIbest\fP providers. Default is all.
.P
.BI \-c rateconf
Use \fIrateconf\fP as provider selection file and ignore setting in
.IR isdn.conf .
.P
.BI \-d day
Calc rates for \fIday\fP. \fIday\fP can be one of
.IP
@ -92,6 +96,11 @@ Time
.IR hh [ :mm [ :ss ]]
of call. Default is now.
.P
.BI \-i ratefile
Use \fIratefile\fP (usually rate-CC.dat) as source for telephone fees and
ignore setting in
.IR isdn.conf .
.P
.BI \-l len
Length of call in second. Default value is 153 secs.
.P