diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2020-07-28 12:29:43 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2020-07-28 12:29:56 +0200 |
commit | dc1cfa6252073ac345412e7df9c5cc0365bb7f11 (patch) | |
tree | a62eccae0fbc7317c3bf67db4cb8ceb79dfd96e7 /nk_strndup.c | |
parent | 145149d65915e3f2eb068032b428ee5cfc0295c9 (diff) | |
download | libnitrokey-dc1cfa6252073ac345412e7df9c5cc0365bb7f11.tar.gz libnitrokey-dc1cfa6252073ac345412e7df9c5cc0365bb7f11.tar.bz2 |
Extract Nitrokey Storage only features to separate unit
Diffstat (limited to 'nk_strndup.c')
-rw-r--r-- | nk_strndup.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/nk_strndup.c b/nk_strndup.c new file mode 100644 index 0000000..e24c584 --- /dev/null +++ b/nk_strndup.c @@ -0,0 +1,14 @@ +#include "nk_strndup.h" + +#ifndef strndup +#ifdef _WIN32 +#pragma message "Using own strndup" +char * strndup(const char* str, size_t maxlen){ + size_t len = strnlen(str, maxlen); + char* dup = (char *) malloc(len + 1); + memcpy(dup, str, len); + dup[len] = 0; + return dup; +} +#endif +#endif
\ No newline at end of file |