iplugin.c 660 B

123456789101112131415161718192021222324252627282930
  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/kplugin.h>
  9. char *iplugin_to_text(const iplugin_t *iplugin, int level)
  10. {
  11. char *str = NULL;
  12. char *tmp = NULL;
  13. tmp = faux_str_sprintf("%*cPLUGIN {\n", level, ' ');
  14. faux_str_cat(&str, tmp);
  15. faux_str_free(tmp);
  16. attr2ctext(&str, "name", iplugin->name, level + 1);
  17. attr2ctext(&str, "file", iplugin->file, level + 1);
  18. attr2ctext(&str, "global", iplugin->global, level + 1);
  19. tmp = faux_str_sprintf("%*c},\n\n", level, ' ');
  20. faux_str_cat(&str, tmp);
  21. faux_str_free(tmp);
  22. return str;
  23. }