shell_expand.c 776 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * shell_expand.c
  3. */
  4. #include <stdlib.h>
  5. #include <assert.h>
  6. #include "lub/string.h"
  7. #include "private.h"
  8. /*----------------------------------------------------------- */
  9. char * clish_shell__expand_text(const clish_shell_t *this,
  10. clish_command_t *cmd, clish_pargv_t *pargv, const char *text)
  11. {
  12. assert(this);
  13. if (!text)
  14. return NULL;
  15. return clish_variable_expand(text, this->viewid, cmd, pargv);
  16. }
  17. /*----------------------------------------------------------- */
  18. char * clish_shell__expand_variable(const clish_shell_t *this,
  19. clish_command_t *cmd, clish_pargv_t *pargv, const char *var)
  20. {
  21. assert(this);
  22. if (!var)
  23. return NULL;
  24. return clish_variable__get_value(var, this->viewid, cmd, pargv);
  25. }
  26. /*----------------------------------------------------------- */