X-Git-Url: https://rtime.felk.cvut.cz/gitweb/frescor/forb.git/blobdiff_plain/6d065f570f065d68e45dfe3066f696144cf3a42f..8115e7ffe142f8bbf10591f4abd3a4f5627a1874:/src/forbrun/forbrun.c diff --git a/src/forbrun/forbrun.c b/src/forbrun/forbrun.c index 2319cf0..81e8154 100644 --- a/src/forbrun/forbrun.c +++ b/src/forbrun/forbrun.c @@ -10,12 +10,14 @@ #include #include #include +#include static struct option long_opts[] = { { "daemon", optional_argument, NULL, 'd' }, { "id", required_argument, NULL, 'i' }, { "loglevel", required_argument, NULL, 'l' }, { "port", required_argument, NULL, 'p' }, + { "serverid", required_argument, NULL, 's' }, { 0, 0, 0, 0} }; @@ -27,6 +29,7 @@ usage(void) printf(" -i, --id \n"); printf(" -l, --loglevel |=,...\n"); printf(" -p, --port listen on a fixed port number\n"); + printf(" -s, --serverid fixed server id of this server\n"); } int print_log_domain(ul_log_domain_t *domain, void *context) @@ -61,6 +64,7 @@ int main(int argc, char *argv[]) bool opt_daemon = false; char *opt_pidfile = NULL; int i, ret; + forb_server_id *server_id; forb_init_attr_t attr = { .orb_id = "", .peer_discovery_callback = NULL, /* TODO */ @@ -73,7 +77,7 @@ int main(int argc, char *argv[]) }; int opt; - while ((opt = getopt_long(argc, argv, "d::hi:l:p:", &long_opts[0], NULL)) != EOF) { + while ((opt = getopt_long(argc, argv, "d::hi:l:p:s:", &long_opts[0], NULL)) != EOF) { switch (opt) { case 'l': if (*optarg == '?') { @@ -101,6 +105,11 @@ int main(int argc, char *argv[]) case 'p': attr.fixed_tcp_port = atol(optarg); break; + case 's': + server_id = forb_server_id_from_string(&attr.fixed_server_id, optarg); + if (!server_id) + error(1, 0, "Invalid server id: '%s'\n", optarg); + break; } }