misc.c 649 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. *
  3. */
  4. #include <assert.h>
  5. #include <stdio.h>
  6. #include <unistd.h>
  7. #include <string.h>
  8. #include <stdlib.h>
  9. #include <errno.h>
  10. #include <faux/str.h>
  11. #include <faux/list.h>
  12. #include <klish/kcontext.h>
  13. int klish_nop(kcontext_t *context)
  14. {
  15. context = context; // Happy compiler
  16. return 0;
  17. }
  18. // Symbol for testing purposes
  19. int klish_tsym(kcontext_t *context)
  20. {
  21. const kaction_t *action = NULL;
  22. const char *script = NULL;
  23. action = (kaction_t *)faux_list_data(kcontext_action_iter(context));
  24. script = kaction_script(action);
  25. if (faux_str_is_empty(script)) {
  26. printf("[<empty>]\n");
  27. return -1;
  28. }
  29. printf("[%s]\n", script);
  30. return 0;
  31. }