From cf87597226f5d6b269f1f2c4d6f402aa1eccb852 Mon Sep 17 00:00:00 2001 From: Maurus Cuelenaere Date: Thu, 21 May 2009 19:01:41 +0000 Subject: Commit FS#9174: Lua scripting language by Dan Everton git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21020 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/lua/strncat.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 apps/plugins/lua/strncat.c (limited to 'apps/plugins/lua/strncat.c') diff --git a/apps/plugins/lua/strncat.c b/apps/plugins/lua/strncat.c new file mode 100644 index 0000000000..5b15ff07b1 --- /dev/null +++ b/apps/plugins/lua/strncat.c @@ -0,0 +1,21 @@ +#include "rocklibc.h" + +/* gcc is broken and has a non-SUSv2 compliant internal prototype. + * This causes it to warn about a type mismatch here. Ignore it. */ +char *strncat(char *s, const char *t, size_t n) { + char *dest=s; + register char *max; + s+=strlen(s); + if (__unlikely((max=s+n)==s)) goto fini; + for (;;) { + if (__unlikely(!(*s = *t))) break; if (__unlikely(++s==max)) break; ++t; +#ifndef WANT_SMALL_STRING_ROUTINES + if (__unlikely(!(*s = *t))) break; if (__unlikely(++s==max)) break; ++t; + if (__unlikely(!(*s = *t))) break; if (__unlikely(++s==max)) break; ++t; + if (__unlikely(!(*s = *t))) break; if (__unlikely(++s==max)) break; ++t; +#endif + } + *s=0; +fini: + return dest; +} -- cgit v1.2.3