misc.c 684 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. fprintf(stderr, "Empty item\n");
  28. return -1;
  29. }
  30. printf("[%s]\n", script);
  31. return 0;
  32. }