Add SYNOPSIS section and change NULL to NUL in man page. Add rcsid, missing

#includes. Use err(3).
This commit is contained in:
charnier 1998-06-30 06:12:44 +00:00
parent dd60667f41
commit 7b48eaad27
4 changed files with 116 additions and 148 deletions

View File

@ -1,11 +1,15 @@
.\" $Id$
.Dd December 2, 1994
.Dt CXCONFIG 8
.Os FreeBSD
.Sh NAME
.Nm cxconfig
.Nd channel options management utility for Cronyx-Sigma adapter
.Sh SYNOPSIS
.Nm cxconfig
.Op Fl a
.Op Ar <channel> Op Ar <option>...
.Sh DESCRIPTION
.Pp
The
.Nm
utility is used for configuring the channel options of
@ -23,18 +27,11 @@ file.
Note, that not all options have a sense for every particular
case, and an attempt to set some of them can hang up the channel or
the whole adapter.
.Sh "Usage"
.Bl -tag -width 10n
.It "cxconfig"
The brief information about all channels.
.It "cxconfig -a"
The full information about all channels.
.It "cxconfig <channel>"
The brief information about the channel.
.It "cxconfig -a <channel>"
The full information about the channel.
.It "cxconfig <channel> <option>..."
Setting the channel options.
.Pp
The following option is available:
.Bl -tag -width indent
.It Fl a
Display full information.
.El
.Sh "Channel options"
.Bl -tag -width 10n
@ -105,7 +102,7 @@ source or
.Em "internal clock"
generation.
.Pp
.Em"External clock"
.Em "External clock"
mode is the most common method for connecting
external modem hardware. In this mode the external timing
signal is received on TXCIN pin of the connector, and it is
@ -183,13 +180,13 @@ Action
.It parintr
Generate the receiver error interrupt
.It parnull
Input the NULL character
Input the NUL character
.It parign
Ignore the error, receive as good data
.It pardisc
Ignore the character
.It parffnull
Input the sequence <0xFF, NULL, character>
Input the sequence <0xFF, NUL, character>
.El
.It "brkintr, brknull, brkdisc
Line break state action:
@ -200,7 +197,7 @@ Action
.It brkintr
Generate the receiver error interrupt
.It brknull
Input the NULL character
Input the NUL character
.It brkdisc
Ignore the line break state
.El
@ -279,8 +276,8 @@ Send sync pattern.
Frame address registers for address recognition.
.El
.Sh EXAMPLES
.Pp
Set up the channel 7 of the adapter Sigma-400 under FreeBSD.
Set up the channel 7 of the adapter Sigma-400 under
.Bx Free .
Physical 4-wire leased line with Zelax+ M115 short-range modems.
Synchronous mode, 128000 bits/sec, interface RS-232,
protocol PpP/HDLC without keepalive support, NRZI encoding,
@ -290,7 +287,8 @@ cxconfig cx7 128000 hdlc ppp -keepalive nrzi -cts +dpll -extclock
ifconfig cx7 158.250.244.2 158.250.244.1 up
.Ed
.Pp
Set up the channel 0 of the adapter Sigma-100 under FreeBSD.
Set up the channel 0 of the adapter Sigma-100 under
.Bx Free .
Attachment to the near computer by short cable, internal clock source.
Synchronous mode, 256000 bits/sec, interface RS-232,
protocol Cisco/HDLC with keepalive support:
@ -307,7 +305,8 @@ cxconfig cx1 hdlc ext
ifconfig cx1 193.124.254.50 193.124.254.49 multicast up
.Ed
.Pp
Set up the channel 0 of the adapter Sigma-840 under FreeBSD.
Set up the channel 0 of the adapter Sigma-840 under
.Bx Free .
Attachment to the Cisco-4000 router by null-modem cable, internal clock source.
Synchronous mode, 64000 bits/sec, interface RS-232,
protocol PpP/HDLC with keepalive support and flow control,
@ -317,7 +316,9 @@ cxconfig cx0 hdlc 64000 port=rs232 ppp +keepalive -extclock +cts
ifconfig cx0 100.0.0.2 100.0.0.1 debug up
.Ed
.Sh FILES
.Bl -tag -width /dev/cronyx -compact
.Pa /dev/cronyx
The special device file for adapter options management.
the special device file for adapter options management
.El
.Sh SEE ALSO
.Xr cx 4

View File

@ -21,12 +21,23 @@
* cxconfig <channel> <option>...
* -- set channel options
*/
#ifndef lint
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <err.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <machine/cronyx.h>
#include <net/if.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define NBRD 3
#define CXDEV "/dev/cronyx"
@ -54,8 +65,6 @@ char *symbol (unsigned char sym)
unsigned char atosym (char *s)
{
unsigned char c;
if (*s == '^')
return (*++s & 037);
if (*s == '\\')
@ -65,16 +74,10 @@ unsigned char atosym (char *s)
void usage ()
{
printf ("Cronyx-Sigma Adapter Configuration Utility, Version 1.0\n");
printf ("Copyright (C) 1994 Cronyx Ltd.\n");
printf ("Usage:\n");
printf ("\tcxconfig [-a]\n");
printf ("\t\t-- print status of all channels\n");
printf ("\tcxconfig [-a] <channel>\n");
printf ("\t\t-- print status of the channel\n");
printf ("\tcxconfig <channel> [async | hdlc | bisync | x.21] [ispeed #] [ospeed #]\n");
printf ("\t\t[+cts | -cts]\n");
printf ("\t\t-- set channel options\n");
fprintf (stderr,
"Cronyx-Sigma Adapter Configuration Utility, Version 1.0\n");
fprintf (stderr, "Copyright (C) 1994 Cronyx Ltd.\n");
fprintf (stderr, "usage: cxconfig [-a] [<channel> [<option>...]]\n");
exit (1);
}
@ -106,22 +109,16 @@ char *chanmode (int mode)
void getchan (int channel)
{
int s = open (CXDEV, 0);
if (s < 0) {
perror (CXDEV);
exit (1);
}
if (s < 0)
err (1, "%s", CXDEV);
o.board = channel/NCHAN;
o.channel = channel%NCHAN;
if (ioctl (s, CXIOCGETMODE, (caddr_t)&o) < 0) {
perror ("cxconfig: CXIOCGETMODE");
exit (1);
}
if (ioctl (s, CXIOCGETMODE, (caddr_t)&o) < 0)
err (1, "CXIOCGETMODE");
close (s);
if (o.type == T_NONE) {
fprintf (stderr, "cx%d: channel %d not configured\n", o.board,
if (o.type == T_NONE)
errx (1, "cx%d: channel %d not configured", o.board,
o.channel);
exit (1);
}
}
int printstats (int channel, int hflag)
@ -129,10 +126,8 @@ int printstats (int channel, int hflag)
int s, res;
s = open (CXDEV, 0);
if (s < 0) {
perror (CXDEV);
exit (1);
}
if (s < 0)
err (1, "%s", CXDEV);
st.board = channel/NCHAN;
st.channel = channel%NCHAN;
res = ioctl (s, CXIOCGETSTAT, (caddr_t)&st);
@ -161,16 +156,12 @@ void printallstats ()
void setchan (int channel)
{
int s = open (CXDEV, 0);
if (s < 0) {
perror (CXDEV);
exit (1);
}
if (s < 0)
err (1, "%s", CXDEV);
o.board = channel/NCHAN;
o.channel = channel%NCHAN;
if (ioctl (s, CXIOCSETMODE, (caddr_t)&o) < 0) {
perror ("cxconfig: CXIOCSETMODE");
exit (1);
}
if (ioctl (s, CXIOCSETMODE, (caddr_t)&o) < 0)
err (1, "CXIOCSETMODE");
close (s);
}
@ -414,22 +405,16 @@ void printall ()
int s, c;
s = socket (AF_INET, SOCK_DGRAM, 0);
if (s < 0) {
perror ("cxconfig: socket");
exit (1);
}
if (s < 0)
err (1, "socket");
ifc.ifc_len = sizeof (buf);
ifc.ifc_buf = buf;
if (ioctl (s, SIOCGIFCONF, (caddr_t)&ifc) < 0) {
perror ("cxconfig: SIOCGIFCONF");
exit (1);
}
if (ioctl (s, SIOCGIFCONF, (caddr_t)&ifc) < 0)
err (1, "SIOCGIFCONF");
close (s);
s = open (CXDEV, 0);
if (s < 0) {
perror (CXDEV);
exit (1);
}
if (s < 0)
err (1, "%s", CXDEV);
ifr = ifc.ifc_req;
#define max(a,b) ((a)>(b) ? (a) : (b))
@ -443,10 +428,8 @@ void printall ()
c = atoi (ifr->ifr_name + 2);
o.board = c/NCHAN;
o.channel = c%NCHAN;
if (ioctl (s, CXIOCGETMODE, (caddr_t)&o) < 0) {
perror ("cxconfig: CXIOCGETMODE");
exit (1);
}
if (ioctl (s, CXIOCGETMODE, (caddr_t)&o) < 0)
err (1, "CXIOCGETMODE");
printchan (c);
}
close (s);

View File

@ -1,11 +1,15 @@
.\" $Id$
.Dd December 2, 1994
.Dt CXCONFIG 8
.Os FreeBSD
.Sh NAME
.Nm cxconfig
.Nd channel options management utility for Cronyx-Sigma adapter
.Sh SYNOPSIS
.Nm cxconfig
.Op Fl a
.Op Ar <channel> Op Ar <option>...
.Sh DESCRIPTION
.Pp
The
.Nm
utility is used for configuring the channel options of
@ -23,18 +27,11 @@ file.
Note, that not all options have a sense for every particular
case, and an attempt to set some of them can hang up the channel or
the whole adapter.
.Sh "Usage"
.Bl -tag -width 10n
.It "cxconfig"
The brief information about all channels.
.It "cxconfig -a"
The full information about all channels.
.It "cxconfig <channel>"
The brief information about the channel.
.It "cxconfig -a <channel>"
The full information about the channel.
.It "cxconfig <channel> <option>..."
Setting the channel options.
.Pp
The following option is available:
.Bl -tag -width indent
.It Fl a
Display full information.
.El
.Sh "Channel options"
.Bl -tag -width 10n
@ -105,7 +102,7 @@ source or
.Em "internal clock"
generation.
.Pp
.Em"External clock"
.Em "External clock"
mode is the most common method for connecting
external modem hardware. In this mode the external timing
signal is received on TXCIN pin of the connector, and it is
@ -183,13 +180,13 @@ Action
.It parintr
Generate the receiver error interrupt
.It parnull
Input the NULL character
Input the NUL character
.It parign
Ignore the error, receive as good data
.It pardisc
Ignore the character
.It parffnull
Input the sequence <0xFF, NULL, character>
Input the sequence <0xFF, NUL, character>
.El
.It "brkintr, brknull, brkdisc
Line break state action:
@ -200,7 +197,7 @@ Action
.It brkintr
Generate the receiver error interrupt
.It brknull
Input the NULL character
Input the NUL character
.It brkdisc
Ignore the line break state
.El
@ -279,8 +276,8 @@ Send sync pattern.
Frame address registers for address recognition.
.El
.Sh EXAMPLES
.Pp
Set up the channel 7 of the adapter Sigma-400 under FreeBSD.
Set up the channel 7 of the adapter Sigma-400 under
.Bx Free .
Physical 4-wire leased line with Zelax+ M115 short-range modems.
Synchronous mode, 128000 bits/sec, interface RS-232,
protocol PpP/HDLC without keepalive support, NRZI encoding,
@ -290,7 +287,8 @@ cxconfig cx7 128000 hdlc ppp -keepalive nrzi -cts +dpll -extclock
ifconfig cx7 158.250.244.2 158.250.244.1 up
.Ed
.Pp
Set up the channel 0 of the adapter Sigma-100 under FreeBSD.
Set up the channel 0 of the adapter Sigma-100 under
.Bx Free .
Attachment to the near computer by short cable, internal clock source.
Synchronous mode, 256000 bits/sec, interface RS-232,
protocol Cisco/HDLC with keepalive support:
@ -307,7 +305,8 @@ cxconfig cx1 hdlc ext
ifconfig cx1 193.124.254.50 193.124.254.49 multicast up
.Ed
.Pp
Set up the channel 0 of the adapter Sigma-840 under FreeBSD.
Set up the channel 0 of the adapter Sigma-840 under
.Bx Free .
Attachment to the Cisco-4000 router by null-modem cable, internal clock source.
Synchronous mode, 64000 bits/sec, interface RS-232,
protocol PpP/HDLC with keepalive support and flow control,
@ -317,7 +316,9 @@ cxconfig cx0 hdlc 64000 port=rs232 ppp +keepalive -extclock +cts
ifconfig cx0 100.0.0.2 100.0.0.1 debug up
.Ed
.Sh FILES
.Bl -tag -width /dev/cronyx -compact
.Pa /dev/cronyx
The special device file for adapter options management.
the special device file for adapter options management
.El
.Sh SEE ALSO
.Xr cx 4

View File

@ -21,12 +21,23 @@
* cxconfig <channel> <option>...
* -- set channel options
*/
#ifndef lint
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <err.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <machine/cronyx.h>
#include <net/if.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define NBRD 3
#define CXDEV "/dev/cronyx"
@ -54,8 +65,6 @@ char *symbol (unsigned char sym)
unsigned char atosym (char *s)
{
unsigned char c;
if (*s == '^')
return (*++s & 037);
if (*s == '\\')
@ -65,16 +74,10 @@ unsigned char atosym (char *s)
void usage ()
{
printf ("Cronyx-Sigma Adapter Configuration Utility, Version 1.0\n");
printf ("Copyright (C) 1994 Cronyx Ltd.\n");
printf ("Usage:\n");
printf ("\tcxconfig [-a]\n");
printf ("\t\t-- print status of all channels\n");
printf ("\tcxconfig [-a] <channel>\n");
printf ("\t\t-- print status of the channel\n");
printf ("\tcxconfig <channel> [async | hdlc | bisync | x.21] [ispeed #] [ospeed #]\n");
printf ("\t\t[+cts | -cts]\n");
printf ("\t\t-- set channel options\n");
fprintf (stderr,
"Cronyx-Sigma Adapter Configuration Utility, Version 1.0\n");
fprintf (stderr, "Copyright (C) 1994 Cronyx Ltd.\n");
fprintf (stderr, "usage: cxconfig [-a] [<channel> [<option>...]]\n");
exit (1);
}
@ -106,22 +109,16 @@ char *chanmode (int mode)
void getchan (int channel)
{
int s = open (CXDEV, 0);
if (s < 0) {
perror (CXDEV);
exit (1);
}
if (s < 0)
err (1, "%s", CXDEV);
o.board = channel/NCHAN;
o.channel = channel%NCHAN;
if (ioctl (s, CXIOCGETMODE, (caddr_t)&o) < 0) {
perror ("cxconfig: CXIOCGETMODE");
exit (1);
}
if (ioctl (s, CXIOCGETMODE, (caddr_t)&o) < 0)
err (1, "CXIOCGETMODE");
close (s);
if (o.type == T_NONE) {
fprintf (stderr, "cx%d: channel %d not configured\n", o.board,
if (o.type == T_NONE)
errx (1, "cx%d: channel %d not configured", o.board,
o.channel);
exit (1);
}
}
int printstats (int channel, int hflag)
@ -129,10 +126,8 @@ int printstats (int channel, int hflag)
int s, res;
s = open (CXDEV, 0);
if (s < 0) {
perror (CXDEV);
exit (1);
}
if (s < 0)
err (1, "%s", CXDEV);
st.board = channel/NCHAN;
st.channel = channel%NCHAN;
res = ioctl (s, CXIOCGETSTAT, (caddr_t)&st);
@ -161,16 +156,12 @@ void printallstats ()
void setchan (int channel)
{
int s = open (CXDEV, 0);
if (s < 0) {
perror (CXDEV);
exit (1);
}
if (s < 0)
err (1, "%s", CXDEV);
o.board = channel/NCHAN;
o.channel = channel%NCHAN;
if (ioctl (s, CXIOCSETMODE, (caddr_t)&o) < 0) {
perror ("cxconfig: CXIOCSETMODE");
exit (1);
}
if (ioctl (s, CXIOCSETMODE, (caddr_t)&o) < 0)
err (1, "CXIOCSETMODE");
close (s);
}
@ -414,22 +405,16 @@ void printall ()
int s, c;
s = socket (AF_INET, SOCK_DGRAM, 0);
if (s < 0) {
perror ("cxconfig: socket");
exit (1);
}
if (s < 0)
err (1, "socket");
ifc.ifc_len = sizeof (buf);
ifc.ifc_buf = buf;
if (ioctl (s, SIOCGIFCONF, (caddr_t)&ifc) < 0) {
perror ("cxconfig: SIOCGIFCONF");
exit (1);
}
if (ioctl (s, SIOCGIFCONF, (caddr_t)&ifc) < 0)
err (1, "SIOCGIFCONF");
close (s);
s = open (CXDEV, 0);
if (s < 0) {
perror (CXDEV);
exit (1);
}
if (s < 0)
err (1, "%s", CXDEV);
ifr = ifc.ifc_req;
#define max(a,b) ((a)>(b) ? (a) : (b))
@ -443,10 +428,8 @@ void printall ()
c = atoi (ifr->ifr_name + 2);
o.board = c/NCHAN;
o.channel = c%NCHAN;
if (ioctl (s, CXIOCGETMODE, (caddr_t)&o) < 0) {
perror ("cxconfig: CXIOCGETMODE");
exit (1);
}
if (ioctl (s, CXIOCGETMODE, (caddr_t)&o) < 0)
err (1, "CXIOCGETMODE");
printchan (c);
}
close (s);