Fix typo: CAPF_ANYCLIENT->CAPS_ANYCLIENT.
[dragonfly.git] / test / caps / client.c
1 /*
2  * $DragonFly: src/test/caps/client.c,v 1.1 2004/01/18 12:39:56 dillon Exp $
3  */
4 #include <sys/types.h>
5 #include <sys/time.h>
6 #include <sys/caps.h>
7 #include <sys/errno.h>
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <unistd.h>
12
13 int
14 main(int ac, char **av)
15 {
16     int cid;
17     int n;
18     int count = 0;
19     char buf[256];
20     struct caps_msgid msgid;
21     off_t msgcid;
22
23     cid = caps_sys_client("test", getuid(), getgid(), 0, CAPF_ANYCLIENT);
24     printf("cid = %d %d\n", cid, errno);
25     if (cid < 0)
26         return(0);
27     for (;;) {
28         msgcid = caps_sys_put(cid, "xyz", 3);
29 #ifdef DEBUG
30         printf("msgcid = %016llx %d\n", msgcid, errno);
31 #endif
32         n = caps_sys_wait(cid, buf, sizeof(buf), &msgid, NULL);
33 #ifdef DEBUG
34         printf("n = %d msgid=%016llx state=%d errno=%d\n", n, msgid.c_id, msgid.c_state, errno);
35         if (n > 0)
36             printf("REPLY: %*.*s\n", n, n, buf);
37 #endif
38         ++count;
39         if ((count & 65535) == 0)
40             printf("%d\n", count);
41     }
42     return(0);
43 }
44