No empty .Rs/.Re
[netbsd-mini2440.git] / share / examples / pud / intro / doioctl.c
blob1793957ed4ce7c157cb66a37367a2c434eb64a92
1 /* $NetBSD$ */
3 #include <sys/types.h>
4 #include <sys/ioctl.h>
6 #include <fcntl.h>
7 #include <stdio.h>
9 #include "common.h"
11 int
12 main(int argc, char *argv[])
14 int fd, i;
16 if (argc != 3 && argc != 4)
17 errx(1, "args");
19 fd = open(argv[1], O_RDWR);
20 if (fd == -1)
21 err(1, "open");
23 i = atoi(argv[2]);
25 if (argc == 3)
26 if (ioctl(fd, INTROTOGGLE, &i) == -1)
27 err(1, "ioctl");
28 else
29 if (ioctl(fd, INTROTOGGLE_R, &i) == -1)
30 err(1, "ioctl");
32 printf("i is now %d\n", i);