iaction.c 920 B

12345678910111213141516171819202122232425262728293031323334
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <assert.h>
  5. #include <faux/str.h>
  6. #include <faux/conv.h>
  7. #include <klish/khelper.h>
  8. #include <klish/kaction.h>
  9. char *iaction_to_text(const iaction_t *iaction, int level)
  10. {
  11. char *str = NULL;
  12. char *tmp = NULL;
  13. tmp = faux_str_sprintf("%*cACTION {\n", level, ' ');
  14. faux_str_cat(&str, tmp);
  15. faux_str_free(tmp);
  16. attr2ctext(&str, "sym", iaction->sym, level + 1);
  17. attr2ctext(&str, "lock", iaction->lock, level + 1);
  18. attr2ctext(&str, "interrupt", iaction->interrupt, level + 1);
  19. attr2ctext(&str, "interactive", iaction->interactive, level + 1);
  20. attr2ctext(&str, "exec_on", iaction->exec_on, level + 1);
  21. attr2ctext(&str, "update_retcode", iaction->update_retcode, level + 1);
  22. attr2ctext(&str, "script", iaction->script, level + 1);
  23. tmp = faux_str_sprintf("%*c},\n\n", level, ' ');
  24. faux_str_cat(&str, tmp);
  25. faux_str_free(tmp);
  26. return str;
  27. }