Make it compile again.

Use err(3) functions.
KNF
This commit is contained in:
itohy 1999-01-13 10:23:40 +00:00
parent 8d6f121902
commit cd16d23d21
1 changed files with 28 additions and 10 deletions

View File

@ -1,18 +1,36 @@
/* $NetBSD: tvctrl.c,v 1.3 1998/08/06 14:08:55 minoura Exp $ */
/* $NetBSD: tvctrl.c,v 1.4 1999/01/13 10:23:40 itohy Exp $ */
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <machine/iteioctl.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
int main __P((int, char *[]));
int
main(argc, argv)
int argc;
char *argv[];
int argc;
char *argv[];
{
unsigned char ctl;
if (argc < 2) printf("usage: %s control_number [...]\n", argv[0]), exit(1);
while (argv++, --argc != 0) {
ctl = atoi(argv[0]);
if (ioctl(0, ITETVCTRL, &ctl)) perror(errno);
}
unsigned long num;
unsigned char ctl;
char *ep;
if (argc < 2) {
fprintf(stderr, "usage: %s control_number [...]\n", argv[0]);
return 1;
}
while (argv++, --argc != 0) {
num = strtoul(argv[0], &ep, 10);
if (num > 255 || *ep != '\0')
errx(1, "illegal number -- %s", argv[0]);
ctl = num;
if (ioctl(0, ITETVCTRL, &ctl))
err(1, "ioctl(ITETVCTRL)");
}
return 0;
}