isdnlog: Added the switch -K

This commit is contained in:
luethje 1998-10-18 20:13:23 +00:00
parent 508fe741d9
commit 846b052226
6 changed files with 58 additions and 25 deletions

View File

@ -2310,6 +2310,10 @@ angegeben werden.
einzelne gewaehlte Digit beim Telefonieren direkt an.
(dual="value")
-K Schreibt bei jedem Tastendruck einen Datendurchsatz. Kann nicht zusammen
mit Option -d verwendet werden!
(keyboard={yes|no})
Bei den Optionen -mX, -lX -xX sind folgende Flags moeglich:

View File

@ -1,5 +1,5 @@
.\" $Id: isdnlog.8,v 1.2 1998/06/18 14:27:19 paul Exp $
.\" CHECKIN $Date: 1998/06/18 14:27:19 $
.\" $Id: isdnlog.8,v 1.3 1998/10/18 20:13:30 luethje Exp $
.\" CHECKIN $Date: 1998/10/18 20:13:30 $
.TH isdnlog 8 "@MANDATE@" "ISDN 4 Linux @I4LVERSION@" "Linux System Administration"
.PD 0
.SH NAME
@ -122,6 +122,10 @@ as the default logging method (if you did not specify -m).
Trace mode: isdnlog will wait for a key after processing a line from
/dev/isdnctrl0 (or whatever device you specified).
.TP
.B \-K
Print for every pressed key the thruput. Can not used together with option -d.
.TP
.B \-b
If you are using a bilingual network terminator (NT), you must give this

View File

@ -1,4 +1,4 @@
/* $Id: isdnlog.c,v 1.23 1998/10/06 12:50:57 paul Exp $
/* $Id: isdnlog.c,v 1.24 1998/10/18 20:13:33 luethje Exp $
*
* ISDN accounting for isdn4linux. (log-module)
*
@ -19,6 +19,9 @@
* along with this program; if not, write to the Free Software
*
* $Log: isdnlog.c,v $
* Revision 1.24 1998/10/18 20:13:33 luethje
* isdnlog: Added the switch -K
*
* Revision 1.23 1998/10/06 12:50:57 paul
* As the exec is done within the signal handler, SIGHUP was blocked after the
* first time. Now SIGHUP is unblocked so that you can send SIGHUP more than once.
@ -180,9 +183,9 @@ static int read_param_file(char *FileName);
static char usage[] = "%s: usage: %s [ -%s ] file\n";
#ifdef Q931
static char options[] = "av:sp:x:m:l:rt:c:C:w:SVTDPMh:nW:H:f:bL:NqFA:2:O:";
static char options[] = "av:sp:x:m:l:rt:c:C:w:SVTDPMh:nW:H:f:bL:NqFA:2:O:K";
#else
static char options[] = "av:sp:x:m:l:rt:c:C:w:SVTDPMh:nW:H:f:bL:NFA:2:O:";
static char options[] = "av:sp:x:m:l:rt:c:C:w:SVTDPMh:nW:H:f:bL:NFA:2:O:K";
#endif
static char msg1[] = "%s: Can't open %s (%s)\n";
static char *ptty = NULL;
@ -409,6 +412,7 @@ static void init_variables(int argc, char* argv[])
mcalls = MAX_CALLS_IN_QUEUE;
xlog = MAX_PRINTS_IN_QUEUE;
outfile = NULL;
readkeyboard = 0;
sockets = NULL;
known = NULL;
@ -580,6 +584,9 @@ int set_options(int argc, char* argv[])
case 'O' : outfile = strdup(optarg);
break;
case 'K' : readkeyboard++;
break;
case '?' : printf(usage, myshortname, myshortname, options);
exit(1);
} /* switch */
@ -587,6 +594,11 @@ int set_options(int argc, char* argv[])
if (newmessage)
message = newmessage;
if (readkeyboard && isdaemon) {
printf("%s","Can read from standard input daemonized!\n");
exit(20);
} /* if */
if (trace && isdaemon) {
printf("%s","Can not trace daemonized!\n");
exit(20);
@ -738,6 +750,9 @@ static int read_param_file(char *FileName)
else
if (!strcmp(Ptr->name,CONF_ENT_OUTFILE))
outfile = Ptr->value;
else
if (!strcmp(Ptr->name,CONF_ENT_KEYBOARD))
readkeyboard = toupper(*(Ptr->value)) == 'Y'?1:0;
else
print_msg(PRT_ERR,"Error: Invalid entry `%s'!\n",Ptr->name);
@ -1046,9 +1061,9 @@ int main(int argc, char *argv[], char *envp[])
if (replay || ((sockets[ISDNINFO].descriptor = open(INFO, O_RDONLY | O_NONBLOCK)) >= 0)) {
if (!isdaemon) {
raw_mode(1);
sockets[STDIN].descriptor = dup(fileno(stdin));
if (readkeyboard) {
raw_mode(1);
sockets[STDIN].descriptor = dup(fileno(stdin));
} /* if */
now();
@ -1098,7 +1113,7 @@ int main(int argc, char *argv[], char *envp[])
if (*isdnctrl2)
close(sockets[ISDNCTRL2].descriptor);
if (!isdaemon) {
if (readkeyboard) {
raw_mode(0);
close(sockets[STDIN].descriptor);
} /* if */

View File

@ -1,4 +1,4 @@
/* $Id: isdnlog.h,v 1.10 1998/09/26 18:29:10 akool Exp $
/* $Id: isdnlog.h,v 1.11 1998/10/18 20:13:37 luethje Exp $
*
* ISDN accounting for isdn4linux.
*
@ -20,6 +20,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnlog.h,v $
* Revision 1.11 1998/10/18 20:13:37 luethje
* isdnlog: Added the switch -K
*
* Revision 1.10 1998/09/26 18:29:10 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 !!
@ -307,6 +310,7 @@ _EXTERN char *isdnctrl;
_EXTERN char isdnctrl2[FNSIZE];
_EXTERN char *outfile;
_EXTERN char tmpout[PATH_MAX];
_EXTERN int readkeyboard;
_EXTERN IFO ifo[ISDN_MAX_CHANNELS];
_EXTERN IO io[ISDN_MAX_CHANNELS];

View File

@ -1,4 +1,4 @@
/* $Id: tools.h,v 1.20 1998/09/26 18:30:18 akool Exp $
/* $Id: tools.h,v 1.21 1998/10/18 20:13:44 luethje Exp $
*
* ISDN accounting for isdn4linux.
*
@ -20,6 +20,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: tools.h,v $
* Revision 1.21 1998/10/18 20:13:44 luethje
* isdnlog: Added the switch -K
*
* Revision 1.20 1998/09/26 18:30:18 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 !!
@ -456,6 +459,7 @@
#define CONF_ENT_DUAL "DUAL"
#define CONF_ENT_Q931 "Q931DUMP"
#define CONF_ENT_OUTFILE "OUTFILE"
#define CONF_ENT_KEYBOARD "KEYBOARD"
/****************************************************************************/

View File

@ -1,4 +1,4 @@
/* $Id: libtools.c,v 1.8 1998/10/13 22:17:22 luethje Exp $
/* $Id: libtools.c,v 1.9 1998/10/18 20:13:51 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.9 1998/10/18 20:13:51 luethje
* isdnlog: Added the switch -K
*
* Revision 1.8 1998/10/13 22:17:22 luethje
* isdnlog: evaluate the variable PATH for program starts.
*
@ -693,18 +696,6 @@ const char *Pathfind(const char *path, const char *name, char *mode)
if (name == NULL)
return NULL;
if (path == NULL)
{
if ((ptr = getenv(PATH_ENV)) == NULL)
return NULL;
Strncpy(_path,ptr,PATH_MAX);
ptr = _path;
_mode = X_OK;
}
else
Strncpy(_path,path,PATH_MAX);
if (mode != NULL)
while (*mode)
{
@ -720,13 +711,24 @@ const char *Pathfind(const char *path, const char *name, char *mode)
}
}
if (strchr(name,C_SLASH) != NULL)
if (!access(name,_mode))
return name;
else
return NULL;
if (path == NULL)
{
if ((ptr = getenv(PATH_ENV)) == NULL)
return NULL;
Strncpy(_path,ptr,PATH_MAX);
ptr = _path;
_mode |= X_OK;
}
else
Strncpy(_path,path,PATH_MAX);
while((ptr = strtok(ptr,":")) != NULL)
{
snprintf(file,PATH_MAX-1,"%s/%s",ptr,name);