repo.or.cz
/
netbsd-mini2440.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
No empty .Rs/.Re
[netbsd-mini2440.git]
/
share
/
examples
/
pud
/
intro
/
doioctl.c
blob
1793957ed4ce7c157cb66a37367a2c434eb64a92
1
/* $NetBSD$ */
2
3
#include <sys/types.h>
4
#include <sys/ioctl.h>
5
6
#include <fcntl.h>
7
#include <stdio.h>
8
9
#include
"common.h"
10
11
int
12
main
(
int
argc
,
char
*
argv
[])
13
{
14
int
fd
,
i
;
15
16
if
(
argc
!=
3
&&
argc
!=
4
)
17
errx
(
1
,
"args"
);
18
19
fd
=
open
(
argv
[
1
],
O_RDWR
);
20
if
(
fd
== -
1
)
21
err
(
1
,
"open"
);
22
23
i
=
atoi
(
argv
[
2
]);
24
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"
);
31
32
printf
(
"i is now %d
\n
"
,
i
);
33
}