strlcpy as Perl_my_strlcat and Perl_my_strlcpy to the Perl core.
Thanks Russ!
p4raw-id: //depot/perl@28525
Apo |void* |my_cxt_init |NN int *index|size_t size
#endif
+#ifndef HAS_STRLCAT
+Apno |Size_t |my_strlcat |NULLOK char *dst|NULLOK const char *src|Size_t size
+#endif
+
+#ifndef HAS_STRLCPY
+Apno |Size_t |my_strlcpy |NULLOK char *dst|NULLOK const char *src|Size_t size
+#endif
+
#ifdef PERL_MAD
Mnp |void |pad_peg |NN const char* s
#if defined(PERL_IN_DUMP_C) || defined(PERL_DECL_PROT)
#endif
#ifdef PERL_IMPLICIT_CONTEXT
#endif
+#ifndef HAS_STRLCAT
+#endif
+#ifndef HAS_STRLCPY
+#endif
#ifdef PERL_MAD
#ifdef PERL_CORE
#define pad_peg Perl_pad_peg
#endif
#ifdef PERL_IMPLICIT_CONTEXT
#endif
+#ifndef HAS_STRLCAT
+#endif
+#ifndef HAS_STRLCPY
+#endif
#ifdef PERL_MAD
#ifdef PERL_CORE
#define pad_peg Perl_pad_peg
Perl_my_snprintf
Perl_my_vsnprintf
Perl_my_cxt_init
+Perl_my_strlcat
+Perl_my_strlcpy
# ex: set ro:
# define PERL_MY_VSNPRINTF_GUARDED
#endif
+#ifdef HAS_STRLCAT
+# define my_strlcat strlcat
+#else
+# define my_strlcat Perl_my_strlcat
+#endif
+
+#ifdef HAS_STRLCPY
+# define my_strlcpy strlcpy
+#else
+# define my_strlcpy Perl_my_strlcpy
+#endif
+
/* Configure gets this right but the UTS compiler gets it wrong.
-- Hal Morris <hom00@utsglobal.com> */
#ifdef UTS
#endif
+#ifndef HAS_STRLCAT
+PERL_CALLCONV Size_t Perl_my_strlcat(char *dst, const char *src, Size_t size);
+#endif
+
+#ifndef HAS_STRLCPY
+PERL_CALLCONV Size_t Perl_my_strlcpy(char *dst, const char *src, Size_t size);
+#endif
+
#ifdef PERL_MAD
PERL_CALLCONV void Perl_pad_peg(const char* s)
__attribute__nonnull__(1);
}
#endif
+#ifndef HAS_STRLCAT
+Size_t
+Perl_my_strlcat(char *dst, const char *src, Size_t size)
+{
+ Size_t used, length, copy;
+
+ used = strlen(dst);
+ length = strlen(src);
+ if (size > 0 && used < size - 1) {
+ copy = (length >= size - used) ? size - used - 1 : length;
+ memcpy(dst + used, src, copy);
+ dst[used + copy] = '\0';
+ }
+ return used + length;
+}
+#endif
+
+#ifndef HAS_STRLCPY
+Size_t
+Perl_my_strlcpy(char *dst, const char *src, Size_t size)
+{
+ Size_t length, copy;
+
+ length = strlen(src);
+ if (size > 0) {
+ copy = (length >= size) ? size - 1 : length;
+ memcpy(dst, src, copy);
+ dst[copy] = '\0';
+ }
+ return length;
+}
+#endif
+
/*
* Local variables:
* c-indentation-style: bsd