From 254bdc1ce79bef73125b8f0a935f914ae324f815 Mon Sep 17 00:00:00 2001 From: charnier Date: Mon, 27 Oct 1997 07:52:10 +0000 Subject: Use err(3). Stylistic changes in man page. --- usr.sbin/vidcontrol/decode.c | 7 ++- usr.sbin/vidcontrol/vidcontrol.1 | 66 ++++++++++++++++------------ usr.sbin/vidcontrol/vidcontrol.c | 93 +++++++++++++++------------------------- 3 files changed, 77 insertions(+), 89 deletions(-) (limited to 'usr.sbin/vidcontrol') diff --git a/usr.sbin/vidcontrol/decode.c b/usr.sbin/vidcontrol/decode.c index 11a8360..fd24e76 100644 --- a/usr.sbin/vidcontrol/decode.c +++ b/usr.sbin/vidcontrol/decode.c @@ -24,10 +24,13 @@ * 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: decode.c,v 1.5 1997/02/22 16:14:07 peter Exp $ */ +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + #include #include #include "decode.h" diff --git a/usr.sbin/vidcontrol/vidcontrol.1 b/usr.sbin/vidcontrol/vidcontrol.1 index 0588c90..aea5467 100644 --- a/usr.sbin/vidcontrol/vidcontrol.1 +++ b/usr.sbin/vidcontrol/vidcontrol.1 @@ -11,7 +11,7 @@ .\" documentation and/or other materials provided with the distribution. .\" .\" @(#)vidcontrol.1 -.\" $Id$ +.\" $Id: vidcontrol.1,v 1.11 1997/07/24 23:46:35 wosch Exp $ .\" .Dd May 22, 1994 .Dt VIDCONTROL 1 @@ -21,21 +21,30 @@ .Nd a utility for manipulating the syscons video driver. .Sh SYNOPSIS .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 The -.Nm vidcontrol +.Nm command is used to set various options for the syscons video driver, such as video mode, colors, cursors, scrnmaps, font and screensaver timeout. .Pp -A new video mode is selected by specifying its name as an argument to -.Nm vidcontrol . -For example: -.Bd -literal -vidcontrol VGA_80x25 -.Ed -.Pp -The modes currently supported: +The following command line options are supported: +.Bl -tag -width indent +.It mode +Select a new video mode. The modes currently supported are: .Ar VGA_40x25 , .Ar VGA_80x25 , .Ar VGA_80x50 , @@ -49,20 +58,17 @@ can be used. The graphic mode .Ar VGA_320x200 can also be chosen. -.Pp -The colors used when displaying text can be changed by specifying the -foreground color (e.g. "vidcontrol white"), or both a foreground & background -color (e.g. "vidcontrol yellow blue"). -.Pp -To see the supported colors on a given platform use "vidcontrol show". -.Pp -The following command line options are supported: -.Bl -tag -width Fl +.It fgcol Op bgcol +Change colors when displaying text. Specify the foreground color +(e.g. "vidcontrol white"), or both a foreground & background color +(e.g. "vidcontrol yellow blue"). +.It show +See the supported colors on a given platform. .It Fl r Ar foreground Ar background Change reverse mode colors to .Ar foreground and -.Ar background +.Ar background . .It Fl b Ar color Set border color to .Ar color @@ -79,7 +85,11 @@ Install screen output map file from .It Fl L Install default screen output map. .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. .It Fl f Ar size Ar file Load font @@ -87,12 +97,12 @@ Load font for .Ar size (currently, only 8x8, 8x14 or 8x16). -The fontfile can be either uuencoded or in raw binary format. -.It Fl s Ar Number -Sets the current vty to -.Ar Number . +The font file can be either uuencoded or in raw binary format. +.It Fl s Ar number +Set the current vty to +.Ar number . .It Fl t Ar N|off -Sets the screensaver timeout to +Set the screensaver timeout to .Ar N seconds, or turns it .Ar off . @@ -110,4 +120,4 @@ Use hexadecimal digits for output. .Xr screen 4 , .Xr moused 8 .Sh AUTHORS -Søren Schmidt (sos@FreeBSD.org) +.An Søren Schmidt Aq sos@FreeBSD.org diff --git a/usr.sbin/vidcontrol/vidcontrol.c b/usr.sbin/vidcontrol/vidcontrol.c index d46fb86..5c3133c 100644 --- a/usr.sbin/vidcontrol/vidcontrol.c +++ b/usr.sbin/vidcontrol/vidcontrol.c @@ -24,15 +24,19 @@ * 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: vidcontrol.c,v 1.16 1997/03/07 01:34:47 brian Exp $ */ +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + #include +#include #include #include -#include #include +#include #include #include #include "path.h" @@ -50,30 +54,14 @@ char letter; struct vid_info info; -void +static void usage() { - fprintf(stderr, -"Usage: vidcontrol mode (available modes: VGA_40x25, VGA_80x25,\n" -" VGA_80x50, VGA_320x200,\n" -" EGA_80x25, EGA_80x43)\n" -" (experimental) VGA_80x30, VGA_80x60)\n" -"\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" - ); + fprintf(stderr, "%s\n%s\n%s\n", +"usage: vidcontrol [-r fg bg] [-b color] [-c appearance] [-d] [-l scrmap]", +" [-L] [-m on|off] [-f size file] [-s number] [-t N|off]", +" [-x] [mode] [fgcol [bgcol]] [show]"); + exit(1); } char * @@ -81,9 +69,7 @@ nextarg(int ac, char **av, int *indp, int oc) { if (*indp < ac) return(av[(*indp)++]); - fprintf(stderr, "%s: option requires two arguments -- %c\n", av[0], oc); - usage(); - exit(1); + errx(1, "option requires two arguments -- %c", oc); return(""); } @@ -129,20 +115,20 @@ load_scrnmap(char *filename) break; } if (fd == NULL) { - perror("screenmap file not found"); + warn("screenmap file not found"); return; } size = sizeof(scrnmap); if (decode(fd, (char *)&scrnmap) != size) { rewind(fd); if (fread(&scrnmap, 1, size, fd) != size) { - fprintf(stderr, "bad scrnmap file\n"); + warnx("bad screenmap file"); fclose(fd); return; } } if (ioctl(0, PIO_SCRNMAP, &scrnmap) < 0) - perror("can't load screenmap"); + warn("can't load screenmap"); fclose(fd); } @@ -155,7 +141,7 @@ load_default_scrnmap() for (i=0; i<256; i++) *((char*)&scrnmap + i) = i; if (ioctl(0, PIO_SCRNMAP, &scrnmap) < 0) - perror("can't load default screenmap"); + warn("can't load default screenmap"); } void @@ -165,7 +151,7 @@ print_scrnmap() int i; if (ioctl(0, GIO_SCRNMAP, &map) < 0) { - perror("getting scrnmap"); + warn("getting screenmap"); return; } for (i=0; i 12) { - fprintf(stderr,"vidcontrol: Console number out of range\n"); - usage(); + warnx("console number out of range"); } else if (ioctl(0,VT_ACTIVATE,(char *)n) == -1) - perror("ioctl(VT_ACTIVATE)"); + warn("ioctl(VT_ACTIVATE)"); } void @@ -385,8 +368,7 @@ set_mouse(char *arg) else if (!strcmp(arg, "off")) mouse.operation = MOUSE_HIDE; else { - fprintf(stderr, - "argument to -m must either on or off\n"); + warnx("argument to -m must either on or off"); return; } ioctl(0, CONS_MOUSECTL, &mouse); @@ -413,16 +395,12 @@ test_frame() int main(int argc, char **argv) { - extern char *optarg; - extern int optind; int opt; info.size = sizeof(info); - if (ioctl(0, CONS_GETINFO, &info) < 0) { - perror("Must be on a virtual console"); - return 1; - } + if (ioctl(0, CONS_GETINFO, &info) < 0) + err(1, "must be on a virtual console"); while((opt = getopt(argc, argv, "b:c:df:l:Lm:r:s:t:x")) != -1) switch(opt) { case 'b': @@ -461,7 +439,6 @@ main(int argc, char **argv) break; default: usage(); - return 1; } video_mode(argc, argv, &optind); set_normal_colors(argc, argv, &optind); @@ -469,10 +446,8 @@ main(int argc, char **argv) test_frame(); optind++; } - if ((optind != argc) || (argc == 1)) { + if ((optind != argc) || (argc == 1)) usage(); - return 1; - } return 0; } -- cgit v1.1