add iteconfig for amiga's
This commit is contained in:
parent
13bd07192f
commit
28224014f6
@ -1,5 +1,5 @@
|
||||
# from: @(#)Makefile 5.6.1.2 (Berkeley) 5/8/91
|
||||
# $Id: Makefile,v 1.32 1994/04/04 21:49:39 cgd Exp $
|
||||
# $Id: Makefile,v 1.33 1994/04/05 01:56:24 chopps Exp $
|
||||
|
||||
# not yet done: catman
|
||||
|
||||
@ -18,6 +18,8 @@ SUBDIR+=bad144
|
||||
.elif ${MACHINE} == "hp300"
|
||||
# probably could be expanded to other machines, too
|
||||
SUBDIR+=hilinfo grfinfo
|
||||
.elif ${MACHINE} == "amiga"
|
||||
SUBDIR+=iteconfig
|
||||
.endif
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
7
usr.sbin/iteconfig/Makefile
Normal file
7
usr.sbin/iteconfig/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
# $Id: Makefile,v 1.1 1994/04/05 01:56:43 chopps Exp $
|
||||
|
||||
PROG=iteconfig
|
||||
MAN8=iteconfig.0
|
||||
CFLAGS+=-I${.CURDIR}/../../sys/arch
|
||||
|
||||
.include <bsd.prog.mk>
|
127
usr.sbin/iteconfig/iteconfig.8
Normal file
127
usr.sbin/iteconfig/iteconfig.8
Normal file
@ -0,0 +1,127 @@
|
||||
.\"
|
||||
.\" Copyright (c) 1994 Christian E. Hopps
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by Christian E. Hopps.
|
||||
.\" 3. The name of the author may not be used to endorse or promote products
|
||||
.\" derived from this software without specific prior written permission
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
.\" 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.
|
||||
.\"
|
||||
.\" $Id: iteconfig.8,v 1.1 1994/04/05 01:56:45 chopps Exp $
|
||||
.\"
|
||||
.Dd February 3, 1994
|
||||
.Dt ITECONFIG 8 amiga
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm iteconfig
|
||||
.Nd modify bitmaped console attributes at run time.
|
||||
.Sh SYNOPSIS
|
||||
.Nm iteconfig
|
||||
.Op Fl i
|
||||
.Op Fl v Ar volume
|
||||
.Op Fl t Ar count
|
||||
.Op Fl p Ar period
|
||||
.Op Fl w Ar width
|
||||
.Op Fl h Ar height
|
||||
.Op Fl d Ar depth
|
||||
.Op Fl x Ar offset
|
||||
.Op Fl y Ar offset
|
||||
.Op Ar color0 ...
|
||||
.Sh DESCRIPTION
|
||||
.Nm iteconfig
|
||||
is used to modify or examine the amiga's bitmaped console. There are
|
||||
two areas in the console, the speaker and the display.
|
||||
.Pp
|
||||
With the display flags and values, you can set the
|
||||
.Ar width
|
||||
,
|
||||
.Ar height
|
||||
and
|
||||
.Ar depth
|
||||
of the console display. You can also move the display around on the
|
||||
monitor with a horizontal and vertical
|
||||
.Ar offset .
|
||||
Finally the remaining arguments to
|
||||
.Nm iteconfig
|
||||
are used as color values for the view, beginning with color 0.
|
||||
.Pp
|
||||
The speaker options allow you to set the
|
||||
.Ar volume
|
||||
,
|
||||
.Ar period
|
||||
and
|
||||
.Ar count
|
||||
of a console beep.
|
||||
.Pp
|
||||
The following flags are interpreted by
|
||||
.Nm iteconfig
|
||||
.Bl -tag -width indent
|
||||
.It Fl i
|
||||
Print information about the console's current state after
|
||||
.Nm iteconfig
|
||||
finishes processing all other arguments.
|
||||
.It Fl v
|
||||
Set the volume of the console beep to
|
||||
.Ar volume
|
||||
(0 to 63).
|
||||
.It Fl p
|
||||
Set the period of the console beep to
|
||||
.Ar period
|
||||
.It Fl t
|
||||
Set the number of repititions of the console beep sample to
|
||||
.Ar count
|
||||
.It Fl w
|
||||
Set the width of the console display to
|
||||
.Ar width
|
||||
pixel columns. (positive integer)
|
||||
.It Fl h
|
||||
Set the height of the console display to
|
||||
.Ar height
|
||||
pixels rows (
|
||||
.Ar height
|
||||
should be an even positive integer).
|
||||
.It Fl d
|
||||
Set the number of bitplanes the console should use to
|
||||
.Ar depth .
|
||||
Therefore if
|
||||
.Ar depth
|
||||
is 3 then the number of color will be 8.
|
||||
.It Fl x
|
||||
Set the horizontal offset of the console view on the monitor in
|
||||
.Ar offset
|
||||
pixel columns. (positive or negative integer)
|
||||
.It Fl y
|
||||
Set the vertical offset of the console view on the monitor in
|
||||
.Ar offset
|
||||
pixel rows. (positive or negative integer)
|
||||
.Sh BUGS
|
||||
.Ar period
|
||||
and
|
||||
.Ar cound
|
||||
are something users should never deal with. These should be changed
|
||||
to
|
||||
.Ar pitch
|
||||
and
|
||||
.Ar time
|
||||
where time is 100's of a second.
|
||||
|
259
usr.sbin/iteconfig/iteconfig.c
Normal file
259
usr.sbin/iteconfig/iteconfig.c
Normal file
@ -0,0 +1,259 @@
|
||||
/*
|
||||
* Copyright (c) 1994 Christian E. Hopps
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Christian E. Hopps
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* 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.
|
||||
*
|
||||
* $Id: iteconfig.c,v 1.1 1994/04/05 01:56:46 chopps Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/queue.h>
|
||||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <amiga/dev/grfabs_reg.h>
|
||||
#include <amiga/dev/viewioctl.h>
|
||||
#include <amiga/dev/iteioctl.h>
|
||||
|
||||
colormap_t *xgetcmap __P((int, int));
|
||||
void printcmap __P((colormap_t *, int));
|
||||
void xioctl __P((int, int, void *));
|
||||
long xstrtol __P((char *));
|
||||
void xusage __P((void));
|
||||
|
||||
char *pname;
|
||||
char *optstr = "W:w:H:h:D:d:V:v:T:t:P:p:X:x:Y:y:i";
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
struct ite_window_size is, newis;
|
||||
struct ite_bell_values ib, newib;
|
||||
struct winsize ws;
|
||||
colormap_t *cm;
|
||||
int opt, fd, f_info, i, max_colors, rv;
|
||||
long val;
|
||||
|
||||
f_info = 0;
|
||||
pname = argv[0];
|
||||
|
||||
fd = open("/dev/ite0", O_NONBLOCK | O_RDONLY);
|
||||
if (fd == -1) {
|
||||
perror("open console");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
xioctl(fd, ITE_GET_WINDOW_SIZE, &is);
|
||||
xioctl(fd, ITE_GET_BELL_VALUES, &ib);
|
||||
|
||||
bcopy(&is, &newis, sizeof(is));
|
||||
bcopy(&ib, &newib, sizeof(ib));
|
||||
|
||||
while ((opt = getopt(argc, argv, optstr)) != EOF) {
|
||||
switch (opt) {
|
||||
case 'i':
|
||||
f_info = 1;
|
||||
break;
|
||||
case 'X':
|
||||
case 'x':
|
||||
newis.x = xstrtol(optarg);
|
||||
break;
|
||||
case 'Y':
|
||||
case 'y':
|
||||
newis.y = xstrtol(optarg);
|
||||
break;
|
||||
case 'W':
|
||||
case 'w':
|
||||
newis.width = xstrtol(optarg);
|
||||
break;
|
||||
case 'H':
|
||||
case 'h':
|
||||
newis.height = xstrtol(optarg);
|
||||
break;
|
||||
case 'D':
|
||||
case 'd':
|
||||
newis.depth = xstrtol(optarg);
|
||||
break;
|
||||
case 'V':
|
||||
case 'v':
|
||||
newib.volume = xstrtol(optarg);
|
||||
break;
|
||||
case 'P':
|
||||
case 'p':
|
||||
newib.period = xstrtol(optarg);
|
||||
break;
|
||||
case 'T':
|
||||
case 't':
|
||||
newib.time = xstrtol(optarg);
|
||||
break;
|
||||
default:
|
||||
case '?':
|
||||
xusage();
|
||||
/* NOTREACHED */
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (bcmp(&newis, &is, sizeof(is))) {
|
||||
xioctl(fd, ITE_SET_WINDOW_SIZE, &newis);
|
||||
xioctl(fd, ITE_GET_WINDOW_SIZE, &is);
|
||||
}
|
||||
if (bcmp(&newib, &ib, sizeof(ib))) {
|
||||
xioctl(fd, ITE_SET_BELL_VALUES, &newib);
|
||||
xioctl(fd, ITE_GET_BELL_VALUES, &ib);
|
||||
}
|
||||
|
||||
/*
|
||||
* get, set and get colors again
|
||||
*/
|
||||
i = 0;
|
||||
max_colors = 1 << is.depth;
|
||||
cm = xgetcmap(fd, max_colors);
|
||||
while (argc--) {
|
||||
val = xstrtol(*argv++);
|
||||
if (i >= max_colors) {
|
||||
fprintf(stderr, "%s: warn: to many colors\n", pname);
|
||||
break;
|
||||
}
|
||||
cm->entry[i] = val;
|
||||
i++;
|
||||
}
|
||||
xioctl(fd, VIEW_USECOLORMAP, cm);
|
||||
free(cm);
|
||||
cm = xgetcmap(fd, max_colors);
|
||||
|
||||
/* do tty stuff to get it to register the changes. */
|
||||
xioctl(fd, TIOCGWINSZ, &ws);
|
||||
|
||||
if (f_info) {
|
||||
printf("tty size: rows %d cols %d\n", ws.ws_row, ws.ws_col);
|
||||
printf("ite size: w: %d h: %d d: %d [x: %d y: %d]\n",
|
||||
is.width, is.height, is.depth, is.x, is.y);
|
||||
printf("ite bell: vol: %d count: %d period: %d\n",
|
||||
ib.volume, ib.time, ib.period);
|
||||
printcmap(cm, ws.ws_col);
|
||||
|
||||
}
|
||||
close(fd);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
xioctl(fd, cmd, addr)
|
||||
int fd, cmd;
|
||||
void *addr;
|
||||
{
|
||||
if (ioctl(fd, cmd, addr) != -1)
|
||||
return;
|
||||
|
||||
perror("ioctl");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
long
|
||||
xstrtol(s)
|
||||
char *s;
|
||||
{
|
||||
long rv;
|
||||
|
||||
rv = strtol(s, NULL, 0);
|
||||
if (errno != ERANGE || (rv != LONG_MAX && rv != LONG_MIN))
|
||||
return(rv);
|
||||
|
||||
fprintf(stderr, "%s: bad format \"%s\"\n", pname, s);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
colormap_t *
|
||||
xgetcmap(fd, ncolors)
|
||||
int fd;
|
||||
int ncolors;
|
||||
{
|
||||
colormap_t *cm;
|
||||
|
||||
cm = malloc(sizeof(colormap_t) + ncolors * sizeof(u_long));
|
||||
if (cm == NULL) {
|
||||
perror("malloc");
|
||||
exit(1);
|
||||
}
|
||||
cm->first = 0;
|
||||
cm->size = ncolors;
|
||||
cm->entry = (u_long *) & cm[1];
|
||||
xioctl(fd, VIEW_GETCOLORMAP, cm);
|
||||
return(cm);
|
||||
}
|
||||
|
||||
void
|
||||
printcmap(cm, ncols)
|
||||
colormap_t *cm;
|
||||
int ncols;
|
||||
{
|
||||
int i, nel;
|
||||
|
||||
switch (cm->type) {
|
||||
case CM_MONO:
|
||||
printf("monochrome\n");
|
||||
return;
|
||||
case CM_COLOR:
|
||||
printf("color levels: red: %d green: %d blue: %d\n",
|
||||
cm->red_mask + 1, cm->green_mask + 1, cm->blue_mask + 1);
|
||||
break;
|
||||
case CM_GREYSCALE:
|
||||
printf("greyscale levels: %d\n", cm->grey_mask + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
nel = ncols / 11 - 1;
|
||||
for (i = 0; i < cm->size; i++) {
|
||||
printf("0x%08lx ", cm->entry[i]);
|
||||
if ((i + 1) % nel == 0)
|
||||
printf("\n");
|
||||
}
|
||||
if ((i + 1) % nel)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void
|
||||
xusage()
|
||||
{
|
||||
fprintf(stderr, "usage: %s [-i] [-w width] [-h height] [-d depth]"
|
||||
" [-x off] [-y off] [-v volume] [-p period] [-t count]"
|
||||
" [color ...]\n", pname);
|
||||
exit(1);
|
||||
}
|
Loading…
Reference in New Issue
Block a user