Correct hardware csum offload support for bge(4)
[dragonfly/vkernel-mp.git] / test / caps / encoder.c
blobd822e3579c7e137beb28867c6f072d055c7cc959
1 /*
2 * ENCODER.C
4 * CAPS-Encode the passwd structure for the specified usernames, generate
5 * to stdout.
7 * $DragonFly: src/test/caps/encoder.c,v 1.1 2004/03/08 00:36:45 dillon Exp $
8 */
9 #include <sys/types.h>
10 #include <libcaps/caps_struct.h>
11 #include <pwd.h>
12 #include <stdio.h>
13 #include <stdlib.h>
15 int
16 main(int ac, char **av)
18 int i;
19 int n;
20 char buf[1024];
22 for (i = 1; i < ac; ++i) {
23 struct passwd *pw;
25 if ((pw = getpwnam(av[i])) == NULL) {
26 printf("%s: lookup failed\n");
27 continue;
29 n = caps_encode(buf, sizeof(buf), pw, &caps_passwd_struct);
30 if (n > sizeof(buf)) {
31 printf("buffer overflow during encoding\n");
32 } else {
33 buf[n] = 0;
34 printf("%s\n", buf);
37 return(0);