100-portability.patch 779 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --- a/tools/kwbimage.c
  2. +++ b/tools/kwbimage.c
  3. @@ -206,6 +206,30 @@ INVL_DATA:
  4. exit (EXIT_FAILURE);
  5. }
  6. +#ifndef __GLIBC__
  7. +#ifndef __FreeBSD__
  8. +static ssize_t
  9. +getline(char **line, size_t *len, FILE *fd)
  10. +{
  11. + char *tmp;
  12. + int tmplen;
  13. +
  14. + tmp = fgetln(fd, &tmplen);
  15. + if (!tmp)
  16. + return -1;
  17. +
  18. + if (!*line || tmplen > *len) {
  19. + *len = tmplen + 1;
  20. + *line = realloc(*line, *len);
  21. + }
  22. +
  23. + strncpy(*line, tmp, tmplen);
  24. + line[tmplen] = 0;
  25. + return tmplen;
  26. +}
  27. +#endif
  28. +#endif
  29. +
  30. /*
  31. * this function sets the kwbimage header by-
  32. * 1. Abstracting input command line arguments data
  33. --- a/include/image.h
  34. +++ b/include/image.h
  35. @@ -49,6 +49,10 @@
  36. #endif /* USE_HOSTCC */
  37. +#ifndef ulong
  38. +#define ulong unsigned long
  39. +#endif
  40. +
  41. #include <command.h>
  42. #if defined(CONFIG_FIT)