* #include <sys/types.h>
* #include <sys/socket.h>
* #include <ccan/oserver/oserver.h>
+ * #include <ccan/opt/opt.h>
* #include <err.h>
* #include <stdlib.h>
*
- * int main(void)
+ * int main(int argc, char *argv[])
* {
* int fd, sockfd;
+ * unsigned int port = OSERVER_PORT;
*
- * sockfd = oserver_setup();
+ * opt_register_noarg("--help|--usage|-h", opt_usage_and_exit,
+ * "\nA oserver program", "Usage information");
+ * opt_register_arg("--port", opt_set_uintval, opt_show_uintval,
+ * &port, "Server port number");
+ *
+ * opt_parse(&argc, argv, opt_log_stderr_exit);
+ * if (argc != 1)
+ * opt_log_stderr_exit("Unknown extra arguments");
+ *
+ * sockfd = oserver_setup(port);
* if (sockfd < 0)
* err(1, "Failed to set up server socket");
*
printf("ccan/foreach\n");
printf("ccan/noerr\n");
printf("ccan/failtest\n");
+ printf("ccan/opt\n");
return 0;
}