private.h 871 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include <faux/list.h>
  2. #include <klish/ktp.h>
  3. #include <klish/ktp_session.h>
  4. #ifndef VERSION
  5. #define VERSION "1.0.0"
  6. #endif
  7. #define DEFAULT_CFGFILE "/etc/klish/klish.conf"
  8. #define DEFAULT_PAGER "/usr/bin/less -I -F -e -X -K -d"
  9. /** @brief Command line and config file options
  10. */
  11. struct options {
  12. bool_t verbose;
  13. char *cfgfile;
  14. bool_t cfgfile_userdefined;
  15. char *unix_socket_path;
  16. char *pager;
  17. bool_t pager_enabled;
  18. bool_t stop_on_error;
  19. bool_t dry_run;
  20. bool_t quiet;
  21. faux_list_t *commands;
  22. faux_list_t *files;
  23. };
  24. // Options
  25. void help(int status, const char *argv0);
  26. struct options *opts_init(void);
  27. void opts_free(struct options *opts);
  28. int opts_parse(int argc, char *argv[], struct options *opts);
  29. bool_t config_parse(const char *cfgfile, struct options *opts);
  30. // Interactive shell
  31. int klish_interactive_shell(ktp_session_t *ktp, struct options *opts);