infotojson.h 949 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /** json structure
  2. * This file contains definition of json structure
  3. **/
  4. #include <err.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <unistd.h>
  8. #include <string.h>
  9. #include <sys/types.h>
  10. #include <sys/stat.h>
  11. #include <fcntl.h>
  12. #include <stdbool.h>
  13. #include <sqlite3.h>
  14. #include "database.h"
  15. #include "ccan/talloc/talloc.h"
  16. #include "ccan/string/string.h"
  17. #include "utils.h"
  18. #include "tools/tools.h"
  19. struct json
  20. {
  21. char *module;
  22. char *title;
  23. char *author;
  24. char **depends;
  25. char **desc;
  26. };
  27. /* Function for storing json structure to file given struct json*/
  28. static int storejsontofile(const struct json *jsonobj, const char *jsonfile);
  29. /*Function to store in database*/
  30. static int storejsontodb(const struct json *jsonobj, const char *db);
  31. /*create json structure*/
  32. static struct json *createjson(char **infofile, const char *author, const char *directory);
  33. /*Extract info from file*/
  34. static char **extractinfo(char **file);