]> git.ozlabs.org Git - ccan-lca-2011.git/blob - ccan/oserver/_info
lca2011: test
[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  *
24  *              fd = accept(sockfd, NULL, NULL);
25  *              if (fd < 0)
26  *                      err(1, "Accepting connection on TCP socket");
27  *
28  *              oserver_serve(fd);
29  *      }
30  */
31 int main(int argc, char *argv[])
32 {
33         /* Expect exactly one argument */
34         if (argc != 2)
35                 return 1;
36
37         if (strcmp(argv[1], "depends") == 0) {
38                 printf("ccan/compiler\n");
39                 printf("ccan/read_write_all\n");
40                 printf("ccan/str\n");
41                 return 0;
42         }
43
44         return 1;
45 }