infotojson.h 878 B

12345678910111213141516171819202122232425262728293031323334353637
  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. struct json
  19. {
  20. char *module;
  21. char *title;
  22. char *author;
  23. char **desc;
  24. };
  25. /* Function for storing json structure to file given struct json*/
  26. static int storejsontofile(const struct json *jsonobj, const char *jsonfile);
  27. /*Function to store in database*/
  28. static int storejsontodb(const struct json *jsonobj, const char *db);
  29. /*create json structure*/
  30. static struct json *createjson(char **infofile, char *author);
  31. /*Extract info from file*/
  32. static char **extractinfo(char **file);