diff options
Diffstat (limited to 'usr.sbin/pcvt/ispcvt/ispcvt.c')
-rw-r--r-- | usr.sbin/pcvt/ispcvt/ispcvt.c | 114 |
1 files changed, 29 insertions, 85 deletions
diff --git a/usr.sbin/pcvt/ispcvt/ispcvt.c b/usr.sbin/pcvt/ispcvt/ispcvt.c index 813e9dd..9dc4560 100644 --- a/usr.sbin/pcvt/ispcvt/ispcvt.c +++ b/usr.sbin/pcvt/ispcvt/ispcvt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1992, 1995 Hellmuth Michaelis + * Copyright (c) 1992, 2000 Hellmuth Michaelis * * All rights reserved. * @@ -11,11 +11,6 @@ * 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 Hellmuth Michaelis - * 4. The name authors 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 @@ -30,25 +25,14 @@ * */ -static char *id = - "@(#)ispcvt.c, 3.20, Last Edit-Date: [Wed Apr 5 17:53:28 1995]"; - /*---------------------------------------------------------------------------* * - * history: + * ispcvt - check for pcvt driver running and its options + * ------------------------------------------------------ + * + * Last Edit-Date: [Mon Mar 27 16:29:18 2000] * - * -hm upgraded to report pcvt compile time configuration - * -hm PCVT_INHIBIT_NUMLOCK patch from Joerg - * -hm PCVT_META_ESC patch from Joerg - * -hm PCVT_PCBURST - * -hm new ioctl VGAPCVTINFO - * -hm new CONF_ values for 3.10 - * -hm new CONF_ values for 3.20 - * -hm removed PCVT_FAKE_SYSCONS10 - * -hm added PCVT_PORTIO_DELAY - * -hm removed PCVT_386BSD - * -hm add -d option to specify a device - * -hm PCVT_XSERVER -> XSERVER + * $FreeBSD$ * *---------------------------------------------------------------------------*/ @@ -73,17 +57,14 @@ char *argv[]; int verbose = 0; int config = 0; int dflag = 0; + int n_screens = 0; int fd; char *device; - while( (c = getopt(argc, argv, "vcd:")) != -1) + while( (c = getopt(argc, argv, "cd:nv")) != -1) { switch(c) { - case 'v': - verbose = 1; - break; - case 'c': config = 1; break; @@ -93,6 +74,14 @@ char *argv[]; dflag = 1; break; + case 'n': + n_screens = 1; + break; + + case 'v': + verbose = 1; + break; + case '?': default: usage(); @@ -156,7 +145,7 @@ char *argv[]; fprintf(stderr,"\nispcvt: kernel and utils match, driver name [%s], release [%1.1d.%02.2d]\n\n",pcvtid.name,pcvtid.rmajor,pcvtid.rminor); } - if(config == 0) + if(config == 0 && n_screens == 0) exit(0); if(ioctl(fd, VGAPCVTINFO, &pcvtinfo) == -1) @@ -166,26 +155,14 @@ char *argv[]; exit(1); } - if(verbose) + if(n_screens) { - switch(pcvtinfo.opsys) - { - case CONF_NETBSD: - p = "PCVT_NETBSD"; - break; - - case CONF_FREEBSD: - p = "PCVT_FREEBSD"; - break; - - default: - case CONF_UNKNOWNOPSYS: - p = "UNKNOWN"; - break; + printf("%d", pcvtinfo.nscreens); + exit(0); + } - } - fprintf(stderr,"Operating System = %s\t", p); - fprintf(stderr,"OS Release Id = %u\n", pcvtinfo.opsysrel); + if(verbose) + { fprintf(stderr,"PCVT_NSCREENS = %u\t\t", pcvtinfo.nscreens); fprintf(stderr,"PCVT_UPDATEFAST = %u\n", pcvtinfo.updatefast); fprintf(stderr,"PCVT_UPDATESLOW = %u\t\t", pcvtinfo.updateslow); @@ -193,7 +170,7 @@ char *argv[]; fprintf(stderr,"PCVT_PCBURST = %u\t\t", pcvtinfo.pcburst); fprintf(stderr,"PCVT_KBD_FIFO_SZ = %u\n\n", pcvtinfo.kbd_fifo_sz); - /* config booleans */ + /* config booleans */ fprintf(stderr,"PCVT_132GENERIC = %s", (pcvtinfo.compile_opts & CONF_132GENERIC) ? "ON" : "OFF"); @@ -201,42 +178,21 @@ char *argv[]; fprintf(stderr,"PCVT_24LINESDEF = %s", (pcvtinfo.compile_opts & CONF_24LINESDEF) ? "ON" : "OFF"); next(); - fprintf(stderr,"PCVT_BACKUP_FONTS = %s", - (pcvtinfo.compile_opts & CONF_BACKUP_FONTS) ? "ON" : "OFF"); - next(); fprintf(stderr,"PCVT_CTRL_ALT_DEL = %s", (pcvtinfo.compile_opts & CONF_CTRL_ALT_DEL) ? "ON" : "OFF"); next(); - fprintf(stderr,"PCVT_EMU_MOUSE = %s", - (pcvtinfo.compile_opts & CONF_EMU_MOUSE) ? "ON" : "OFF"); - next(); fprintf(stderr,"PCVT_INHIBIT_NUMLOCK = %s", (pcvtinfo.compile_opts & CONF_INHIBIT_NUMLOCK) ? "ON" : "OFF"); next(); - fprintf(stderr,"PCVT_KEYBDID = %s", - (pcvtinfo.compile_opts & CONF_KEYBDID) ? "ON" : "OFF"); - next(); - fprintf(stderr,"PCVT_KBD_FIFO = %s", - (pcvtinfo.compile_opts & CONF_KBD_FIFO) ? "ON" : "OFF"); - next(); fprintf(stderr,"PCVT_META_ESC = %s", (pcvtinfo.compile_opts & CONF_META_ESC) ? "ON" : "OFF"); next(); - fprintf(stderr,"PCVT_NOFASTSCROLL = %s", - (pcvtinfo.compile_opts & CONF_NOFASTSCROLL) ? "ON" : "OFF"); - next(); fprintf(stderr,"PCVT_NO_LED_UPDATE = %s", (pcvtinfo.compile_opts & CONF_NO_LED_UPDATE) ? "ON" : "OFF"); next(); fprintf(stderr,"PCVT_NULLCHARS = %s", (pcvtinfo.compile_opts & CONF_NULLCHARS) ? "ON" : "OFF"); next(); - fprintf(stderr,"PCVT_PALFLICKER = %s", - (pcvtinfo.compile_opts & CONF_PALFLICKER) ? "ON" : "OFF"); - next(); - fprintf(stderr,"PCVT_PORTIO_DELAY = %s", - (pcvtinfo.compile_opts & CONF_PORTIO_DELAY) ? "ON" : "OFF"); - next(); fprintf(stderr,"PCVT_PRETTYSCRNS = %s", (pcvtinfo.compile_opts & CONF_PRETTYSCRNS) ? "ON" : "OFF"); next(); @@ -249,27 +205,15 @@ char *argv[]; fprintf(stderr,"PCVT_SHOWKEYS = %s", (pcvtinfo.compile_opts & CONF_SHOWKEYS) ? "ON" : "OFF"); next(); - fprintf(stderr,"PCVT_SIGWINCH = %s", - (pcvtinfo.compile_opts & CONF_SIGWINCH) ? "ON" : "OFF"); - next(); fprintf(stderr,"PCVT_SLOW_INTERRUPT = %s", (pcvtinfo.compile_opts & CONF_SLOW_INTERRUPT) ? "ON" : "OFF"); next(); - fprintf(stderr,"PCVT_SW0CNOUTP = %s", - (pcvtinfo.compile_opts & CONF_SW0CNOUTP) ? "ON" : "OFF"); - next(); fprintf(stderr,"PCVT_USEKBDSEC = %s", (pcvtinfo.compile_opts & CONF_USEKBDSEC) ? "ON" : "OFF"); next(); - fprintf(stderr,"PCVT_USL_VT_COMPAT = %s", - (pcvtinfo.compile_opts & CONF_USL_VT_COMPAT) ? "ON" : "OFF"); - next(); fprintf(stderr,"PCVT_VT220KEYB = %s", ((u_int)pcvtinfo.compile_opts & (u_int)CONF_VT220KEYB) ? "ON" : "OFF"); next(); - fprintf(stderr,"PCVT_WAITRETRACE = %s", - (pcvtinfo.compile_opts & CONF_WAITRETRACE) ? "ON" : "OFF"); - next(); fprintf(stderr,"XSERVER = %s", (pcvtinfo.compile_opts & CONF_XSERVER) ? "ON" : "OFF"); @@ -277,7 +221,6 @@ char *argv[]; } else /* !verbose */ { - fprintf(stderr,"BSD Version = %u\n", pcvtinfo.opsys); fprintf(stderr,"PCVT_NSCREENS = %u\n", pcvtinfo.nscreens); fprintf(stderr,"PCVT_UPDATEFAST = %u\n", pcvtinfo.updatefast); fprintf(stderr,"PCVT_UPDATESLOW = %u\n", pcvtinfo.updateslow); @@ -289,10 +232,11 @@ char *argv[]; usage() { fprintf(stderr,"\nispcvt - verify current video driver is the pcvt-driver\n"); - fprintf(stderr," usage: ispcvt [-v] [-c] [-d device]\n"); - fprintf(stderr,"options: -v be verbose\n"); - fprintf(stderr," -c print compile time configuration\n"); - fprintf(stderr," -d <name> use devicefile <name> for verification\n\n"); + fprintf(stderr," usage: ispcvt [-c] [-d device] [-n] [-v]\n"); + fprintf(stderr,"options: -c print compile time configuration\n"); + fprintf(stderr," -d <name> use devicefile <name>\n"); + fprintf(stderr," -n print number of virtual screens (to stdout)\n"); + fprintf(stderr," -v be verbose\n\n"); exit(5); } |