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