Use err(3). Stylistic changes in man page.
This commit is contained in:
parent
342afc34d7
commit
9396247ef7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=30764
@ -24,10 +24,13 @@
|
|||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id: decode.c,v 1.5 1997/02/22 16:14:07 peter Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef lint
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "decode.h"
|
#include "decode.h"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
.\" documentation and/or other materials provided with the distribution.
|
.\" documentation and/or other materials provided with the distribution.
|
||||||
.\"
|
.\"
|
||||||
.\" @(#)vidcontrol.1
|
.\" @(#)vidcontrol.1
|
||||||
.\" $Id$
|
.\" $Id: vidcontrol.1,v 1.11 1997/07/24 23:46:35 wosch Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd May 22, 1994
|
.Dd May 22, 1994
|
||||||
.Dt VIDCONTROL 1
|
.Dt VIDCONTROL 1
|
||||||
@ -21,21 +21,30 @@
|
|||||||
.Nd a utility for manipulating the syscons video driver.
|
.Nd a utility for manipulating the syscons video driver.
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Ar options ...
|
.Op Fl r Ar fg Ar bg
|
||||||
|
.Op Fl b Ar color
|
||||||
|
.Op Fl c Ar appearance
|
||||||
|
.Op Fl d
|
||||||
|
.Op Fl l Ar scrmap
|
||||||
|
.Op Fl L
|
||||||
|
.Op Fl m Ar on|off
|
||||||
|
.Op Fl f Ar size Ar file
|
||||||
|
.Op Fl s Ar number
|
||||||
|
.Op Fl t Ar N|off
|
||||||
|
.Op Fl x
|
||||||
|
.Op mode
|
||||||
|
.Op fgcol Op bgcol
|
||||||
|
.Op show
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
.Nm vidcontrol
|
.Nm
|
||||||
command is used to set various options for the syscons video driver,
|
command is used to set various options for the syscons video driver,
|
||||||
such as video mode, colors, cursors, scrnmaps, font and screensaver timeout.
|
such as video mode, colors, cursors, scrnmaps, font and screensaver timeout.
|
||||||
.Pp
|
.Pp
|
||||||
A new video mode is selected by specifying its name as an argument to
|
The following command line options are supported:
|
||||||
.Nm vidcontrol .
|
.Bl -tag -width indent
|
||||||
For example:
|
.It mode
|
||||||
.Bd -literal
|
Select a new video mode. The modes currently supported are:
|
||||||
vidcontrol VGA_80x25
|
|
||||||
.Ed
|
|
||||||
.Pp
|
|
||||||
The modes currently supported:
|
|
||||||
.Ar VGA_40x25 ,
|
.Ar VGA_40x25 ,
|
||||||
.Ar VGA_80x25 ,
|
.Ar VGA_80x25 ,
|
||||||
.Ar VGA_80x50 ,
|
.Ar VGA_80x50 ,
|
||||||
@ -49,20 +58,17 @@ can be used.
|
|||||||
The graphic mode
|
The graphic mode
|
||||||
.Ar VGA_320x200
|
.Ar VGA_320x200
|
||||||
can also be chosen.
|
can also be chosen.
|
||||||
.Pp
|
.It fgcol Op bgcol
|
||||||
The colors used when displaying text can be changed by specifying the
|
Change colors when displaying text. Specify the foreground color
|
||||||
foreground color (e.g. "vidcontrol white"), or both a foreground & background
|
(e.g. "vidcontrol white"), or both a foreground & background color
|
||||||
color (e.g. "vidcontrol yellow blue").
|
(e.g. "vidcontrol yellow blue").
|
||||||
.Pp
|
.It show
|
||||||
To see the supported colors on a given platform use "vidcontrol show".
|
See the supported colors on a given platform.
|
||||||
.Pp
|
|
||||||
The following command line options are supported:
|
|
||||||
.Bl -tag -width Fl
|
|
||||||
.It Fl r Ar foreground Ar background
|
.It Fl r Ar foreground Ar background
|
||||||
Change reverse mode colors to
|
Change reverse mode colors to
|
||||||
.Ar foreground
|
.Ar foreground
|
||||||
and
|
and
|
||||||
.Ar background
|
.Ar background .
|
||||||
.It Fl b Ar color
|
.It Fl b Ar color
|
||||||
Set border color to
|
Set border color to
|
||||||
.Ar color
|
.Ar color
|
||||||
@ -79,7 +85,11 @@ Install screen output map file from
|
|||||||
.It Fl L
|
.It Fl L
|
||||||
Install default screen output map.
|
Install default screen output map.
|
||||||
.It Fl m Ar on|off
|
.It Fl m Ar on|off
|
||||||
Switches the mousepointer on or off. Used together with the moused
|
Switch the mousepointer
|
||||||
|
.Ar on
|
||||||
|
or
|
||||||
|
.Ar off .
|
||||||
|
Used together with the moused
|
||||||
daemon for textmode cut & paste functionality.
|
daemon for textmode cut & paste functionality.
|
||||||
.It Fl f Ar size Ar file
|
.It Fl f Ar size Ar file
|
||||||
Load font
|
Load font
|
||||||
@ -87,12 +97,12 @@ Load font
|
|||||||
for
|
for
|
||||||
.Ar size
|
.Ar size
|
||||||
(currently, only 8x8, 8x14 or 8x16).
|
(currently, only 8x8, 8x14 or 8x16).
|
||||||
The fontfile can be either uuencoded or in raw binary format.
|
The font file can be either uuencoded or in raw binary format.
|
||||||
.It Fl s Ar Number
|
.It Fl s Ar number
|
||||||
Sets the current vty to
|
Set the current vty to
|
||||||
.Ar Number .
|
.Ar number .
|
||||||
.It Fl t Ar N|off
|
.It Fl t Ar N|off
|
||||||
Sets the screensaver timeout to
|
Set the screensaver timeout to
|
||||||
.Ar N
|
.Ar N
|
||||||
seconds, or turns it
|
seconds, or turns it
|
||||||
.Ar off .
|
.Ar off .
|
||||||
@ -110,4 +120,4 @@ Use hexadecimal digits for output.
|
|||||||
.Xr screen 4 ,
|
.Xr screen 4 ,
|
||||||
.Xr moused 8
|
.Xr moused 8
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
Søren Schmidt (sos@FreeBSD.org)
|
.An Søren Schmidt Aq sos@FreeBSD.org
|
||||||
|
@ -24,15 +24,19 @@
|
|||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id: vidcontrol.c,v 1.16 1997/03/07 01:34:47 brian Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef lint
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <err.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <machine/console.h>
|
#include <machine/console.h>
|
||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
@ -50,30 +54,14 @@ char letter;
|
|||||||
struct vid_info info;
|
struct vid_info info;
|
||||||
|
|
||||||
|
|
||||||
void
|
static void
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr, "%s\n%s\n%s\n",
|
||||||
"Usage: vidcontrol mode (available modes: VGA_40x25, VGA_80x25,\n"
|
"usage: vidcontrol [-r fg bg] [-b color] [-c appearance] [-d] [-l scrmap]",
|
||||||
" VGA_80x50, VGA_320x200,\n"
|
" [-L] [-m on|off] [-f size file] [-s number] [-t N|off]",
|
||||||
" EGA_80x25, EGA_80x43)\n"
|
" [-x] [mode] [fgcol [bgcol]] [show]");
|
||||||
" (experimental) VGA_80x30, VGA_80x60)\n"
|
exit(1);
|
||||||
"\n"
|
|
||||||
" show (show available colors)\n"
|
|
||||||
" fgcol bgcol (set fore- & background colors)\n"
|
|
||||||
" -r fgcol bgcol (set reverse fore- & background colors)\n"
|
|
||||||
" -b color (set border color)\n"
|
|
||||||
" -c normal (set cursor to inverting block)\n"
|
|
||||||
" -c blink (set cursor to blinking inverted block)\n"
|
|
||||||
" -c destructive (set cursor to blinking destructive char)\n"
|
|
||||||
" -d (dump screenmap to stdout)\n"
|
|
||||||
" -l filename (load screenmap file filename)\n"
|
|
||||||
" -m on|off (switch mousepointer support on or off)\n"
|
|
||||||
" -L (load default screenmap)\n"
|
|
||||||
" -f DxL filename (load font, D dots wide & L lines high)\n"
|
|
||||||
" -t N (set screensaver timeout in seconds)\n"
|
|
||||||
" -x (use hex numbers for output)\n"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@ -81,9 +69,7 @@ nextarg(int ac, char **av, int *indp, int oc)
|
|||||||
{
|
{
|
||||||
if (*indp < ac)
|
if (*indp < ac)
|
||||||
return(av[(*indp)++]);
|
return(av[(*indp)++]);
|
||||||
fprintf(stderr, "%s: option requires two arguments -- %c\n", av[0], oc);
|
errx(1, "option requires two arguments -- %c", oc);
|
||||||
usage();
|
|
||||||
exit(1);
|
|
||||||
return("");
|
return("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,20 +115,20 @@ load_scrnmap(char *filename)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (fd == NULL) {
|
if (fd == NULL) {
|
||||||
perror("screenmap file not found");
|
warn("screenmap file not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
size = sizeof(scrnmap);
|
size = sizeof(scrnmap);
|
||||||
if (decode(fd, (char *)&scrnmap) != size) {
|
if (decode(fd, (char *)&scrnmap) != size) {
|
||||||
rewind(fd);
|
rewind(fd);
|
||||||
if (fread(&scrnmap, 1, size, fd) != size) {
|
if (fread(&scrnmap, 1, size, fd) != size) {
|
||||||
fprintf(stderr, "bad scrnmap file\n");
|
warnx("bad screenmap file");
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ioctl(0, PIO_SCRNMAP, &scrnmap) < 0)
|
if (ioctl(0, PIO_SCRNMAP, &scrnmap) < 0)
|
||||||
perror("can't load screenmap");
|
warn("can't load screenmap");
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +141,7 @@ load_default_scrnmap()
|
|||||||
for (i=0; i<256; i++)
|
for (i=0; i<256; i++)
|
||||||
*((char*)&scrnmap + i) = i;
|
*((char*)&scrnmap + i) = i;
|
||||||
if (ioctl(0, PIO_SCRNMAP, &scrnmap) < 0)
|
if (ioctl(0, PIO_SCRNMAP, &scrnmap) < 0)
|
||||||
perror("can't load default screenmap");
|
warn("can't load default screenmap");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -165,7 +151,7 @@ print_scrnmap()
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (ioctl(0, GIO_SCRNMAP, &map) < 0) {
|
if (ioctl(0, GIO_SCRNMAP, &map) < 0) {
|
||||||
perror("getting scrnmap");
|
warn("getting screenmap");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (i=0; i<sizeof(map); i++) {
|
for (i=0; i<sizeof(map); i++) {
|
||||||
@ -196,7 +182,7 @@ load_font(char *type, char *filename)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (fd == NULL) {
|
if (fd == NULL) {
|
||||||
perror("font file not found");
|
warn("font file not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!strcmp(type, "8x8")) {
|
if (!strcmp(type, "8x8")) {
|
||||||
@ -212,7 +198,7 @@ load_font(char *type, char *filename)
|
|||||||
io = PIO_FONT8x16;
|
io = PIO_FONT8x16;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
perror("bad font size specification");
|
warn("bad font size specification");
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -220,14 +206,14 @@ load_font(char *type, char *filename)
|
|||||||
if (decode(fd, fontmap) != size) {
|
if (decode(fd, fontmap) != size) {
|
||||||
rewind(fd);
|
rewind(fd);
|
||||||
if (fread(fontmap, 1, size, fd) != size) {
|
if (fread(fontmap, 1, size, fd) != size) {
|
||||||
fprintf(stderr, "bad font file\n");
|
warnx("bad font file");
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
free(fontmap);
|
free(fontmap);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ioctl(0, io, fontmap) < 0)
|
if (ioctl(0, io, fontmap) < 0)
|
||||||
perror("can't load font");
|
warn("can't load font");
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
free(fontmap);
|
free(fontmap);
|
||||||
}
|
}
|
||||||
@ -242,12 +228,12 @@ set_screensaver_timeout(char *arg)
|
|||||||
else {
|
else {
|
||||||
nsec = atoi(arg);
|
nsec = atoi(arg);
|
||||||
if ((*arg == '\0') || (nsec < 1)) {
|
if ((*arg == '\0') || (nsec < 1)) {
|
||||||
fprintf(stderr, "argument must be a positive number\n");
|
warnx("argument must be a positive number");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ioctl(0, CONS_BLANKTIME, &nsec) == -1)
|
if (ioctl(0, CONS_BLANKTIME, &nsec) == -1)
|
||||||
perror("setting screensaver period");
|
warn("setting screensaver period");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -262,8 +248,7 @@ set_cursor_type(char *appearence)
|
|||||||
else if (!strcmp(appearence, "destructive"))
|
else if (!strcmp(appearence, "destructive"))
|
||||||
type = 3;
|
type = 3;
|
||||||
else {
|
else {
|
||||||
fprintf(stderr,
|
warnx("argument to -c must be normal, blink or destructive");
|
||||||
"argument to -c must be normal, blink or destructive\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ioctl(0, CONS_CURSORTYPE, &type);
|
ioctl(0, CONS_CURSORTYPE, &type);
|
||||||
@ -294,7 +279,7 @@ video_mode(int argc, char **argv, int *index)
|
|||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
if (ioctl(0, mode, NULL) < 0)
|
if (ioctl(0, mode, NULL) < 0)
|
||||||
perror("Cannot set videomode");
|
warn("cannot set videomode");
|
||||||
(*index)++;
|
(*index)++;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -350,17 +335,15 @@ set_console(char *arg)
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
if( !arg || strspn(arg,"0123456789") != strlen(arg)) {
|
if( !arg || strspn(arg,"0123456789") != strlen(arg)) {
|
||||||
fprintf(stderr,"vidcontrol: Bad console number\n");
|
warnx("bad console number");
|
||||||
usage();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = atoi(arg);
|
n = atoi(arg);
|
||||||
if (n < 1 || n > 12) {
|
if (n < 1 || n > 12) {
|
||||||
fprintf(stderr,"vidcontrol: Console number out of range\n");
|
warnx("console number out of range");
|
||||||
usage();
|
|
||||||
} else if (ioctl(0,VT_ACTIVATE,(char *)n) == -1)
|
} else if (ioctl(0,VT_ACTIVATE,(char *)n) == -1)
|
||||||
perror("ioctl(VT_ACTIVATE)");
|
warn("ioctl(VT_ACTIVATE)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -385,8 +368,7 @@ set_mouse(char *arg)
|
|||||||
else if (!strcmp(arg, "off"))
|
else if (!strcmp(arg, "off"))
|
||||||
mouse.operation = MOUSE_HIDE;
|
mouse.operation = MOUSE_HIDE;
|
||||||
else {
|
else {
|
||||||
fprintf(stderr,
|
warnx("argument to -m must either on or off");
|
||||||
"argument to -m must either on or off\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ioctl(0, CONS_MOUSECTL, &mouse);
|
ioctl(0, CONS_MOUSECTL, &mouse);
|
||||||
@ -413,16 +395,12 @@ test_frame()
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
extern char *optarg;
|
|
||||||
extern int optind;
|
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
|
|
||||||
info.size = sizeof(info);
|
info.size = sizeof(info);
|
||||||
if (ioctl(0, CONS_GETINFO, &info) < 0) {
|
if (ioctl(0, CONS_GETINFO, &info) < 0)
|
||||||
perror("Must be on a virtual console");
|
err(1, "must be on a virtual console");
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
while((opt = getopt(argc, argv, "b:c:df:l:Lm:r:s:t:x")) != -1)
|
while((opt = getopt(argc, argv, "b:c:df:l:Lm:r:s:t:x")) != -1)
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'b':
|
case 'b':
|
||||||
@ -461,7 +439,6 @@ main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
video_mode(argc, argv, &optind);
|
video_mode(argc, argv, &optind);
|
||||||
set_normal_colors(argc, argv, &optind);
|
set_normal_colors(argc, argv, &optind);
|
||||||
@ -469,10 +446,8 @@ main(int argc, char **argv)
|
|||||||
test_frame();
|
test_frame();
|
||||||
optind++;
|
optind++;
|
||||||
}
|
}
|
||||||
if ((optind != argc) || (argc == 1)) {
|
if ((optind != argc) || (argc == 1))
|
||||||
usage();
|
usage();
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user