]> git.ozlabs.org Git - ccan-lca-2011.git/commitdiff
lca2011: oserver _info file.
authorRusty Russell <rusty@rustcorp.com.au>
Sun, 23 Jan 2011 12:03:46 +0000 (22:33 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Sun, 23 Jan 2011 12:03:46 +0000 (22:33 +1030)
Header from folded patch 'ccanlint-idempotent-and-license.patch':

lca2011: oserver idempotent and license link and tag.

Header from folded patch 'ccanlint-fix-control-reaches-end.patch':

lca2011: mark oserver_serve NORETURN.

ccan/oserver/LICENSE [new symlink]
ccan/oserver/_info [new file with mode: 0644]

diff --git a/ccan/oserver/LICENSE b/ccan/oserver/LICENSE
new file mode 120000 (symlink)
index 0000000..190cfd5
--- /dev/null
@@ -0,0 +1 @@
+../../licenses/GPL-3
\ No newline at end of file
diff --git a/ccan/oserver/_info b/ccan/oserver/_info
new file mode 100644 (file)
index 0000000..087b043
--- /dev/null
@@ -0,0 +1,44 @@
+#include <string.h>
+#include "config.h"
+
+/**
+ * oserver - a demonstration module for LCA2011
+ *
+ * This code shows off the features of CCAN and various C cantrips.
+ *
+ * License: GPL
+ *
+ * Example:
+ *     #include <sys/types.h>
+ *     #include <sys/socket.h>
+ *     #include <ccan/oserver/oserver.h>
+ *     #include <err.h>
+ *     #include <stdlib.h>
+ *
+ *     int main(void)
+ *     {
+ *             int fd, sockfd;
+ *
+ *             sockfd = oserver_setup();
+ *
+ *             fd = accept(sockfd, NULL, NULL);
+ *             if (fd < 0)
+ *                     err(1, "Accepting connection on TCP socket");
+ *
+ *             oserver_serve(fd);
+ *     }
+ */
+int main(int argc, char *argv[])
+{
+       /* Expect exactly one argument */
+       if (argc != 2)
+               return 1;
+
+       if (strcmp(argv[1], "depends") == 0) {
+               printf("ccan/compiler\n");
+               printf("ccan/read_write_all\n");
+               return 0;
+       }
+
+       return 1;
+}