shell_startup.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * shell_startup.c
  3. */
  4. #include "private.h"
  5. #include <assert.h>
  6. /*----------------------------------------------------------- */
  7. bool_t clish_shell_startup(clish_shell_t * this)
  8. {
  9. const char *banner;
  10. assert(this->startup);
  11. banner = clish_command__get_detail(this->startup);
  12. if (NULL != banner) {
  13. tinyrl_printf(this->tinyrl, "%s\n", banner);
  14. }
  15. return clish_shell_execute(this, this->startup, 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. /*----------------------------------------------------------- */