src/platform_unix.h
author Hussein Kasem <huss@pep-project.org>
Thu, 25 Aug 2016 13:56:15 +0200
branchkeysync
changeset 1084 4e7571cf39ba
parent 1057 abff13590a4c
child 1118 df6c0c9aa76a
permissions -rw-r--r--
fix uuid.h include for Android
vb@926
     1
#ifndef __APPLE__
vb@130
     2
#define _POSIX_C_SOURCE 200809L
vb@926
     3
#endif
vb@130
     4
vb@130
     5
#include <unistd.h>
vb@130
     6
#include <strings.h>
vb@130
     7
#include <sys/select.h>
krista@1033
     8
#include <regex.h>
huss@1084
     9
huss@1084
    10
#ifndef ANDROID
vb@948
    11
#include <uuid/uuid.h>
huss@1084
    12
#else
huss@1084
    13
#include <linux/uuid.h>
huss@1084
    14
#endif
huss@1084
    15
vb@130
    16
vb@130
    17
#ifdef __cplusplus
vb@130
    18
extern "C" {
vb@130
    19
#endif
vb@130
    20
vb@1
    21
const char *unix_local_db(void);
Edouard@347
    22
vb@1
    23
const char *gpg_conf(void);
krista@763
    24
const char *gpg_agent_conf(void);
Edouard@175
    25
const char *gpg_home(void);
vb@130
    26
Edouard@338
    27
#ifdef ANDROID
Edouard@380
    28
Edouard@348
    29
char *stpncpy(char *, const char *, size_t);
Edouard@348
    30
char *stpcpy(char *, const char *);
roker@438
    31
roker@438
    32
// Beware: predictable pseudo random with static seed!
roker@438
    33
// Only the lowest 31 bits are filled randomly.
Edouard@338
    34
long int random(void);
roker@438
    35
Edouard@348
    36
const char *android_system_db(void);
Edouard@348
    37
#define SYSTEM_DB android_system_db()
Edouard@348
    38
#define LIBGPGME "libgpgme.so"
Edouard@380
    39
Edouard@380
    40
#elif __APPLE__
Edouard@380
    41
#include "TargetConditionals.h"
krista@919
    42
#include <string.h>
Edouard@380
    43
#if TARGET_OS_IPHONE
Edouard@380
    44
Edouard@380
    45
extern char* SystemDB;
Edouard@380
    46
#define SYSTEM_DB SystemDB
Edouard@380
    47
    
Edouard@380
    48
#endif
Edouard@338
    49
#endif
Edouard@338
    50
vb@926
    51
#if !defined(BSD) && !defined(__APPLE__)
krista@918
    52
size_t strlcpy(char* dst, const	char* src, size_t size);
krista@918
    53
size_t strlcat(char* dst, const	char* src, size_t size);
krista@1033
    54
int regnexec(const regex_t* preg, const char* string,
krista@1033
    55
             size_t len, size_t nmatch, regmatch_t pmatch[], int eflags);
krista@918
    56
#endif
krista@918
    57
vb@948
    58
#ifndef _UUID_STRING_T
vb@948
    59
#define _UUID_STRING_T
vb@948
    60
typedef char uuid_string_t[37];
vb@948
    61
#endif
vb@948
    62
#ifdef UUID
vb@949
    63
#undef UUID
vb@949
    64
#endif
vb@948
    65
// on *nix, uuid_t is an array and already implements pointer semantics
vb@948
    66
#define UUID uuid_t
vb@948
    67
vb@130
    68
#ifdef __cplusplus
vb@130
    69
}
vb@130
    70
#endif