private.h 819 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef VERSION
  2. #define VERSION "1.0.0"
  3. #endif
  4. #include <faux/ini.h>
  5. #define LOG_NAME "klishd-listen"
  6. #define LOG_SERVICE_NAME "klishd"
  7. #define DEFAULT_PIDFILE "/var/run/klishd.pid"
  8. #define DEFAULT_CFGFILE "/etc/klish/klishd.conf"
  9. #define DEFAULT_DBS "libxml2"
  10. /** @brief Command line and config file options
  11. */
  12. struct options {
  13. char *pidfile;
  14. char *cfgfile;
  15. bool_t cfgfile_userdefined;
  16. char *unix_socket_path;
  17. char *dbs;
  18. bool_t foreground; // Don't daemonize
  19. bool_t verbose;
  20. int log_facility;
  21. };
  22. // Options and config file
  23. void help(int status, const char *argv0);
  24. struct options *opts_init(void);
  25. void opts_free(struct options *opts);
  26. int opts_parse(int argc, char *argv[], struct options *opts);
  27. int opts_show(struct options *opts);
  28. faux_ini_t *config_parse(const char *cfgfile, struct options *opts);