src/platform_unix.h
author Volker Birk <vb@pep.foundation>
Sun, 31 Jul 2016 09:04:42 +0200
branchkeysync
changeset 949 779219e99833
parent 948 2c689b7707a9
child 1057 abff13590a4c
permissions -rw-r--r--
...
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>
vb@948
     8
#include <uuid/uuid.h>
vb@130
     9
vb@130
    10
#ifdef __cplusplus
vb@130
    11
extern "C" {
vb@130
    12
#endif
vb@130
    13
vb@1
    14
const char *unix_local_db(void);
Edouard@347
    15
vb@1
    16
const char *gpg_conf(void);
krista@763
    17
const char *gpg_agent_conf(void);
Edouard@175
    18
const char *gpg_home(void);
vb@130
    19
Edouard@338
    20
#ifdef ANDROID
Edouard@380
    21
Edouard@348
    22
char *stpncpy(char *, const char *, size_t);
Edouard@348
    23
char *stpcpy(char *, const char *);
roker@438
    24
roker@438
    25
// Beware: predictable pseudo random with static seed!
roker@438
    26
// Only the lowest 31 bits are filled randomly.
Edouard@338
    27
long int random(void);
roker@438
    28
Edouard@348
    29
const char *android_system_db(void);
Edouard@348
    30
#define SYSTEM_DB android_system_db()
Edouard@348
    31
#define LIBGPGME "libgpgme.so"
Edouard@380
    32
Edouard@380
    33
#elif __APPLE__
Edouard@380
    34
#include "TargetConditionals.h"
krista@919
    35
#include <string.h>
Edouard@380
    36
#if TARGET_OS_IPHONE
Edouard@380
    37
Edouard@380
    38
extern char* SystemDB;
Edouard@380
    39
#define SYSTEM_DB SystemDB
Edouard@380
    40
    
Edouard@380
    41
#endif
Edouard@338
    42
#endif
Edouard@338
    43
vb@926
    44
#if !defined(BSD) && !defined(__APPLE__)
krista@918
    45
size_t strlcpy(char* dst, const	char* src, size_t size);
krista@918
    46
size_t strlcat(char* dst, const	char* src, size_t size);
krista@918
    47
#endif
krista@918
    48
vb@948
    49
#ifndef _UUID_STRING_T
vb@948
    50
#define _UUID_STRING_T
vb@948
    51
typedef char uuid_string_t[37];
vb@948
    52
#endif
vb@948
    53
#ifdef UUID
vb@949
    54
#undef UUID
vb@949
    55
#endif
vb@948
    56
// on *nix, uuid_t is an array and already implements pointer semantics
vb@948
    57
#define UUID uuid_t
vb@948
    58
vb@130
    59
#ifdef __cplusplus
vb@130
    60
}
vb@130
    61
#endif