src/platform_windows.h
author Krista Grothoff <krista@pep-project.org>
Fri, 22 Jul 2016 12:29:06 +0200
branchstrl-imp
changeset 918 45c80cc4c2ed
parent 785 5e78006d4abf
child 948 2c689b7707a9
child 971 158b15e9d626
child 1122 bbd0d058f0e3
permissions -rw-r--r--
work on fix #36: conditional strlcpy/strcat impl for non-BSD systems. Branched to make testing on other OSs easier before merge to default.
vb@0
     1
#pragma once
vb@0
     2
vb@0
     3
// Windows platform specifica
vb@0
     4
vb@24
     5
#pragma warning(disable : 4996)
vb@0
     6
vb@125
     7
#include <string.h>
vb@130
     8
#include <io.h>
vb@219
     9
#include <basetsd.h>
vb@125
    10
vb@0
    11
#ifdef __cplusplus
vb@0
    12
extern "C" {
vb@0
    13
#endif
vb@0
    14
vb@219
    15
#define ssize_t SSIZE_T
vb@86
    16
#define RTLD_LAZY 1
vb@130
    17
#define mode_t int
vb@86
    18
vb@0
    19
void *dlopen(const char *filename, int flag);
vb@0
    20
int dlclose(void *handle);
vb@0
    21
void *dlsym(void *handle, const char *symbol);
vb@132
    22
int mkstemp(char *templ);
vb@0
    23
vb@86
    24
#ifndef strdup
vb@113
    25
#define strdup(A) _strdup((A))
vb@86
    26
#endif
vb@86
    27
#ifndef snprintf
vb@89
    28
#define snprintf(...) _snprintf(__VA_ARGS__)
vb@86
    29
#endif
vb@82
    30
#ifndef strtok_r
vb@82
    31
#define strtok_r(A, B, C) strtok_s((A), (B), (C))
vb@82
    32
#endif
vb@85
    33
#ifndef strncasecmp
vb@85
    34
#define strncasecmp(A, B, C) _strnicmp((A), (B), (C))
vb@85
    35
#endif
vb@784
    36
#ifndef strcasecmp
vb@785
    37
#define strcasecmp(A, B) _stricmp((A), (B))
vb@784
    38
#endif
vb@113
    39
#ifndef gmtime_r
vb@113
    40
#define gmtime_r(A, B) gmtime_s((B), (A))
vb@132
    41
#endif
vb@132
    42
#ifndef ftruncate
vb@132
    43
#define ftruncate(A, B) _chsize((A), (B))
vb@130
    44
#endif
vb@130
    45
#ifndef ftello
vb@130
    46
#define ftello(A) ((off_t) _ftelli64(A))
vb@113
    47
#endif
vb@113
    48
vb@82
    49
char *strndup(const char *s1, size_t n);
vb@282
    50
char *stpcpy(char *dst, const char *src);
vb@80
    51
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@918
    54
vb@0
    55
const char *windoze_local_db(void);
vb@0
    56
const char *windoze_system_db(void);
vb@0
    57
const char *gpg_conf(void);
vb@0
    58
vb@54
    59
long random(void);
vb@54
    60
vb@125
    61
#ifndef inline
vb@130
    62
#define inline __inline
vb@125
    63
#endif
vb@125
    64
vb@0
    65
#ifdef __cplusplus
vb@0
    66
}
vb@0
    67
#endif