1
0

shell_find_create_view.c 633 B

123456789101112131415161718192021222324252627
  1. /*
  2. * shell_find_create_view.c
  3. */
  4. #include "private.h"
  5. #include <assert.h>
  6. /*--------------------------------------------------------- */
  7. clish_view_t *clish_shell_find_create_view(clish_shell_t * this,
  8. const char *name, const char *prompt)
  9. {
  10. clish_view_t *view = lub_bintree_find(&this->view_tree, name);
  11. if (NULL == view) {
  12. /* create a view */
  13. view = clish_view_new(name, prompt);
  14. assert(view);
  15. clish_shell_insert_view(this, view);
  16. } else {
  17. if (prompt) {
  18. /* set the prompt */
  19. clish_view__set_prompt(view, prompt);
  20. }
  21. }
  22. return view;
  23. }
  24. /*--------------------------------------------------------- */