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