blob: c97ac28e0f63219f1f862cc5c2f220474df03be2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <libintl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/foo.h>
int
foo_getcnt(uint32_t *cntp)
{
const char *devnm = "/dev/foo";
int fd, rc;
fd = open(devnm, O_RDONLY, 0);
if (fd == -1)
return (errno);
rc = ioctl(fd, FOO_IOC_GETCNT, cntp);
close(fd);
if (rc == -1)
return (errno);
return (0);
}
const char *
foo_message(int cnt)
{
const char *msg;
msg = gettext("This is just an example");
return (msg);
}
|