Home | History | Annotate | Line # | Download | only in tvctrl
tvctrl.c revision 1.7
      1  1.7    lukem /*	$NetBSD: tvctrl.c,v 1.7 2003/07/15 01:44:55 lukem Exp $	*/
      2  1.7    lukem 
      3  1.7    lukem #include <sys/cdefs.h>
      4  1.7    lukem __RCSID("$NetBSD: tvctrl.c,v 1.7 2003/07/15 01:44:55 lukem Exp $");
      5  1.2    perry 
      6  1.1      oki #include <sys/types.h>
      7  1.1      oki #include <sys/ioctl.h>
      8  1.3  minoura #include <machine/iteioctl.h>
      9  1.4    itohy #include <err.h>
     10  1.4    itohy #include <stdio.h>
     11  1.4    itohy #include <stdlib.h>
     12  1.1      oki 
     13  1.6    isaki int main(int, char *[]);
     14  1.4    itohy 
     15  1.4    itohy int
     16  1.6    isaki main(int argc, char *argv[])
     17  1.1      oki {
     18  1.4    itohy 	unsigned long num;
     19  1.4    itohy 	unsigned char ctl;
     20  1.4    itohy 	char *ep;
     21  1.4    itohy 
     22  1.4    itohy 	if (argc < 2) {
     23  1.4    itohy 		fprintf(stderr, "usage: %s control_number [...]\n", argv[0]);
     24  1.4    itohy 		return 1;
     25  1.4    itohy 	}
     26  1.4    itohy 	while (argv++, --argc != 0) {
     27  1.4    itohy 		num = strtoul(argv[0], &ep, 10);
     28  1.4    itohy 		if (num > 255 || *ep != '\0')
     29  1.4    itohy 			errx(1, "illegal number -- %s", argv[0]);
     30  1.4    itohy 
     31  1.4    itohy 		ctl = num;
     32  1.4    itohy 		if (ioctl(0, ITETVCTRL, &ctl))
     33  1.4    itohy 			err(1, "ioctl(ITETVCTRL)");
     34  1.4    itohy 	}
     35  1.4    itohy 
     36  1.4    itohy 	return 0;
     37  1.1      oki }
     38