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