1
0

shell_startup.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 (NULL != banner) {
  14. tinyrl_printf(this->tinyrl, "%s\n", banner);
  15. }
  16. return clish_shell_execute(this, this->startup, NULL);
  17. }
  18. /*----------------------------------------------------------- */
  19. void clish_shell__set_startup_view(clish_shell_t * this, const char * viewname)
  20. {
  21. clish_view_t *view;
  22. assert(this);
  23. assert(this->startup);
  24. /* Search for the view */
  25. view = clish_shell_find_create_view(this, viewname, NULL);
  26. clish_command__force_view(this->startup, view);
  27. }
  28. /*----------------------------------------------------------- */
  29. void clish_shell__set_startup_viewid(clish_shell_t * this, const char * viewid)
  30. {
  31. assert(this);
  32. assert(this->startup);
  33. clish_command__force_viewid(this->startup, viewid);
  34. }
  35. /*----------------------------------------------------------- */
  36. void clish_shell__set_default_shebang(clish_shell_t * this, const char * shebang)
  37. {
  38. assert(this);
  39. lub_string_free(this->default_shebang);
  40. this->default_shebang = lub_string_dup(shebang);
  41. }
  42. /*----------------------------------------------------------- */
  43. const char * clish_shell__get_default_shebang(const clish_shell_t * this)
  44. {
  45. assert(this);
  46. return this->default_shebang;
  47. }
  48. /*----------------------------------------------------------- */