isdnctrl.man.in

This commit is contained in:
paul 1999-06-07 19:25:38 +00:00
parent 162ca299aa
commit d93ee4f68b
2 changed files with 89 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $Id: isdnctrl.c,v 1.32 1998/12/23 12:51:44 paul Exp $
/* $Id: isdnctrl.c,v 1.33 1999/06/07 19:25:38 paul Exp $
* ISDN driver for Linux. (Control-Utility)
*
* Copyright 1994,95 by Fritz Elfert (fritz@wuemaus.franken.de)
@ -21,6 +21,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnctrl.c,v $
* Revision 1.33 1999/06/07 19:25:38 paul
* isdnctrl.man.in
*
* Revision 1.32 1998/12/23 12:51:44 paul
* didn't compile with old kernel source
*
@ -213,8 +216,14 @@
#include <string.h>
#include <time.h>
#include <ctype.h>
#include <errno.h>
#include <linux/isdn.h>
/* fix version skew between 2.0 and 2.1 kernels (structs are identical) */
#if (NET_DV == 0x04)
# undef NET_DV
# define NET_DV 0x05
#endif
#include <linux/isdnif.h>
#include "config.h"
@ -320,6 +329,7 @@ void usage(void)
fprintf(stderr, " writeconf [file] write the settings to file\n");
fprintf(stderr, " readconf [file] read the settings from file\n");
#endif /* I4L_CTRL_CONF */
fprintf(stderr, " status name show interface status (connected or not)\n");
#ifdef I4L_CTRL_TIMRU
fprintf(stderr,"Note: TIMRU Ctrl Extension-Support enabled\n");
#else
@ -513,6 +523,49 @@ static void listif(int isdnctrl, char *name, int errexit)
nextslaveif[0] = 0;
}
#ifdef IIOCNETGPN
static void statusif(int isdnctrl, char *name, int errexit)
{
isdn_net_ioctl_phone phone;
int rc;
static int isdninfo = -1;
if (isdninfo < 0) {
isdninfo = open("/dev/isdninfo", O_RDONLY);
if (isdninfo < 0) {
perror("Can't open /dev/isdninfo");
exit(-1);
}
}
memset(&phone, 0, sizeof phone);
strncpy(phone.name, name, sizeof phone.name);
rc = ioctl(isdninfo, IIOCNETGPN, &phone);
if (rc == 0) {
printf("%s connected %s %s\n",
name, phone.outgoing?"to":"from", phone.phone);
return;
}
if (errno == ENOTCONN) {
printf("%s is not connected\n", name);
if (errexit) {
exit(1); /* exit 1 if interface specified & not conn. */
}
return;
}
if (errno == EINVAL) {
puts("Sorry, not configured in your kernel");
exit(-1);
}
if (errexit) {
perror(name);
exit(-1);
}
}
#else
#warning IIOCNETGPN not defined? Old isdn4kernel? Or 2.0.x kernel...
#endif
int findcmd(char *str)
{
int i;
@ -913,6 +966,32 @@ int exec_args(int fd, int argc, char **argv)
listif(fd, id, 1);
break;
case STATUS:
#ifdef IIOCNETGPN
if (!strcmp(id, "all")) {
char name[10];
if ((iflst = fopen(FILE_PROC, "r")) == NULL) {
perror(FILE_PROC);
return -1;
}
while (!feof(iflst)) {
fgets(s, sizeof(s), iflst);
if ((p = strchr(s, ':'))) {
*p = 0;
sscanf(s, "%s", name);
statusif(fd, name, 0);
while (*nextslaveif)
statusif(fd, nextslaveif, 0);
}
}
fclose(iflst);
} else
statusif(fd, id, 1);
#else
puts("Sorry, not configured into isdnctrl");
#endif /* defined IIOCNETGPN */
break;
case EAZ:
strcpy(cfg.name, id);
if ((result = ioctl(fd, IIOCNETGCF, &cfg)) < 0) {
@ -1568,6 +1647,9 @@ void check_version(int report) {
return;
}
data_version = (data_version >> 8) & 0xff;
/* consider NET_DV 0x04 and 0x05 to be the same */
if (data_version == 0x04)
data_version = 0x05;
if (data_version != NET_DV) {
fprintf(stderr, "Version of kernel ioctl structs (%d) does NOT match\n",
data_version);

View File

@ -1,4 +1,4 @@
/* $Id: isdnctrl.h,v 1.13 1999/03/15 15:53:06 cpetig Exp $
/* $Id: isdnctrl.h,v 1.14 1999/06/07 19:25:42 paul Exp $
* ISDN driver for Linux. (Control-Utility)
*
* Copyright 1994,95 by Fritz Elfert (fritz@wuemaus.franken.de)
@ -21,6 +21,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnctrl.h,v $
* Revision 1.14 1999/06/07 19:25:42 paul
* isdnctrl.man.in
*
* Revision 1.13 1999/03/15 15:53:06 cpetig
* added v110 and modem to the level2 encapsulations
*
@ -113,6 +116,7 @@ enum {
#ifdef I4L_CTRL_CONF
WRITECONF, READCONF,
#endif /* I4L_CTRL_CONF */
STATUS,
IFDEFAULTS
};
@ -182,6 +186,7 @@ cmd_struct cmds[] =
{"writeconf", "01"},
{"readconf", "01"},
#endif /* I4L_CTRL_CONF */
{"status", "1"},
{"ifdefaults", "01"},
{NULL,}
};