New isdnrep options: `-L:' controls the displayed call summaries in the

report footer.  `-x' displays only call selected or not deselected by
hour or type of day -- may be useful in conjunction with `-r'.

Activated new configuration file entry `REPOPTIONS' for isdnrep default
options.  This options can be disabled by `-c' on the command line.
This commit is contained in:
Tobias Becker 2004-07-24 17:58:06 +00:00
parent 442cf95d05
commit e2ed7d9d08
5 changed files with 543 additions and 69 deletions

19
isdnlog/isdnrep/ChangeLog Normal file
View File

@ -0,0 +1,19 @@
2004-07-24 Tobias Becker <tobiasb@isdn4linux.de>
* rep_main.c (parse_options): New option `-x', selects calls by hour
or type of day.
* isdnrep.h (days, hours): New global variables for result of `-x'.
* isdnrep.c (select_day_hour): New function, parses contents of `-x'.
(check_day_hour): New function, determines selection of call by `-x'.
(read_logfile): Process only selected calls.
* rep_main.c (parse_options): New option `-L', selects summaries.
* isdnrep.h (sel_sums): New global variable for result of `-L'.
* isdnrep.c (select_summaries): New function, parses contents of `-L'.
(print_bottom): Produce only selected summaries.
* rep_main.c (parse_options): New function for option parsing.
(main): Replaced option parsing by call to parse_options, added
conversion of `REP_OPTIONS' contents to standard argc/argv values.
* ChangeLog: Started this file.

View File

@ -97,6 +97,11 @@ only successful connections are displayed.
.B \-v verbose
Display warnings on startup.
.TP
.B \-c ignore default options
Do not append the "REPOPTIONS" setting from @I4LCONFDIR@/@CONFFILE@
to the commandline.
.TP
.B \-p [n][m]'number'[,[m]'number'...] phonenumber
Display only selected phone numbers.
@ -119,12 +124,87 @@ Only incoming connections are displayed.
.B \-o outgoing
Only outgoing connections are displayed.
.TP
.B \-xX include/exclude calls
Select calls by day and/or hour. The following selections are possible
and can specified in any combination and quantity using
.B :
as separator:
.RS
.TP
.RI d daylist
only days matching
.I daylist
.TP
.RI D daylist
all days not matching
.I daylist
.TP
.RI h timelist
only hours matching
.I timelist
.TP
.RI H timelist
all hours not matching
.I timelist
.RE
.in +7
.I daylist
and
.I timelist
have the same syntax as described in
.IR rate-files(5) .
If a day or an hour is included and excluded it will be excluded.
Example
.br
-xd2-4:DH:h9-17:H12-15
.br
This will display all calls on Tuesdays, Wednesdays, or Thursdays
that are no holidays with a start time between 09:00 and 12:00 or
15:00 and 17:00.
.in -7
.TP
.B \-u unknown caller
At the end of the report, all numbers not aliased in callerid.conf or
~/.isdn are displayed. This option is not available when HTML output
is requested.
.TP
.B \-LX summary lists
Select the summaries in the footer by any combination of the following
letters:
.RS
.TP
i,I
foreign numbers of incoming calls
.TP
o,O
foreign numbers of outgoing calls
.TP
c,C
foreign numbers of all calls
.TP
z,Z
zones of outgoing calls
.TP
p,P
providers of outgoing calls
.TP
m,M
MSNs (own subscriber numbers) of outgoing calls
.RE
.in +7
Upper case letters deselect, lower case letters select a summary.
With at least one lower case letter, only the selected
summaries are shown, as long as they are not also deselected.
-LiI for example will show no summary at all.
Per default all summaries are displayed.
.in -7
.TP
.B \-rPROV recompute
Recompute the connection fees with the current ratefile instead of
@ -780,7 +860,7 @@ general configuration
aliases for telephone numbers
.SH SEE ALSO
.B isdnlog(5) isdnlog(8)
.B isdnlog(5) isdnlog(8) isdn.conf(5)
.SH AUTHOR
This manual page was adapted from isdnlog/README by

View File

@ -24,6 +24,12 @@
*
*
* $Log$
* Revision 1.99 2004/02/25 12:09:08 paul
* There was no bounds checking on unknownzones, which is only useds
* if DEBUG is defined. This caused a SIGSEGV with many unknown numbers
* (which were all the same, BTW...) Now only do unknownzones if DEBUG
* is defined.
*
* Revision 1.98 2003/11/14 20:29:29 tobiasb
* Removed SIGSEGV in isdnrep that occurred while fetching zone names for outgoing calls
* from the current ratefile if the matching zone did not contain a name after the zone
@ -302,13 +308,29 @@
#define UNKNOWNZONE MAXZONES
/*****************************************************************************/
/* flags for zones_src.flags (FZN = flag zone name) */
#define FZN_KNOWN 0x01 /* zone_names[i] is a valid zone name, not ?? */
#define FZN_UNSURE 0x02 /* zone_names[i] may be incorrect */
#define FZN_MPROV 0x04 /* zone i is used with more than one provider */
#define FZN_MNAME 0x08 /* found different names for zone i */
/*****************************************************************************/
/* bits in sel_sums[] for the footer summaries */
#define SUM_IN 0x01
#define SUM_OUT 0x02
#define SUM_INOUT 0x04
#define SUM_ZONE 0x08
#define SUM_PROV 0x10
#define SUM_MSN 0x20
#define SUM_ALL 0x3f
#define SUM__CHARS "ioczpm" /* corresponding chars for option value */
/*****************************************************************************/
/* indices for sel_sums, days, and hours option */
#define INCLUDE 0
#define EXCLUDE 1
#define RESULT 2
/*****************************************************************************/
typedef struct {
@ -384,6 +406,7 @@ static char **get_http_args(char *str, int *index);
static char *url_unescape(char *str);
static int app_fmt_string(char *target, int targetlen, char *fmt, int condition, char *value);
static int find_format_length(char *string);
static int check_day_hour(bitfield *days, bitfield *hours, const time_t check);
/*****************************************************************************/
@ -698,6 +721,9 @@ int read_logfile(char *myname)
}
}
/* TODO (tobiasb|2004-02): right place for setting begintime?
either verify whether delentries is working or disable/remove it */
if (!print_failed && cur_call.duration == 0)
continue;
@ -714,6 +740,9 @@ int read_logfile(char *myname)
if (outgoingonly && cur_call.dir == DIALIN)
continue;
if (check_day_hour(days, hours, cur_call.t))
continue;
get_time_value(cur_call.t,&day,SET_TIME);
/* Andreas, warum ist diese Abfrage hier drin, warum soll das nicht moeglich
@ -900,9 +929,10 @@ static int print_bottom(double unit, char *start, char *stop)
get_format("%-36.36s %4d call(s) %10.10s %12s");
}
for (j = 0; summary < 2 && j < 2; j++)
for (j = 0; j < 2; j++)
{
if ((j == DIALOUT && !incomingonly) || (!outgoingonly && j == DIALIN))
if ( (j == DIALOUT && !incomingonly && sel_sums[RESULT] & SUM_OUT) ||
(j == DIALIN && !outgoingonly && sel_sums[RESULT] & SUM_IN ) )
{
sprintf(string, "%s Summary for %s", (j == DIALOUT) ? "Outgoing calls (calling:)" : "Incoming calls (called by:)",
print_diff_date(start,stop));
@ -928,10 +958,41 @@ static int print_bottom(double unit, char *start, char *stop)
} /* for */
print_line2(F_BODY_BOTTOM2,"");
}
} /* /if show out|in summary */
}
if (!incomingonly)
if (sel_sums[RESULT] & SUM_INOUT) {
/* print mixed summary about foreign numbers */
sprintf(string, "Calls (incoming & outgoing) Summary for %s",
print_diff_date(start,stop));
h_percent = 80.0;
h_table_color = H_TABLE_COLOR2;
print_line2(F_BODY_HEADER,"");
print_line2(F_BODY_HEADERL,"%s",string);
strich(1);
for (i = 0 ; i < knowns; i++) {
if (known[i]->usage[DIALIN]||known[i]->usage[DIALOUT]) {
print_line3(NULL,
/*!numbers?*/known[i]->who/*:known[i]->num*/,
known[i]->usage[DIALIN] + known[i]->usage[DIALOUT],
double2clock(known[i]->dur[DIALIN] + known[i]->dur[DIALOUT]),
known[i]->usage[DIALOUT]?print_currency(known[i]->pay,0):
fill_spaces(print_currency(known[i]->pay,0)),
set_byte_string(GET_IN|GET_BYTES,
known[i]->ibytes[DIALIN] + known[i]->ibytes[DIALOUT]),
set_byte_string(GET_OUT|GET_BYTES,
known[i]->obytes[DIALIN] + known[i]->obytes[DIALOUT]) );
/* the last two arguments may be excessive */
} /* if */
} /* for */
print_line2(F_BODY_BOTTOM2,"");
} /* /if show foreign in&out summary */
if (!incomingonly && sel_sums[RESULT] & SUM_ZONE)
{
/* zone summary (outgoing) ----------------------------------------- */
int ztypes = 0;
@ -987,7 +1048,10 @@ static int print_bottom(double unit, char *start, char *stop)
}
print_line2(F_BODY_BOTTOM2,"");
} /* /if show zone summary */
if (!incomingonly && sel_sums[RESULT] & SUM_PROV)
{
/* provider summary (outgoing) ------------------------------------- */
/* prev.: 60.0 */
h_percent = 80.0;
@ -1022,6 +1086,10 @@ static int print_bottom(double unit, char *start, char *stop)
print_line2(F_BODY_BOTTOM2,"");
} /* /if show provider summary */
if (!incomingonly && sel_sums[RESULT] & SUM_MSN)
{
/* MSN summary (outgoing) ------------------------------------------ */
h_percent = 60.0;
h_table_color = H_TABLE_COLOR5;
@ -1043,7 +1111,7 @@ static int print_bottom(double unit, char *start, char *stop)
s2 += dur_sum[k];
} /* if */
} /* for */
}
} /* /if show MSN summary */
#if 0
if (s) {
@ -3778,6 +3846,31 @@ static int app_fmt_string(char *target, int targetlen, char *fmt, int condition,
return snprintf(target,targetlen,tmpfmt,value);
}
/*****************************************************************************/
/* returns 0 if check is allowed by -x option, 1 if not, 2 in case of error */
static int check_day_hour(bitfield *days, bitfield *hours, const time_t check)
{
struct tm *tp, t;
if (!days[INCLUDE] && !days[EXCLUDE] && !hours[INCLUDE] && !hours[EXCLUDE])
return 0;
if ( !(tp = localtime(&check)) )
return 2;
t = *tp; /* save result from further time.h functioncalls */
if ( hours[INCLUDE] && !(hours[INCLUDE] & (1 << t.tm_hour)) )
return 1; /* hour is not included */
if ( hours[EXCLUDE] && hours[EXCLUDE] & (1 << t.tm_hour) )
return 1; /* hour is excluded */
if ( days[INCLUDE] && !isDay(&t, days[INCLUDE], 0) )
return 1; /* day is not included */
if ( days[EXCLUDE] && isDay(&t, days[EXCLUDE], 0) )
return 1; /* day is excluded */
return 0;
} /* /check_day_hour() */
/*****************************************************************************/
/* find provider for recalculation of connection fees (-r Option) */
int prep_recalc (void)
@ -3841,5 +3934,144 @@ int prep_recalc (void)
return 1;
}
/*****************************************************************************/
/* parse contents of select summaries option,
* with NULL as input, all summaries are enabled as default */
int select_summaries(int *list, char *input)
{
int bit=1;
char *s=SUM__CHARS;
if (input)
while (*s)
{
if ( strchr(input, *s) )
list[INCLUDE] |= bit;
if ( strchr(input, toupper(*s)) )
list[EXCLUDE] |= bit;
bit <<= 1;
s++;
}
list[RESULT] = list[INCLUDE] ? list[INCLUDE] : SUM_ALL;
list[RESULT] &= ~list[EXCLUDE];
return list[RESULT];
}
/*****************************************************************************/
/* parse contents of select day/hour option,
* result is NULL for correct option or pointer to first failed char */
char *select_day_hour(bitfield *days, bitfield *hours, char *input)
{
char *s=input, *t;
int inex;
char a, b, c;
int i, j, k;
if (!s || !*s)
return NULL;
s--; /* char before [dDhH] */
do
{
/* first char selects day/hour include/EXCLUDE */
inex = islower(*++s) ? INCLUDE : EXCLUDE;
if (tolower(*s) == 'd')
{
do
{
t = ++s; /* move behind 'd', 'D', or ',' */
if (isdigit(*s))
{
a = b = *s++;
if (*s == '-')
{
s++;
b = *s++;
}
if (a < '1' || b < '1' || a > '7' || b > '7')
return t;
if (a <= b)
for (c=a; c <= b; c++) /* e.g. 1-1 or 1-5 */
days[inex] |= 1 << (MONDAY + (c - '1'));
else
{
for (c=a; c <= '7'; c++) /* e.g. 6-1 -> 6-7, 1-1 */
days[inex] |= 1 << (MONDAY + (c - '1'));
for (c='1'; c <= b; c++)
days[inex] |= 1 << (MONDAY + (c - '1'));
}
}
else
{
if (*s == 'W')
days[inex] |= 1 << WORKDAY;
else if (*s == 'E')
days[inex] |= 1 << WEEKEND;
else if (*s == 'H')
days[inex] |= 1 << HOLIDAY;
else if (*s == '*')
days[inex] |= 1 << EVERYDAY;
else
return s;
s++;
}
}
while (*s == ',');
}
else if (tolower(*s) == 'h')
{
do
{
t = ++s; /* move behind 'h', 'H', or ',' */
if (*s == '*')
{
i = 0; j = 24;
s++;
}
else
{
errno = 0;
i = j = (int) strtol(s, &s, 10);
if (errno)
return s;
if (*s == '-')
{
s++;
errno = 0;
j = (int) strtol(s, &s, 10);
if (errno)
return s;
}
i = (i==24) ? 0 : i;
j = (j==24) ? 0 : j;
j = (i==j) ? j+1 : j; /* e.g. 17-17 (wrong) -> 17-18 */
j = (j==24) ? 0 : j;
if (i < 0 || j < 0 || i > 23 || j > 23)
return t; /* wrong values in range */
}
if (i <= j)
for (k=i; k < j; k++) /* e.g. 09-18 */
hours[inex] |= 1 << k;
else
{
for (k=i; k < 24; k++) /* e.g. 18-09 -> 18-00, 00-18 */
hours[inex] |= 1 << k;
for (k=0; k < j; k++)
hours[inex] |= 1 << k;
}
}
while (*s == ',');
}
else
return s;
}
while (*s == ':');
if (*s)
return s;
#if DEBUG
fprintf(stderr, "xopt: d= %04X, D= %04X, h= %07X, H= %07X\n",
(int) days[INCLUDE], (int) days[EXCLUDE],
(int) hours[INCLUDE], (int) hours[EXCLUDE]);
#endif
return NULL;
} /* /select_day_hour() */
/* vim:set ts=2: */
/*****************************************************************************/

View File

@ -20,6 +20,37 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
* Revision 1.22 2003/10/29 17:41:35 tobiasb
* isdnlog-4.67:
* - Enhancements for isdnrep:
* - New option -r for recomputing the connection fees with the rates
* from the current (and for a different or the cheapest provider).
* - Revised output format of summaries at end of report.
* - New format parameters %j, %v, and %V.
* - 2 new input formats for -t option.
* - Fix for dualmode workaround 0x100 to ensure that incoming calls
* will not become outgoing calls if a CALL_PROCEEDING message with
* an B channel confirmation is sent by a terminal prior to CONNECT.
* - Fixed and enhanced t: Tag handling in pp_rate.
* - Fixed typo in interface description of tools/rate.c
* - Fixed typo in tools/isdnrate.man, found by Paul Slootman.
* - Minor update to sample isdn.conf files:
* - Default isdnrep format shows numbers with 16 chars (+ & 15 digits).
* - New isdnrep format (-FNIO) without display of transfered bytes.
* - EUR as currency in Austria, may clash with outdated rate-at.dat.
* The number left of the currency symbol is nowadays insignificant.
* - Changes checked in earlier but after step to isdnlog-4.66:
* - New option for isdnrate: `-rvNN' requires a vbn starting with NN.
* - Do not compute the zone with empty strings (areacodes) as input.
* - New ratefile tags r: und t: which need an enhanced pp_rate.
* For a tag description see rate-files(5).
* - Some new and a few updated international cellphone destinations.
*
* NOTE: If there any questions, problems, or problems regarding isdnlog,
* feel free to join the isdn4linux mailinglist, see
* https://www.isdn4linux.de/mailman/listinfo/isdn4linux for details,
* or send a mail in English or German to <tobiasb@isdn4linux.de>.
*
* Revision 1.21 2000/10/15 12:53:04 leo
* Changed iobytes to double
*
@ -180,9 +211,7 @@ typedef struct {
} RECALC;
/*****************************************************************************/
/* isdnrep.c defines _REP_FUNC_C_, rep_main.c definies _ISDNREP_C_, ... */
/* isdnrep.c defines _REP_FUNC_C_, rep_main.c defines _ISDNREP_C_, ... */
#ifdef _REP_FUNC_C_
#define _EXTERN
#define _SET_NULL = NULL
@ -190,6 +219,7 @@ typedef struct {
#define _SET_1 = 1
#define _SET_33 = 33
#define _SET_EMPTY = ""
#define _SET_ARRAY_0 = { 0 }
#else
#define _EXTERN extern
#define _SET_NULL
@ -197,6 +227,7 @@ typedef struct {
#define _SET_1
#define _SET_33
#define _SET_EMPTY
#define _SET_ARRAY_0
#define _SET_FILE
#endif
@ -206,6 +237,8 @@ _EXTERN int set_msnlist(char *String);
_EXTERN int send_html_request(char *myname, char *option);
_EXTERN int new_args(int *nargc, char ***nargv);
_EXTERN int prep_recalc(void);
_EXTERN int select_summaries(int *list, char *input);
_EXTERN char *select_day_hour(bitfield *days, bitfield *hours, char *input);
_EXTERN int print_msg(int Level, const char *, ...);
_EXTERN int incomingonly _SET_0;
@ -228,12 +261,16 @@ _EXTERN time_t endtime _SET_0;
_EXTERN int preselect _SET_33;
#endif
_EXTERN int summary _SET_0;
_EXTERN RECALC recalc; /* initialiation done in main */
_EXTERN RECALC recalc; /* initiation done in main */
_EXTERN int sel_sums[3] _SET_ARRAY_0;
_EXTERN bitfield days[2] _SET_ARRAY_0;
_EXTERN bitfield hours[2] _SET_ARRAY_0;
#undef _SET_NULL
#undef _SET_0
#undef _SET_1
#undef _SET_EMPTY
#undef _SET_ARRAY_0
#undef _EXTERN
/*****************************************************************************/

View File

@ -20,6 +20,37 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
* Revision 1.17 2003/10/29 17:41:35 tobiasb
* isdnlog-4.67:
* - Enhancements for isdnrep:
* - New option -r for recomputing the connection fees with the rates
* from the current (and for a different or the cheapest provider).
* - Revised output format of summaries at end of report.
* - New format parameters %j, %v, and %V.
* - 2 new input formats for -t option.
* - Fix for dualmode workaround 0x100 to ensure that incoming calls
* will not become outgoing calls if a CALL_PROCEEDING message with
* an B channel confirmation is sent by a terminal prior to CONNECT.
* - Fixed and enhanced t: Tag handling in pp_rate.
* - Fixed typo in interface description of tools/rate.c
* - Fixed typo in tools/isdnrate.man, found by Paul Slootman.
* - Minor update to sample isdn.conf files:
* - Default isdnrep format shows numbers with 16 chars (+ & 15 digits).
* - New isdnrep format (-FNIO) without display of transfered bytes.
* - EUR as currency in Austria, may clash with outdated rate-at.dat.
* The number left of the currency symbol is nowadays insignificant.
* - Changes checked in earlier but after step to isdnlog-4.66:
* - New option for isdnrate: `-rvNN' requires a vbn starting with NN.
* - Do not compute the zone with empty strings (areacodes) as input.
* - New ratefile tags r: und t: which need an enhanced pp_rate.
* For a tag description see rate-files(5).
* - Some new and a few updated international cellphone destinations.
*
* NOTE: If there any questions, problems, or problems regarding isdnlog,
* feel free to join the isdn4linux mailinglist, see
* https://www.isdn4linux.de/mailman/listinfo/isdn4linux for details,
* or send a mail in English or German to <tobiasb@isdn4linux.de>.
*
* Revision 1.16 2003/07/25 22:18:03 tobiasb
* isdnlog-4.65:
* - New values for isdnlog option -2x / dual=x with enable certain
@ -256,30 +287,38 @@
/*****************************************************************************/
static int parse_options(int argc, char *argv[], char *myname);
int print_msg(int Level, const char *fmt, ...);
int print_in_modules(const char *fmt, ...);
static int set_linefmt(char *linefmt);
/*****************************************************************************/
static char fnbuff[512] = "";
static char usage[] = "%s: usage: %s [ -%s ]\n";
static char wrongdate[] = "unknown date: %s\n";
static char wrongxopt[] = "error in -x option starting at: %s\n";
static char options[] = "abcd:f:hinop:r:s:t:uvw:x:EF:L:M:NR:SV";
static char *linefmt = "";
static char *htmlreq = NULL;
static char *phonenumberarg = NULL;
static int do_defopts = 1;
/*****************************************************************************/
int main(int argc, char *argv[], char *envp[])
{
auto int c;
auto char fnbuff[512] = "";
auto char usage[] = "%s: usage: %s [ -%s ]\n";
auto char wrongdate[] = "unknown date: %s\n";
auto char options[] = "ad:f:hinop:r:s:t:uvw:NVF:M:R:bES";
auto char *myname = basename(argv[0]);
auto char *ptr = NULL;
auto char *linefmt = "";
auto char *htmlreq = NULL;
auto char *phonenumberarg = NULL;
auto char **pptr;
set_print_fct_for_tools(print_in_modules);
recalc.mode = '\0'; recalc.prefix = UNKNOWN; recalc.input = NULL;
recalc.count = recalc.unknown = recalc.cheaper = 0;
select_summaries(sel_sums, NULL); /* default: all summaries */
/* we don't need this at the moment:
new_args(&argc,&argv);
@ -293,6 +332,106 @@ int main(int argc, char *argv[], char *envp[])
* set_msnlist after readconfig.
*/
if ((c=parse_options(argc, argv, myname) > 0))
return c;
if (readconfig(myname) != 0)
return 1;
pptr = (char **) 0;
while (do_defopts && isdnrep_defopts) /* default options from isdn.conf */
{
int dargc;
char **dargv;
pptr = String_to_Array(isdnrep_defopts, ';');
if (!pptr)
break;
dargc = 0;
dargv = pptr;
while (*dargv++)
dargc++;
if (!dargc)
break;
dargv = (char **) calloc(dargc+2, sizeof(char *));
if (!dargv)
break;
dargv[0] = argv[0];
memcpy(dargv+1, pptr, dargc * sizeof(char *));
if ((c=parse_options(dargc+1, dargv, myname) > 0))
return c;
break;
}
if (pptr)
del_Array(pptr);
if (phonenumberonly && phonenumberarg != NULL) {
set_msnlist(phonenumberarg);
free(phonenumberarg);
}
if (htmlreq)
{
send_html_request(myname,htmlreq);
exit(0);
}
if (!html && (ptr = strrchr(myname,'.')) != NULL && !strcasecmp(ptr+1,"cgi"))
html = H_PRINT_HEADER;
if (html)
{
seeunknowns = 0;
header++;
}
if (linefmt != NULL)
{
if (*linefmt == '\0')
{
if (html)
set_linefmt("WWW");
else
set_linefmt(linefmt);
}
else
{
if (set_linefmt(linefmt))
{
printf("Error: %s can not find format `%s%s'!\n",myname,CONF_ENT_REPFMT,To_Upper(linefmt));
exit(0);
}
}
}
if (!currency_factor)
currency = "EUR";
if (fnbuff[0])
logfile = fnbuff;
return (read_logfile(myname));
}
/*****************************************************************************/
/* handle options from cammandline and isdn.conf */
static int parse_options(int argc, char *argv[], char *myname)
{
auto int c;
auto char *ptr = NULL;
/* reset internal state of getopt ...
* for an explanation look at bugs.debian.org, bug #192834 */
#ifdef __GLIBC__
optind = 0;
#else
optind = 1;
#endif
while ((c = getopt(argc, argv, options)) != EOF)
switch (c) {
case 'a' : timearea++;
@ -346,7 +485,8 @@ int main(int argc, char *argv[], char *envp[])
linefmt = NULL;
break;
case 'F' : linefmt = strdup(optarg);
case 'F' : if (linefmt && !*linefmt)
linefmt = strdup(optarg);
break;
case 'N' : use_new_config = 0;
@ -371,62 +511,28 @@ int main(int argc, char *argv[], char *envp[])
recalc.input = strdup(optarg+1);
break;
case 'L' : select_summaries(sel_sums, optarg);
break;
case 'x' : ptr = select_day_hour(days, hours, optarg);
if (ptr) {
printf(wrongxopt, ptr);
return 1;
}
break;
case 'c' : do_defopts = 0;
break;
case '?' : printf(usage, argv[0], argv[0], options);
return(1);
} /* switch */
if (readconfig(myname) != 0)
return 1;
if (phonenumberonly && phonenumberarg != NULL) {
set_msnlist(phonenumberarg);
free(phonenumberarg);
}
if (htmlreq)
{
send_html_request(myname,htmlreq);
exit(0);
}
if (!html && (ptr = strrchr(myname,'.')) != NULL && !strcasecmp(ptr+1,"cgi"))
html = H_PRINT_HEADER;
if (html)
{
seeunknowns = 0;
header++;
}
if (linefmt != NULL)
{
if (*linefmt == '\0')
{
if (html)
set_linefmt("WWW");
else
set_linefmt(linefmt);
}
else
{
if (set_linefmt(linefmt))
{
printf("Error: %s can not find format `%s%s'!\n",myname,CONF_ENT_REPFMT,To_Upper(linefmt));
exit(0);
}
}
}
if (!currency_factor)
currency = "EUR";
if (fnbuff[0])
logfile = fnbuff;
return (read_logfile(myname));
}
return 0;
} /* /parse_options() */
/*****************************************************************************/
int print_msg(int Level, const char *fmt,...)
{
auto va_list ap;