summaryrefslogtreecommitdiff
path: root/usr.sbin/sgsc
diff options
context:
space:
mode:
authorPhilippe Charnier <charnier@FreeBSD.org>1997-10-15 06:42:28 +0000
committerPhilippe Charnier <charnier@FreeBSD.org>1997-10-15 06:42:28 +0000
commit619748d329bba7021fe9630bc1e546a61c80ee63 (patch)
treef67ff5f06c372cce14f6ec989e458cf576e91a8c /usr.sbin/sgsc
parent19112792f5041b2037ec33fa81cfaf51af2fc247 (diff)
downloadsrc-test2-619748d329bba7021fe9630bc1e546a61c80ee63.tar.gz
src-test2-619748d329bba7021fe9630bc1e546a61c80ee63.zip
Notes
Diffstat (limited to 'usr.sbin/sgsc')
-rw-r--r--usr.sbin/sgsc/sgsc.1102
-rw-r--r--usr.sbin/sgsc/sgsc.c83
2 files changed, 80 insertions, 105 deletions
diff --git a/usr.sbin/sgsc/sgsc.1 b/usr.sbin/sgsc/sgsc.1
index 41b609560685..5078c0b01827 100644
--- a/usr.sbin/sgsc/sgsc.1
+++ b/usr.sbin/sgsc/sgsc.1
@@ -27,65 +27,71 @@
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.TH SGSC 1 "January 6, 1995" FreeBSD "FreeBSD Reference Manual"
-.SH NAME
-\fBsgsc\fP - set the options of the gsc scanner device
-.SH SYNOPSIS
-.TP 5
-\fBsgsc\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 \fBsgsc\fP utility provides shell level access to the ioctl
+.Dd January 6, 1995
+.Dt SGSC 1
+.Os
+.Sh NAME
+.Nm sgsc
+.Nd set the options of the gsc scanner device
+.Sh SYNOPSIS
+.Nm sgsc
+.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 gsc. Please see
-gsc(4) for the exact meaning of the requests. Generally they modify
-the output and behaviour of the gsc scanner device. When \fBsgsc\fP is
-called with no option only the current settings are reported.
-.SH OPTIONS
-.TP 3
-\fB-s\fP [GSC_SRESSW]
+.Xr gsc 4
+for the exact meaning of the requests. Generally they modify
+the output and behaviour of the gsc 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 Ar [GSC_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 [GSC_SRES]
+.It Fl r Ar resolution [GSC_SRES]
Set the resolution in dpi.
-.TP
-\fB-w\fP \fIwidth\fP [GSC_SWIDHT]
+.It Fl w Ar width [GSC_SWIDHT]
Set the width of the bitmap in pixels.
-.TP
-\fB-h\fP \fIheight\fP [GSC_SHEIGHT]
+.It Fl h Ar height [GSC_SHEIGHT]
Set the height of the bitmap in lines of pixels.
-.TP
-\fB-b\fP \fIlen\fP [GSC_SBLEN]
-Set the internal dma buffer to be \fIlen\fP lines in size.
-.TP
-\fB-t\fP \fItimeout\fP [GSC_SBTIME]
+.It Fl b Ar len [GSC_SBLEN]
+Set the internal dma buffer to be
+.Ar len
+lines in size.
+.It Fl t Ar timeout [GSC_SBTIME]
Set the timeout time for reading one dma buffer.
-.SH FILES
-.TP 15
-.BI /dev/gsc0
-device node for \fIraw\fP output.
-.TP
-.BI /dev/gsc0p
-device node for output in \fIpbm\fP file format.
-.PB
-.SH SEE ALSO
-gsc(4)
-.SH AUTHOR
-Gunther Schadow <gusw@fub46.zedat.fu-berlin.de>
+.El
+.Sh FILES
+.Bl -tag -width /dev/gsc0p -compact
+.It Pa /dev/gsc0
+device node for
+.Em raw
+output
+.It Pa /dev/gsc0p
+device node for output in
+.Em pbm
+file format
+.El
+.Sh SEE ALSO
+.Xr gsc 4
+.Sh AUTHOR
+.An Gunther Schadow Aq gusw@fub46.zedat.fu-berlin.de
diff --git a/usr.sbin/sgsc/sgsc.c b/usr.sbin/sgsc/sgsc.c
index 8cbc6b3f7441..f9850c797a53 100644
--- a/usr.sbin/sgsc/sgsc.c
+++ b/usr.sbin/sgsc/sgsc.c
@@ -29,9 +29,15 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef lint
+static const char rcsid[] =
+ "$Id$";
+#endif /* not lint */
+
+#include <err.h>
+#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <stdio.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <machine/gsc.h>
@@ -44,11 +50,12 @@
#endif
#define FAIL -1
-usage(char *progn)
+static void
+usage()
{
- fprintf(stderr, "usage: %s [-sq] [-f file] [-r dpi] "
- "[-w width] [-h height] "
- "[-b len] [-t time]\n", progn);
+ fprintf(stderr, "%s\n%s\n",
+ "usage: sgsc [-sq] [-f file] [-r dpi] [-w width] [-h height]",
+ " [-b len] [-t time]");
exit(1);
}
@@ -74,9 +81,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)
{
@@ -89,98 +94,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, GSC_SRESSW) == FAIL)
- {
- perror("GSC_SRESSW");
- exit(1);
- }
+ err(1, "GSC_SRESSW");
}
if (set_dpi != 0)
{
if(ioctl(fd, GSC_SRES, &set_dpi) == FAIL)
- {
- perror("GSC_SRES");
- exit(1);
- }
+ err(1, "GSC_SRES");
}
if (set_width != 0)
{
if(ioctl(fd, GSC_SWIDTH, &set_width) == FAIL)
- {
- perror("GSC_SWIDTH");
- exit(1);
- }
+ err(1, "GSC_SWIDTH");
}
if (set_height != 0)
{
if(ioctl(fd, GSC_SHEIGHT, &set_height) == FAIL)
- {
- perror("GSC_SHEIGHT");
- exit(1);
- }
+ err(1, "GSC_SHEIGHT");
}
if (set_blen != 0)
{
if(ioctl(fd, GSC_SBLEN, &set_blen) == FAIL)
- {
- perror("GSC_SBLEN");
- exit(1);
- }
+ err(1, "GSC_SBLEN");
}
if (set_btime != 0)
{
if(ioctl(fd, GSC_SBTIME, &set_btime) == FAIL)
- {
- perror("GSC_SBTIME");
- exit(1);
- }
+ err(1, "GSC_SBTIME");
}
if (show_all != 0)
{
if(ioctl(fd, GSC_GRES, &show_dpi) == FAIL)
- {
- perror("GSC_GRES");
- exit(1);
- }
+ err(1, "GSC_GRES");
if(ioctl(fd, GSC_GWIDTH, &show_width) == FAIL)
- {
- perror("GSC_GWIDTH");
- exit(1);
- }
+ err(1, "GSC_GWIDTH");
if(ioctl(fd, GSC_GHEIGHT, &show_height) == FAIL)
- {
- perror("GSC_GHEIGHT");
- exit(1);
- }
+ err(1, "GSC_GHEIGHT");
if(ioctl(fd, GSC_GBLEN, &show_blen) == FAIL)
- {
- perror("GSC_GBLEN");
- exit(1);
- }
+ err(1, "GSC_GBLEN");
if(ioctl(fd, GSC_GBTIME, &show_btime) == FAIL)
- {
- perror("GSC_GBTIME");
- exit(1);
- }
+ err(1, "GSC_GBTIME");
printf("%s:\n", file);
printf("resolution\t %d dpi\n", show_dpi);