xref: /netbsd/sys/arch/x68k/usr.bin/tvctrl/tvctrl.c (revision bf9ec67e)
1 /*	$NetBSD: tvctrl.c,v 1.5 1999/03/16 16:30:22 minoura Exp $	*/
2 
3 #include <sys/types.h>
4 #include <sys/ioctl.h>
5 #include <machine/iteioctl.h>
6 #include <err.h>
7 #include <stdio.h>
8 #include <stdlib.h>
9 
10 int main __P((int, char *[]));
11 
12 int
13 main(argc, argv)
14 	int argc;
15 	char *argv[];
16 {
17 	unsigned long num;
18 	unsigned char ctl;
19 	char *ep;
20 
21 	if (argc < 2) {
22 		fprintf(stderr, "usage: %s control_number [...]\n", argv[0]);
23 		return 1;
24 	}
25 	while (argv++, --argc != 0) {
26 		num = strtoul(argv[0], &ep, 10);
27 		if (num > 255 || *ep != '\0')
28 			errx(1, "illegal number -- %s", argv[0]);
29 
30 		ctl = num;
31 		if (ioctl(0, ITETVCTRL, &ctl))
32 			err(1, "ioctl(ITETVCTRL)");
33 	}
34 
35 	return 0;
36 }
37