openbsd-ports/textproc/scrollkeeper/patches/patch-libs_i18n_c

26 lines
687 B
Plaintext
Raw Normal View History

$OpenBSD: patch-libs_i18n_c,v 1.1 2003/07/12 06:24:49 marcm Exp $
--- libs/i18n.c.orig Sun Jun 15 20:21:29 2003
+++ libs/i18n.c Sun Jun 15 20:21:32 2003
@@ -38,6 +38,21 @@ enum {
* All rights reserved.
*/
+/* Well, of course the whole world uses glibc... */
+static char *
+strndup(const char *str, int len) {
+ char *ret;
+
+ if ((str == NULL || len < 0))
+ return(NULL);
+ ret = (char *)malloc(len + 1);
+ if (ret == NULL)
+ return(NULL);
+ memcpy(ret, str, len);
+ ret[len] = '\0';
+ return(ret);
+}
+
/* Support function for compute_locale_variants. */
static int explode_locale(const char *locale, char **language,
char **territory, char **codeset, char **modifier)