shell_startup.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * shell_startup.c
  3. */
  4. #include "private.h"
  5. #include <assert.h>
  6. #include "lub/string.h"
  7. /*----------------------------------------------------------- */
  8. bool_t clish_shell_startup(clish_shell_t * this)
  9. {
  10. const char *banner;
  11. assert(this->startup);
  12. banner = clish_command__get_detail(this->startup);
  13. if (banner)
  14. tinyrl_printf(this->tinyrl, "%s\n", banner);
  15. return clish_shell_execute(this, this->startup, NULL, NULL);
  16. }
  17. /*----------------------------------------------------------- */
  18. void clish_shell__set_startup_view(clish_shell_t * this, const char * viewname)
  19. {
  20. clish_view_t *view;
  21. assert(this);
  22. assert(this->startup);
  23. /* Search for the view */
  24. view = clish_shell_find_create_view(this, viewname, NULL);
  25. clish_command__force_view(this->startup, view);
  26. }
  27. /*----------------------------------------------------------- */
  28. void clish_shell__set_startup_viewid(clish_shell_t * this, const char * viewid)
  29. {
  30. assert(this);
  31. assert(this->startup);
  32. clish_command__force_viewid(this->startup, viewid);
  33. }
  34. /*----------------------------------------------------------- */
  35. void clish_shell__set_default_shebang(clish_shell_t * this, const char * shebang)
  36. {
  37. assert(this);
  38. lub_string_free(this->default_shebang);
  39. this->default_shebang = lub_string_dup(shebang);
  40. }
  41. /*----------------------------------------------------------- */
  42. const char * clish_shell__get_default_shebang(const clish_shell_t * this)
  43. {
  44. assert(this);
  45. return this->default_shebang;
  46. }
  47. /*----------------------------------------------------------- */