diff --git frontend/parse.c frontend/parse.c index 4a6b660..adf63fa 100644 --- frontend/parse.c +++ frontend/parse.c @@ -137,6 +137,26 @@ static iconv_t os2_iconv_open (const char *tocode, const char *fromcode) static int const lame_alpha_version_enabled = LAME_ALPHA_VERSION; static int const internal_opts_enabled = INTERNAL_OPTS; +/* Mac OS X before 10.7 does not implement strnlen(), so ... */ +/* Find the length of S, but scan at most MAXLEN characters. If no '\0' + terminator is found within the first MAXLEN characters, return MAXLEN. */ +#ifdef __APPLE__ +#include +#endif +#if defined(__APPLE__) && \ + (!defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < 1070) +static size_t +strnlen(const char *s, size_t maxlen) +{ + const char *e; + size_t n; + + for (e = s, n = 0; *e && n < maxlen; e++, n++) + ; + return n; +} +#endif + /* GLOBAL VARIABLES. set by parse_args() */ /* we need to clean this up */