private.h 848 B

1234567891011121314151617181920212223242526272829303132333435
  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 stop_on_error;
  18. bool_t dry_run;
  19. bool_t quiet;
  20. faux_list_t *commands;
  21. faux_list_t *files;
  22. };
  23. // Options
  24. void help(int status, const char *argv0);
  25. struct options *opts_init(void);
  26. void opts_free(struct options *opts);
  27. int opts_parse(int argc, char *argv[], struct options *opts);
  28. bool_t config_parse(const char *cfgfile, struct options *opts);
  29. // Interactive shell
  30. int klish_interactive_shell(ktp_session_t *ktp, struct options *opts);