private.h 736 B

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