p≡p engine FORK
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.8 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. #ifndef __APPLE__
  2. #define _POSIX_C_SOURCE 200809L
  3. #endif
  4. #include <unistd.h>
  5. #include <strings.h>
  6. #include <sys/select.h>
  7. #include <regex.h>
  8. #ifndef ANDROID
  9. #include <uuid/uuid.h>
  10. #endif
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. const char *unix_local_db(void);
  15. const char *gpg_conf(void);
  16. const char *gpg_agent_conf(void);
  17. const char *gpg_home(void);
  18. #ifdef ANDROID
  19. char *stpncpy(char *, const char *, size_t);
  20. char *stpcpy(char *, const char *);
  21. // Beware: predictable pseudo random with static seed!
  22. // Only the lowest 31 bits are filled randomly.
  23. long int random(void);
  24. const char *android_system_db(void);
  25. #define SYSTEM_DB android_system_db()
  26. #define LIBGPGME "libgpgme.so"
  27. #elif __APPLE__
  28. #include "TargetConditionals.h"
  29. #include <string.h>
  30. #if TARGET_OS_IPHONE
  31. extern char* SystemDB;
  32. #define SYSTEM_DB SystemDB
  33. #endif
  34. #endif
  35. #if !defined(BSD) && !defined(__APPLE__)
  36. size_t strlcpy(char* dst, const char* src, size_t size);
  37. size_t strlcat(char* dst, const char* src, size_t size);
  38. // N.B. This is ifdef'd out because NDK users sometimes have trouble finding regex functions in
  39. // the library in spite of the inclusion of regex.h - this is a FIXME, but since iOS is
  40. // *currently* the only netpgp user, we will ifdef this so that we don't block Android.
  41. #ifdef USE_NETPGP
  42. int regnexec(const regex_t* preg, const char* string,
  43. size_t len, size_t nmatch, regmatch_t pmatch[], int eflags);
  44. #endif
  45. #endif
  46. #ifndef _UUID_STRING_T
  47. #define _UUID_STRING_T
  48. typedef char uuid_string_t[37];
  49. #endif
  50. #ifdef UUID
  51. #undef UUID
  52. #endif
  53. // on *nix, uuid_t is an array and already implements pointer semantics
  54. #define UUID uuid_t
  55. #ifdef ANDROID
  56. typedef char pEpUUID[16];
  57. void uuid_generate_random(pEpUUID out);
  58. void uuid_unparse_upper(pEpUUID uu, uuid_string_t out);
  59. #else
  60. typedef uuid_t pEpUUID;
  61. #endif
  62. #ifdef __cplusplus
  63. }
  64. #endif