src/platform_unix.h
author Krista Grothoff <krista@pep-project.org>
Sat, 24 Sep 2016 18:09:18 +0200
branchENGINE-27
changeset 1185 4b01328f3cf2
parent 1095 fe699b711ae6
child 1118 df6c0c9aa76a
child 1126 129b561095a6
permissions -rw-r--r--
ENGINE-27: update_identity no longer pays attention to the input identity's fpr, but pulls one from elect_pubkey.
     1 #ifndef __APPLE__
     2 #define _POSIX_C_SOURCE 200809L
     3 #endif
     4 
     5 #include <unistd.h>
     6 #include <strings.h>
     7 #include <sys/select.h>
     8 #include <regex.h>
     9 
    10 #ifdef __cplusplus
    11 extern "C" {
    12 #endif
    13 
    14 const char *unix_local_db(void);
    15 
    16 const char *gpg_conf(void);
    17 const char *gpg_agent_conf(void);
    18 const char *gpg_home(void);
    19 
    20 #ifdef ANDROID
    21 
    22 char *stpncpy(char *, const char *, size_t);
    23 char *stpcpy(char *, const char *);
    24 
    25 // Beware: predictable pseudo random with static seed!
    26 // Only the lowest 31 bits are filled randomly.
    27 long int random(void);
    28 
    29 const char *android_system_db(void);
    30 #define SYSTEM_DB android_system_db()
    31 #define LIBGPGME "libgpgme.so"
    32 
    33 #elif __APPLE__
    34 #include "TargetConditionals.h"
    35 #include <string.h>
    36 #if TARGET_OS_IPHONE
    37 
    38 extern char* SystemDB;
    39 #define SYSTEM_DB SystemDB
    40     
    41 #endif
    42 #endif
    43 
    44 #if !defined(BSD) && !defined(__APPLE__)
    45 size_t strlcpy(char* dst, const	char* src, size_t size);
    46 size_t strlcat(char* dst, const	char* src, size_t size);
    47 
    48 // N.B. This is ifdef'd out because NDK users sometimes have trouble finding regex functions in
    49 //      the library in spite of the inclusion of regex.h - this is a FIXME, but since iOS is
    50 //      *currently* the only netpgp user, we will ifdef this so that we don't block Android.
    51 #ifdef USE_NETPGP
    52 int regnexec(const regex_t* preg, const char* string,
    53              size_t len, size_t nmatch, regmatch_t pmatch[], int eflags);
    54 #endif
    55 
    56 #endif
    57 
    58 #ifdef __cplusplus
    59 }
    60 #endif