Skip to content

Instantly share code, notes, and snippets.

@c9s
Created June 18, 2014 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c9s/772af3186bf8929e6ffd to your computer and use it in GitHub Desktop.
Save c9s/772af3186bf8929e6ffd to your computer and use it in GitHub Desktop.
#if _GNU_SOURCE || POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700 || __DARWIN_C_LEVEL >= 200809L
#define HAVE_STRNDUP
#endif
#if _SVID_SOURCE || _BSD_SOURCE \
|| _XOPEN_SOURCE >= 500 \
|| _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED \
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L \
|| __DARWIN_C_LEVEL >= 200809L
#define HAVE_STRDUP
#endif
#ifndef HAVE_STRDUP
char *strdup(const char *s);
#endif
#ifndef HAVE_STRNDUP
char *strndup(const char *s, int n);
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment