summaryrefslogtreecommitdiffstats
path: root/usr.bin/sasc
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-08-08 12:22:30 +0000
committercharnier <charnier@FreeBSD.org>1997-08-08 12:22:30 +0000
commit9a0308a35455e1c84e03211da112146975348f61 (patch)
treeb08cf9d971581768717aa125880461e0bae643fc /usr.bin/sasc
parentfeae501bfd9d1b634e4f0ccd3d2197100a679b6d (diff)
downloadFreeBSD-src-9a0308a35455e1c84e03211da112146975348f61.zip
FreeBSD-src-9a0308a35455e1c84e03211da112146975348f61.tar.gz
Use err(3). Cosmetic in usage(). Rewrote man page in mdoc format.
Diffstat (limited to 'usr.bin/sasc')
-rw-r--r--usr.bin/sasc/sasc.1101
-rw-r--r--usr.bin/sasc/sasc.c90
2 files changed, 82 insertions, 109 deletions
diff --git a/usr.bin/sasc/sasc.1 b/usr.bin/sasc/sasc.1
index ab2275f..4d275c6 100644
--- a/usr.bin/sasc/sasc.1
+++ b/usr.bin/sasc/sasc.1
@@ -28,67 +28,72 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $Id$
+.\" $Id: sasc.1,v 1.5 1997/02/22 19:56:57 peter Exp $
.\"
-.TH SASC 1 "January 6, 1995" FreeBSD "FreeBSD Reference Manual"
-.SH NAME
-\fBsasc\fP - set the options of the asc scanner device
-.SH SYNOPSIS
-.TP 5
-\fBsasc\fP
-[\fB-sq\fP]
-[\fB-b\fP\ \fIlen\fP]
-[\fB-f\fP\ \fIfile\fP]
-[\fB-h\fP\ \fIheight\fP]
-[\fB-r\fP\ \fIresolution\fP]
-[\fB-t\fP\ \fItimeout\fP]
-[\fB-w\fP\ \fIwidth\fP]
-.SH DESCRIPTION
-The \fBsasc\fP utility provides shell level access to the ioctl
+.Dd January 6, 1995
+.Dt SASC 1
+.Os
+.Sh NAME
+.Nm sasc
+.Nd set the options of the asc scanner device
+.Sh SYNOPSIS
+.Nm
+.Op Fl sq
+.Op Fl b Ar len
+.Op Fl f Ar file
+.Op Fl h Ar height
+.Op Fl r Ar resolution
+.Op Fl t Ar timeout
+.Op Fl w Ar width
+.Sh DESCRIPTION
+The
+.Nm
+utility provides shell level access to the ioctl
requests served by the handy scanner device driver asc. Please see
-asc(4) for the exact meaning of the requests. Generally they modify
-the output and behavior of the asc scanner device. When \fBsasc\fP is
-called with no option only the current settings are reported.
-.SH OPTIONS
-.TP 3
-\fB-s\fP [ASC_SRESSW]
+.Xr asc 4
+for the exact meaning of the requests. Generally they modify
+the output and behavior of the asc scanner device. When
+.Nm
+is called with no option only the current settings are reported.
+.Sh OPTIONS
+The following options are available:
+.Bl -tag -width indent
+.It Fl s Bq ASC_SRESSW
Set the scanner with the values of the resolution selector switch.
-.TP
-\fB-q\fP
+.It Fl q
Operate in quiet mode, i.e. do not report any of the current settings.
Normally the parameters are shown after the modifications have been
performed.
-.TP
-\fB-f\fP \fIfile\fP
+.It Fl f Ar file
Operate on a different scanner device node given by filename. Note
that even though there may exist more than one node of scanner device
several of them will refer the same device unit. The modifications are
performed od the unit regardless of the device node by which it is
accessed.
-.TP
-\fB-r\fP \fIresolution\fP [ASC_SRES]
+.It Fl r Ar resolution Bq ASC_SRES
Set the resolution in dpi.
-.TP
-\fB-w\fP \fIwidth\fP [ASC_SWIDHT]
+.It Fl w Ar width Bq ASC_SWIDHT
Set the width of the bitmap in pixels.
-.TP
-\fB-h\fP \fIheight\fP [ASC_SHEIGHT]
+.It Fl h Ar height Bq ASC_SHEIGHT
Set the height of the bitmap in lines of pixels.
-.TP
-\fB-b\fP \fIlen\fP [ASC_SBLEN]
-Set the internal dma buffer to be \fIlen\fP lines in size.
-.TP
-\fB-t\fP \fItimeout\fP [ASC_SBTIME]
+.It Fl b Ar len Bq ASC_SBLEN
+Set the internal dma buffer to be
+.Ar len
+lines in size.
+.It Fl t Ar timeout Bq ASC_SBTIME
Set the timeout time for reading one dma buffer.
-.SH FILES
-.TP 15
-.BI /dev/asc0
-device node for \fIraw\fP output.
-.TP
-.BI /dev/asc0p
-device node for output in \fIpbm\fP file format.
-.PB
-.SH SEE ALSO
-asc(4)
-.SH AUTHOR
+.Sh FILES
+.Bl -tag -width /var/rwho/whod.* -compact
+.It Pa /dev/asc0
+device node for
+.Em raw
+output.
+.It Pa /dev/asc0p
+device node for output in
+.Em pbm
+file format.
+.El
+.Sh SEE ALSO
+.Xr asc 4
+.Sh AUTHOR
Gunther Schadow <gusw@fub46.zedat.fu-berlin.de>
diff --git a/usr.bin/sasc/sasc.c b/usr.bin/sasc/sasc.c
index b968f9e..e811abf 100644
--- a/usr.bin/sasc/sasc.c
+++ b/usr.bin/sasc/sasc.c
@@ -28,13 +28,16 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*
- * $Id: sasc.c,v 1.4 1997/02/22 19:56:57 peter Exp $
- */
+#ifndef lint
+static const char rcsid[] =
+ "$Id$";
+#endif /* not lint */
+
+#include <err.h>
#include <stdlib.h>
-#include <unistd.h>
#include <stdio.h>
+#include <unistd.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <machine/asc_ioctl.h>
@@ -47,12 +50,15 @@
#endif
#define FAIL -1
-usage(char *progn)
+static void usage __P((void));
+
+static void
+usage()
{
- fprintf(stderr, "usage: %s [-sq] [-f file] [-r dpi] "
- "[-w width] [-h height] "
- "[-b len] [-t time]\n", progn);
- exit(1);
+ fprintf(stderr,
+"usage: sasc [-sq] [-f file] [-r dpi] [-w width] [-h height] \
+[-b len] [-t time]\n");
+ exit(1);
}
int
@@ -77,9 +83,7 @@ main(int argc, char **argv)
int set_btime = 0;
int set_switch = 0;
- char *progn = *argv;
-
- if (argc == 0) usage(progn);
+ if (argc == 0) usage();
while( (c = getopt(argc, argv, "sqf:b:r:w:h:t:")) != FAIL)
{
@@ -92,98 +96,62 @@ main(int argc, char **argv)
case 't': set_btime = atoi(optarg); break;
case 's': set_switch = 1; break;
case 'q': show_all = 0; break;
- default: usage(progn);
+ default: usage();
}
}
fd = open(file, O_RDONLY);
if ( fd == FAIL )
- {
- perror(file);
- exit(1);
- }
+ err(1, "%s", file);
if (set_switch != 0)
{
if(ioctl(fd, ASC_SRESSW) == FAIL)
- {
- perror("ASC_SRESSW");
- exit(1);
- }
+ err(1, "ASC_SRESSW");
}
if (set_dpi != 0)
{
if(ioctl(fd, ASC_SRES, &set_dpi) == FAIL)
- {
- perror("ASC_SRES");
- exit(1);
- }
+ err(1, "ASC_SRES");
}
if (set_width != 0)
{
if(ioctl(fd, ASC_SWIDTH, &set_width) == FAIL)
- {
- perror("ASC_SWIDTH");
- exit(1);
- }
+ err(1, "ASC_SWIDTH");
}
if (set_height != 0)
{
if(ioctl(fd, ASC_SHEIGHT, &set_height) == FAIL)
- {
- perror("ASC_SHEIGHT");
- exit(1);
- }
+ err(1, "ASC_SHEIGHT");
}
if (set_blen != 0)
{
if(ioctl(fd, ASC_SBLEN, &set_blen) == FAIL)
- {
- perror("ASC_SBLEN");
- exit(1);
- }
+ err(1, "ASC_SBLEN");
}
if (set_btime != 0)
{
if(ioctl(fd, ASC_SBTIME, &set_btime) == FAIL)
- {
- perror("ASC_SBTIME");
- exit(1);
- }
+ err(1, "ASC_SBTIME");
}
if (show_all != 0)
{
if(ioctl(fd, ASC_GRES, &show_dpi) == FAIL)
- {
- perror("ASC_GRES");
- exit(1);
- }
+ err(1, "ASC_GRES");
if(ioctl(fd, ASC_GWIDTH, &show_width) == FAIL)
- {
- perror("ASC_GWIDTH");
- exit(1);
- }
+ err(1, "ASC_GWIDTH");
if(ioctl(fd, ASC_GHEIGHT, &show_height) == FAIL)
- {
- perror("ASC_GHEIGHT");
- exit(1);
- }
+ err(1, "ASC_GHEIGHT");
if(ioctl(fd, ASC_GBLEN, &show_blen) == FAIL)
- {
- perror("ASC_GBLEN");
- exit(1);
- }
+ err(1, "ASC_GBLEN");
if(ioctl(fd, ASC_GBTIME, &show_btime) == FAIL)
- {
- perror("ASC_GBTIME");
- exit(1);
- }
+ err(1, "ASC_GBTIME");
printf("%s:\n", file);
printf("resolution\t %d dpi\n", show_dpi);
OpenPOWER on IntegriCloud