summaryrefslogtreecommitdiff
path: root/options.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2009-11-17 16:46:17 (GMT)
committerChristian Pointner <equinox@helsinki.at>2009-11-17 16:46:17 (GMT)
commite4a30ac897423a0acebeb2aea205855f04e4e627 (patch)
tree96f6ea1718c5c723e8130332ea778f905a07112b /options.c
parenta56061ac8f3e5b79823e6b7b99198967407adf6b (diff)
added stdioclient
Diffstat (limited to 'options.c')
-rw-r--r--options.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/options.c b/options.c
index 47ef618..358766e 100644
--- a/options.c
+++ b/options.c
@@ -170,14 +170,18 @@ int options_parse(options_t* opt, int argc, char* argv[])
if(!strcmp(str,"-h") || !strcmp(str,"--help"))
return -1;
+#ifndef OPT_STDIOCLIENT
PARSE_INVERSE_BOOL_PARAM("-D","--nodaemonize", opt->daemonize_)
PARSE_STRING_PARAM("-u","--username", opt->username_)
PARSE_STRING_PARAM("-g","--groupname", opt->groupname_)
PARSE_STRING_PARAM("-C","--chroot", opt->chroot_dir_)
PARSE_STRING_PARAM("-P","--write-pid", opt->pid_file_)
+#endif
PARSE_STRING_LIST("-L","--log", opt->log_targets_)
PARSE_STRING_PARAM("-s","--command-sock", opt->command_sock_)
+#ifndef OPT_STDIOCLIENT
PARSE_STRING_PARAM("-b","--baudrate", baudrate)
+#endif
#ifdef OPT_SWITCHCTL
PARSE_STRING_PARAM("-f","--config", opt->conf_file_)
PARSE_STRING_PARAM("-d","--device", opt->switch_dev_)
@@ -283,6 +287,9 @@ void options_default(options_t* opt)
#ifdef OPT_SERIALCLIENT
opt->progname_ = strdup("serialclient");
#endif
+#ifdef OPT_STDIOCLIENT
+ opt->progname_ = strdup("stdioclient");
+#endif
/* common */
opt->daemonize_ = 1;
@@ -351,16 +358,23 @@ void options_print_usage()
#ifdef OPT_SERIALCLIENT
printf("serialclient\n");
#endif
+#ifdef OPT_STDIOCLIENT
+ printf("serialclient\n");
+#endif
printf(" [-h|--help] prints this...\n");
+#ifndef OPT_STDIOCLIENT
printf(" [-D|--nodaemonize] don't run in background\n");
printf(" [-u|--username] <username> change to this user\n");
printf(" [-g|--groupname] <groupname> change to this group\n");
printf(" [-C|--chroot] <path> chroot to this directory\n");
printf(" [-P|--write-pid] <path> write pid to this file\n");
+#endif
printf(" [-L|--log] <target>:<level>[,<param1>[,<param2>..]]\n");
printf(" add a log target, can be invoked several times\n");
printf(" [-s|--command-sock] <unix sock> the command socket e.g. /var/run/rhctl/switchctl.sock\n");
+#ifndef OPT_STDIOCLIENT
printf(" [-b|--baudrate] <baudrate> the baudrate of the tty to use e.g. 19200\n");
+#endif
#ifdef OPT_SWITCHCTL
printf(" [-d|--device] <tty> the tty the audio switch is connected to e.g. /dev/audioswitch\n");
printf(" [-f|--config] <file> the configuration file e.g. /etc/rhctl/switchctl.conf\n");
@@ -379,16 +393,19 @@ void options_print(options_t* opt)
return;
printf("progname: '%s'\n", opt->progname_);
+#ifndef OPT_STDIOCLIENT
printf("daemonize: %d\n", opt->daemonize_);
printf("username: '%s'\n", opt->username_);
printf("groupname: '%s'\n", opt->groupname_);
printf("chroot_dir: '%s'\n", opt->chroot_dir_);
printf("pid_file: '%s'\n", opt->pid_file_);
+#endif
printf("log_targets: \n");
string_list_print(&opt->log_targets_, " '", "'\n");
printf("command_sock: '%s'\n", opt->command_sock_);
+#ifndef OPT_STDIOCLIENT
char* br;
switch(opt->baudrate_) {
case B1200: br = "1200"; break;
@@ -402,6 +419,7 @@ void options_print(options_t* opt)
default: br = "invalid"; break;
}
printf("baudrate: '%s'\n", br);
+#endif
#ifdef OPT_SWITCHCTL
printf("mode: '%s'\n", opt->mode_ == MODE_MASTER ? "master" : "standby");