]> git.ozlabs.org Git - ccan-lca-2011.git/blob - ccan/oserver/_info
lca2011: use failtest
[ccan-lca-2011.git] / ccan / oserver / _info
1 #include <string.h>
2 #include "config.h"
3
4 /**
5  * oserver - a demonstration module for LCA2011
6  *
7  * This code shows off the features of CCAN and various C cantrips.
8  *
9  * License: GPL
10  *
11  * Example:
12  *      #include <sys/types.h>
13  *      #include <sys/socket.h>
14  *      #include <ccan/oserver/oserver.h>
15  *      #include <err.h>
16  *      #include <stdlib.h>
17  *
18  *      int main(void)
19  *      {
20  *              int fd, sockfd;
21  *
22  *              sockfd = oserver_setup();
23  *              if (sockfd < 0)
24  *                      err(1, "Failed to set up server socket");
25  *
26  *              fd = accept(sockfd, NULL, NULL);
27  *              if (fd < 0)
28  *                      err(1, "Accepting connection on TCP socket");
29  *
30  *              if (!oserver_serve(fd))
31  *                      err(1, "Serving client");
32  *              exit(0);
33  *      }
34  */
35 int main(int argc, char *argv[])
36 {
37         /* Expect exactly one argument */
38         if (argc != 2)
39                 return 1;
40
41         if (strcmp(argv[1], "depends") == 0) {
42                 printf("ccan/read_write_all\n");
43                 printf("ccan/str\n");
44                 printf("ccan/foreach\n");
45                 printf("ccan/noerr\n");
46                 printf("ccan/failtest\n");
47                 return 0;
48         }
49
50         return 1;
51 }