[sheepdog] [PATCH v7 5/6] shepherd: a new cluster manager specialized for sheepdog
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Mon Mar 11 07:14:01 CET 2013
At Mon, 11 Mar 2013 12:48:57 +0900,
Hitoshi Mitake wrote:
>
> +
> +static struct option const long_options[] = {
> + { "port", required_argument, NULL, 'p' },
> + { "address", required_argument, NULL, 'a' },
> + { "foreground", no_argument, NULL, 'f' },
> + { "debug", no_argument, NULL, 'd' },
> + { "log-file", no_argument, NULL, 'l' },
> + { "log-format", required_argument, NULL, 'F' },
> + { NULL, 0, NULL, 0 },
> +};
Please include a help option.
> + while ((ch = getopt_long(argc, argv, short_options, long_options,
> + &longindex)) >= 0) {
> + switch (ch) {
> + case 'p':
> + port = strtol(optarg, &p, 10);
> + if (p == optarg) {
> + fprintf(stderr, "invalid port: %s", optarg);
Missing "\n".
> + exit(1);
> + }
> + break;
> + case 'a':
> + bindaddr = optarg;
> + break;
> + case 'f':
> + daemonize = false;
> + break;
> + case 'd':
> + log_level = SDOG_DEBUG;
> + break;
> + case 'l':
> + log_file = optarg;
> + break;
> + case 'F':
> + log_format = optarg;
> + break;
> + default:
> + fprintf(stderr, "unknown option");
Same here.
> + exit(1);
> + break;
> + }
> + }
> +
> + if (daemonize) {
> + ret = daemon(0, 0);
> +
> + if (-1 == ret) {
> + fprintf(stderr, "daemon() failed: %m");
And here.
Thanks,
Kazutaka
More information about the sheepdog
mailing list