Fawkes API  Fawkes Development Version
init_options.cpp
1 
2 /***************************************************************************
3  * init_options.cpp - Fawkes run-time initialization options
4  *
5  * Created: Tue Jun 07 14:19:56 2011
6  * Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #include <baseapp/init_options.h>
25 #include <baseapp/run.h>
26 #include <utils/system/argparser.h>
27 
28 #include <cstring>
29 #include <cstdlib>
30 
31 namespace fawkes {
32  namespace runtime {
33 #if 0 /* just to make Emacs auto-indent happy */
34  }
35 }
36 #endif
37 
38 
39 /** @class InitOptions <baseapp/init_options.h>
40  * Initialization options class.
41  * This class provides a container for initialization options that can be
42  * passed to the Fawkes runtime. It uses the named parameter idiom which
43  * allows to set only the parameters which divert from the default value.
44  * @author Tim Niemueller
45  */
46 
47 
48 /** Constructor.
49  * Initializes the default options.
50  * @param basename program base name
51  */
52 InitOptions::InitOptions(const char *basename)
53 {
54  __basename = strdup(basename);
55  __default_plugin = strdup("default");
56  __has_net_tcp_port = false;
57  __net_tcp_port = 0;
58  __has_loggers = false;
59  __loggers = NULL;
60  __log_level = Logger::LL_DEBUG;
61  __has_net_service_name = false;
62  __net_service_name = NULL;
63  __has_username = false;
64  __username = NULL;
65  __has_groupname = false;
66  __groupname = NULL;
67  __config_file = NULL;
68  __daemonize = false;
69  __daemon_pid_file = NULL;
70  __daemonize_kill = false;
71  __daemonize_status = false;
72  __show_help = false;
73  __bb_cleanup = false;
74  __default_signal_handlers = true;
75  __init_plugin_cache = true;
76  __has_load_plugin_list = false;
77  __load_plugin_list = NULL;
78  __plugin_module_flags = Module::MODULE_FLAGS_DEFAULT;
79 }
80 
81 
82 /** Copy constructor.
83  * @param options options object to copy
84  */
86 {
87  __basename = strdup(options.__basename);
88  __default_plugin = strdup(options.__default_plugin);
89  __net_tcp_port = 0;
90  __has_net_tcp_port = options.__has_net_tcp_port;
91  if (__has_net_tcp_port) {
92  __net_tcp_port = options.__net_tcp_port;
93  }
94  __loggers = NULL;
95  __has_loggers = options.__has_loggers;
96  if (__has_loggers) {
97  __loggers = strdup(options.__loggers);
98  }
99 
100  __log_level = options.__log_level;
101 
102  __net_service_name = NULL;
103  __has_net_service_name = options.__has_net_service_name;
104  if (__has_net_service_name) {
105  __net_service_name = strdup(options.__net_service_name);
106  }
107 
108  __username = NULL;
109  __has_username = options.__has_username;
110  if (__has_username) {
111  __username = strdup(options.__username);
112  }
113  __groupname = NULL;
114  __has_groupname = options.__has_groupname;
115  if (__has_groupname) {
116  __groupname = strdup(options.__groupname);
117  }
118 
119  __config_file = NULL;
120  if (options.__config_file) {
121  __config_file = strdup(options.__config_file);
122  }
123  __daemonize = options.__daemonize;
124  __daemon_pid_file = NULL;
125  if (__daemonize && options.__daemon_pid_file) {
126  __daemon_pid_file = strdup(options.__daemon_pid_file);
127  }
128  __daemonize_kill = options.__daemonize_kill;
129  __daemonize_status = options.__daemonize_status;
130  __show_help = options.__show_help;
131  __bb_cleanup = options.__bb_cleanup;
132  __default_signal_handlers = options.__default_signal_handlers;
133  __init_plugin_cache = options.__init_plugin_cache;
134  __load_plugin_list = NULL;
135  __has_load_plugin_list = options.__has_load_plugin_list;
136  if (__has_load_plugin_list) {
137  __load_plugin_list = strdup(options.__load_plugin_list);
138  }
139 
140  __plugin_module_flags = options.__plugin_module_flags;
141 }
142 
143 
144 /** Constructor from arguments.
145  * Initializes the options from arguments passed from the command line.
146  * @param argc number of elements in @p argv
147  * @param argv argument array
148  */
149 InitOptions::InitOptions(int argc, char **argv)
150 {
151 
152  option long_options[] = {
153  {"net-service-name", 1, 0, 0},
154  {0, 0, 0, 0}
155  };
156 
157  fawkes::runtime::argument_parser =
158  new ArgumentParser(argc, argv,
159  "hCc:dq::l:L:p:P:u:g:D::ks",
160  long_options);
161 
162  ArgumentParser *argp = fawkes::runtime::argument_parser;
163 
164  __basename = strdup(argp->program_name());
165  __default_plugin = strdup("default");
166 
167  __has_net_tcp_port = argp->has_arg("P");
168  if (__has_net_tcp_port) {
169  __net_tcp_port = argp->parse_int("P");
170  }
171  __has_loggers = argp->has_arg("L");
172  if (__has_loggers) {
173  __loggers = strdup(argp->arg("L"));
174  }
175 
176  const char *tmp;
177  __log_level = Logger::LL_INFO;
178  if ( argp->has_arg("d") ) {
179  __log_level = Logger::LL_DEBUG;
180  } else if ( argp->has_arg("q") ) {
181  __log_level = Logger::LL_WARN;
182  if ( (tmp = argp->arg("q")) != NULL ) {
183  for (unsigned int i = 0; i < strlen(tmp); ++i) {
184  if ( tmp[i] == 'q' ) {
185  switch (__log_level) {
186  case Logger::LL_INFO: __log_level = Logger::LL_WARN; break;
187  case Logger::LL_WARN: __log_level = Logger::LL_ERROR; break;
188  case Logger::LL_ERROR: __log_level = Logger::LL_NONE; break;
189  default: break;
190  }
191  }
192  }
193  }
194  } else if ( (tmp = argp->arg("l")) != NULL ) {
195  if ( strcmp(tmp, "debug") == 0 ) {
196  __log_level = Logger::LL_DEBUG;
197  } else if ( strcmp(tmp, "info") == 0 ) {
198  __log_level = Logger::LL_INFO;
199  } else if ( strcmp(tmp, "warn") == 0 ) {
200  __log_level = Logger::LL_WARN;
201  } else if ( strcmp(tmp, "error") == 0 ) {
202  __log_level = Logger::LL_ERROR;
203  } else if ( strcmp(tmp, "none") == 0 ) {
204  __log_level = Logger::LL_NONE;
205  }
206  }
207 
208  __has_net_service_name = argp->has_arg("net-service-name");
209  if (__has_net_service_name) {
210  __net_service_name = strdup(argp->arg("net-service-name"));
211  } else {
212  __net_service_name = NULL;
213  }
214 
215  __has_username = argp->has_arg("u");
216  if (__has_username) {
217  __username = strdup(argp->arg("u"));
218  } else {
219  __username = NULL;
220  }
221 
222  __has_groupname = argp->has_arg("u");
223  if (__has_groupname) {
224  __groupname = strdup(argp->arg("u"));
225  } else {
226  __groupname = NULL;
227  }
228 
229 
230  __config_file = NULL;
231  if (argp->arg("c")) {
232  __config_file = strdup(argp->arg("c"));
233  }
234 
235  __daemonize = argp->has_arg("D");
236  __daemonize_kill = __daemonize && argp->has_arg("k");
237  __daemonize_status = __daemonize && argp->has_arg("s");
238  __daemon_pid_file = NULL;
239  if (__daemonize && argp->arg("D")) {
240  __daemon_pid_file = strdup(argp->arg("D"));
241  } else {
242  __daemon_pid_file = NULL;
243  }
244  __show_help = argp->has_arg("h");
245  __bb_cleanup = argp->has_arg("C");
246 
247  __has_load_plugin_list = argp->has_arg("p") || argp->num_items() > 0;
248  if (__has_load_plugin_list) {
249  uint len = 0;
250  for (uint i = 0; i < argp->items().size(); i++) {
251  len += strlen(argp->items()[i]);
252  }
253  if (argp->has_arg("p")) {
254  len += strlen(argp->arg("p") + 1);
255  }
256  char res[len + argp->items().size()];
257  if (argp->has_arg("p") && argp->num_items() > 0) {
258  sprintf(res, "%s,%s,", argp->arg("p"), argp->items()[0]);
259  } else if (argp->has_arg("p")) {
260  sprintf(res, "%s", argp->arg("p"));
261  } else {
262  sprintf(res, "%s", argp->items()[0]);
263  }
264  for (uint i = 1; i < argp->items().size(); i++) {
265  char *tmp = strdup(res);
266  sprintf(res, "%s,%s", tmp, argp->items()[i]);
267  free(tmp);
268  }
269  __load_plugin_list = strdup(res);
270  } else {
271  __load_plugin_list = NULL;
272  }
273 
274  __init_plugin_cache = true;
275  __plugin_module_flags = Module::MODULE_FLAGS_DEFAULT;
276  __default_signal_handlers = true;
277 }
278 
279 
280 /** Destructor. */
282 {
283  free(__basename);
284  free(__default_plugin);
285  if (__has_loggers) free(__loggers);
286  if (__has_net_service_name) free(__net_service_name);
287  if (__has_username) free(__username);
288  if (__has_groupname) free(__groupname);
289  if (__has_load_plugin_list) free(__load_plugin_list);
290  if (__config_file) free(__config_file);
291  if (__daemon_pid_file) free(__daemon_pid_file);
292 }
293 
294 
295 /** Assignment operator.
296  * @param options options object to copy
297  * @return reference to this instance
298  */
299 InitOptions &
301 {
302  free(__basename);
303  __basename = strdup(options.__basename);
304  free(__default_plugin);
305  __default_plugin = strdup(options.__default_plugin);
306  __net_tcp_port = 0;
307  __has_net_tcp_port = options.__has_net_tcp_port;
308  if (__has_net_tcp_port) {
309  __net_tcp_port = options.__net_tcp_port;
310  }
311  if (__has_loggers) {
312  __has_loggers = false;
313  free(__loggers);
314  __loggers = NULL;
315  }
316  __has_loggers = options.__has_loggers;
317  if (__has_loggers) {
318  __loggers = strdup(options.__loggers);
319  }
320 
321  __log_level = options.__log_level;
322 
323  if (__has_net_service_name) {
324  __has_net_service_name = false;
325  free(__net_service_name);
326  __net_service_name = NULL;
327  }
328  __has_net_service_name = options.__has_net_service_name;
329  if (__has_net_service_name) {
330  __net_service_name = strdup(options.__net_service_name);
331  }
332 
333  if (__has_username) {
334  __has_username = false;
335  free(__username);
336  __username = NULL;
337  }
338  __has_username = options.__has_username;
339  if (__has_username) {
340  __username = strdup(options.__username);
341  }
342 
343  if (__has_groupname) {
344  __has_groupname = false;
345  free(__groupname);
346  __groupname = NULL;
347  }
348  __groupname = NULL;
349  __has_groupname = options.__has_groupname;
350  if (__has_groupname) {
351  __groupname = strdup(options.__groupname);
352  }
353 
354  if (__config_file) {
355  free(__config_file);
356  __config_file = NULL;
357  }
358  if (options.__config_file) {
359  __config_file = strdup(options.__config_file);
360  }
361 
362  __daemonize = options.__daemonize;
363  if (__daemon_pid_file) {
364  free(__daemon_pid_file);
365  __daemon_pid_file = NULL;
366  }
367  if (__daemonize && options.__daemon_pid_file) {
368  __daemon_pid_file = strdup(options.__daemon_pid_file);
369  }
370  __daemonize_kill = options.__daemonize_kill;
371  __daemonize_status = options.__daemonize_status;
372  __show_help = options.__show_help;
373  __bb_cleanup = options.__bb_cleanup;
374 
375  if (__load_plugin_list) {
376  free(__load_plugin_list);
377  __load_plugin_list = NULL;
378  }
379  __has_load_plugin_list = options.__has_load_plugin_list;
380  if (__has_load_plugin_list) {
381  __load_plugin_list = strdup(options.__load_plugin_list);
382  }
383 
384  __init_plugin_cache = options.__init_plugin_cache;
385  __plugin_module_flags = options.__plugin_module_flags;
386  __default_signal_handlers = options.__default_signal_handlers;
387 
388  return *this;
389 }
390 
391 
392 /** Set additional default plugin name.
393  * @param default_plugin_ additional default plugin name
394  * @return reference to this instance
395  */
396 InitOptions &
397 InitOptions::default_plugin(const char *default_plugin_)
398 {
399  free(__default_plugin);
400  __default_plugin = strdup(default_plugin_);
401  return *this;
402 }
403 
404 
405 /** Set Fawkes network TCP port.
406  * @param port TCP port
407  * @return reference to this instance
408  */
409 InitOptions &
410 InitOptions::net_tcp_port(unsigned short int port)
411 {
412  __has_net_tcp_port = true;
413  __net_tcp_port = port;
414  return *this;
415 }
416 
417 /** Set Fawkes network service name.
418  * @param service_name service name
419  * @return reference to this instance
420  */
421 InitOptions &
422 InitOptions::net_service_name(const char *service_name)
423 {
424  if (__has_net_service_name) {
425  __has_net_service_name = false;
426  free(__net_service_name);
427  }
428  if (service_name) {
429  __has_net_service_name = true;
430  __net_service_name = strdup(service_name);
431  }
432  return *this;
433 }
434 
435 /** Set daemonization options.
436  * @param daemonize daemonization requested
437  * @param kill kill a running daemon
438  * @param status print status about running daemon
439  * @param pid_file path to file to write PID to
440  * @return reference to this instance
441  */
442 InitOptions &
443 InitOptions::daemonize(bool daemonize, bool kill, bool status,
444  const char *pid_file)
445 {
446  __daemonize = daemonize;
447  __daemonize_kill = daemonize && kill;
448  __daemonize_status = daemonize && status;
449  if (daemonize && pid_file) {
450  __daemon_pid_file = strdup(pid_file);
451  }
452  return *this;
453 }
454 
455 /** Set loggers.
456  * @param loggers string of loggers
457  * @return reference to this instance
458  */
459 InitOptions &
461 {
462  if (__has_loggers) {
463  __has_loggers = false;
464  free(__loggers);
465  }
466  if (loggers) {
467  __has_loggers = true;
468  __loggers = strdup(loggers);
469  }
470  return *this;
471 }
472 
473 /** Set log level.
474  * @param log_level desired log level
475  * @return reference to this instance
476  */
477 InitOptions &
479 {
480  __log_level = log_level;
481  return *this;
482 }
483 
484 /** Set to show help.
485  * @param show_help true to request showing help information, false otherwise
486  * @return reference to this instance
487  */
488 InitOptions &
490 {
491  __show_help = show_help;
492  return *this;
493 }
494 
495 
496 /** Enable or disable plugin cache initialization.
497  * @param init_cache true to trigger plugin cache initialization, false to disable
498  * @return reference to this instance
499  */
500 InitOptions &
502 {
503  __init_plugin_cache = init_cache;
504  return *this;
505 }
506 
507 /** Set user name to run as.
508  * @param username user name to run as
509  * @return reference to this instance
510  */
511 InitOptions &
513 {
514  if (__has_username) {
515  __has_username = false;
516  free(__username);
517  }
518  if (username) {
519  __has_username = true;
520  __username = strdup(username);
521  }
522  return *this;
523 }
524 
525 
526 /** Set list of plugins to load during startup.
527  * @param plugin_list comma-separated list of names of plugins to load
528  * @return reference to this instance
529  */
530 InitOptions &
531 InitOptions::load_plugins(const char *plugin_list)
532 {
533  if (__has_load_plugin_list) {
534  __has_load_plugin_list = false;
535  free(__load_plugin_list);
536  __load_plugin_list = NULL;
537  }
538  if (plugin_list) {
539  __has_load_plugin_list = true;
540  __load_plugin_list = strdup(plugin_list);
541  }
542  return *this;
543 }
544 
545 
546 /** Set group name to run as.
547  * @param groupname user name to run as
548  * @return reference to this instance
549  */
550 InitOptions &
552 {
553  if (__has_groupname) {
554  __has_groupname = false;
555  free(__groupname);
556  }
557  if (groupname) {
558  __has_groupname = true;
559  __groupname = strdup(groupname);
560  }
561  return *this;
562 }
563 
564 /** Set config file path.
565  * @param config_file config file path
566  * @return reference to this instance
567  */
568 InitOptions &
570 {
571  if (__config_file) {
572  free(__config_file);
573  __config_file = NULL;
574  }
575  if (config_file) {
576  __config_file = strdup(config_file);
577  }
578  return *this;
579 }
580 
581 /** Set blackboard cleanup.
582  * @param bb_cleanup true to run blackboard cleanup, false otherwise
583  * @return reference to this instance
584  */
585 InitOptions &
587 {
588  __bb_cleanup = bb_cleanup;
589  return *this;
590 }
591 
592 
593 /** Set module flags.
594  * @param flags flags to open plugin modules with
595  * @return reference to this instance
596  */
597 InitOptions &
599 {
600  __plugin_module_flags = flags;
601  return *this;
602 }
603 
604 
605 /** Set default signal handlers.
606  * @param enable true to enable default signal handlers, false to disable. Note
607  * that if you disable the signal handlers you must stop the Fawkes main thread
608  * execution by yourself by some other means.
609  * @return reference to this instance
610  */
611 InitOptions &
613 {
614  __default_signal_handlers = enable;
615  return *this;
616 }
617 
618 
619 /** Get program basename.
620  * @return program base name
621  */
622 const char *
624 {
625  return __basename;
626 }
627 
628 
629 /** Get name of default plugin.
630  * This is usually the name of a meta plugin to load the appropriate
631  * plugins. It may have a specialized name on a specific robot
632  * platform. It defaults to "default". Note that "default" is always
633  * loaded to avoid confusion.
634  * @return default plugin name
635  */
636 const char *
638 {
639  return __default_plugin;
640 }
641 
642 
643 /** Check if TCP port has been passed.
644  * @return true if the parameter has been set, false otherwise
645  */
646 bool
648 {
649  return __has_net_tcp_port;
650 }
651 
652 /** Get Fawkes network TCP port.
653  * @return Fawkes network TCP port
654  */
655 unsigned short int
657 {
658  return __net_tcp_port;
659 }
660 
661 /** Check if network service name has been passed.
662  * @return true if the parameter has been set, false otherwise
663  */
664 bool
666 {
667  return __has_net_service_name;
668 }
669 
670 /** Get network service name.
671  * @return network service name
672  */
673 const char *
675 {
676  return __net_service_name;
677 }
678 
679 /** Check if plugin load list has been set.
680  * @return true if the parameter has been set, false otherwise
681  */
682 bool
684 {
685  return __has_load_plugin_list;
686 }
687 
688 /** Get plugin load list.
689  * @return plugin load list
690  */
691 const char *
693 {
694  return __load_plugin_list;
695 }
696 
697 /** Check if logger string has been passed.
698  * @return true if the parameter has been set, false otherwise
699  */
700 bool
702 {
703  return __has_loggers;
704 }
705 
706 /** Get logger string.
707  * @return logger stirng
708  */
709 const char *
711 {
712  return __loggers;
713 }
714 
715 /** Get log level.
716  * @return log level
717  */
720 {
721  return __log_level;
722 }
723 
724 /** Check if help has been requested.
725  * @return true if help has been requested, false otherwise
726  */
727 bool
729 {
730  return __show_help;
731 }
732 
733 /** Check if blackboard cleanup has been requested.
734  * @return true if blackboard cleanup has been requested, false otherwise
735  */
736 bool
738 {
739  return __bb_cleanup;
740 }
741 
742 
743 /** Check if plugin cache initialization has been requested.
744  * @return true if plugin cache initialization has been requested, false otherwise
745  */
746 bool
748 {
749  return __init_plugin_cache;
750 }
751 
752 
753 /** Check if default signal handlers should be enabled.
754  * @return true if default signal handlers have been requested, false otherwise
755  */
756 bool
758 {
759  return __default_signal_handlers;
760 }
761 
762 /** Check if daemonization has been requested.
763  * @return true if daemonization has been requested, false otherwise
764  */
765 bool
767 {
768  return __daemonize;
769 }
770 
771 /** Check if killing of daemon has been requested.
772  * @return true if killing of daemon has been requested, false otherwise
773  */
774 bool
776 {
777  return __daemonize_kill;
778 }
779 
780 /** Check if status of daemon has been requested.
781  * @return true if status of daemon has been requested, false otherwise
782  */
783 bool
785 {
786  return __daemonize_status;
787 }
788 
789 
790 /** Get daemon PID file.
791  * @return daemon PID file path
792  */
793 const char *
795 {
796  return __daemon_pid_file;
797 }
798 
799 
800 /** Check if user name has been passed.
801  * @return true if the parameter has been set, false otherwise
802  */
803 bool
805 {
806  return __has_username;
807 }
808 
809 
810 /** Get user name to run as.
811  * @return user name to run as
812  */
813 const char *
815 {
816  return __username;
817 }
818 
819 /** Check if group name has been passed.
820  * @return true if the parameter has been set, false otherwise
821  */
822 bool
824 {
825  return __has_groupname;
826 }
827 
828 /** Get group name to run as.
829  * @return group name to run as
830  */
831 const char *
833 {
834  return __groupname;
835 }
836 
837 
838 /** Get config file path.
839  * @return config file path
840  */
841 const char *
843 {
844  return __config_file;
845 }
846 
847 
848 /** Get plugin module flags.
849  * @return plugin module flags
850  */
853 {
854  return __plugin_module_flags;
855 }
856 
857 
858 } // end namespace runtime
859 } // end namespace fawkes
bool daemonize() const
Check if daemonization has been requested.
LogLevel
Log level.
Definition: logger.h:45
const char * program_name() const
Get name of program.
Definition: argparser.cpp:502
bool has_groupname() const
Check if group name has been passed.
informational output about normal procedures
Definition: logger.h:47
const char * arg(const char *argn)
Get argument value.
Definition: argparser.cpp:182
bool has_load_plugin_list() const
Check if plugin load list has been set.
const std::vector< const char *> & items() const
Get non-option items.
Definition: argparser.cpp:462
Fawkes library namespace.
bool bb_cleanup() const
Check if blackboard cleanup has been requested.
const char * groupname() const
Get group name to run as.
const char * net_service_name() const
Get network service name.
warning, should be investigated but software still functions, an example is that something was reques...
Definition: logger.h:48
Parse command line arguments.
Definition: argparser.h:66
InitOptions & load_plugins(const char *plugin_list)
Set list of plugins to load during startup.
bool has_loggers() const
Check if logger string has been passed.
Logger::LogLevel log_level() const
Get log level.
bool daemonize_status() const
Check if status of daemon has been requested.
const char * default_plugin() const
Get name of default plugin.
InitOptions & operator=(const InitOptions &options)
Assignment operator.
ModuleFlags
Flags for the loading process.
Definition: module.h:44
long int parse_int(const char *argn)
Parse argument as integer.
Definition: argparser.cpp:370
std::vector< const char *>::size_type num_items() const
Get number of non-option items.
Definition: argparser.cpp:472
error, may be recoverable (software still running) or not (software has to terminate).
Definition: logger.h:51
bool has_net_service_name() const
Check if network service name has been passed.
bool has_username() const
Check if user name has been passed.
Initialization options class.
Definition: init_options.h:37
unsigned short int net_tcp_port() const
Get Fawkes network TCP port.
InitOptions & user(const char *username)
Set user name to run as.
const char * daemon_pid_file() const
Get daemon PID file.
debug output, relevant only when tracking down problems
Definition: logger.h:46
bool default_signal_handlers() const
Check if default signal handlers should be enabled.
bool has_net_tcp_port() const
Check if TCP port has been passed.
const char * config_file() const
Get config file path.
const char * load_plugin_list() const
Get plugin load list.
bool show_help() const
Check if help has been requested.
InitOptions(const char *basename)
Constructor.
Module::ModuleFlags plugin_module_flags() const
Get plugin module flags.
const char * username() const
Get user name to run as.
bool has_arg(const char *argn)
Check if argument has been supplied.
Definition: argparser.cpp:169
const char * basename() const
Get program basename.
InitOptions & group(const char *groupname)
Set group name to run as.
Default flags, these are MODULE_BIND_GLOBAL, MODULE_BIND_NOW and MODULE_BIND_DEEP.
Definition: module.h:46
bool daemonize_kill() const
Check if killing of daemon has been requested.
bool init_plugin_cache() const
Check if plugin cache initialization has been requested.
const char * loggers() const
Get logger string.
use this to disable log output
Definition: logger.h:54