/* Stupid gcc always includes its own builtin strlen()... */
extern size_t bb_strlen(const char *string);
+#ifndef BB_STRLEN_IMPLEMENTATION
#define strlen(x) bb_strlen(x)
+#endif
char *bb_xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
+
+/* Since gcc always inlines strlen(), this saves a byte or two, but we need
+ * the #undef here to avoid endless loop from #define strlen bb_strlen */
+#ifdef L_strlen
+#define BB_STRLEN_IMPLEMENTATION
+#endif
+
#include "libbb.h"
#endif
#ifdef L_strlen
-/* Since gcc always inlines strlen(), this saves a byte or two, but we need
- * the #undef here to avoid endless loop from #define strlen bb_strlen */
-#undef strlen
size_t bb_strlen(const char *string)
{
return(strlen(string));