summaryrefslogtreecommitdiff
path: root/pico/utf8stub.c
diff options
context:
space:
mode:
authorEduardo Chappa <echappa@gmx.com>2013-02-03 00:59:38 -0700
committerEduardo Chappa <echappa@gmx.com>2013-02-03 00:59:38 -0700
commit094ca96844842928810f14844413109fc6cdd890 (patch)
treee60efbb980f38ba9308ccb4fb2b77b87bbc115f3 /pico/utf8stub.c
downloadalpine-094ca96844842928810f14844413109fc6cdd890.tar.xz
Initial Alpine Version
Diffstat (limited to 'pico/utf8stub.c')
-rw-r--r--pico/utf8stub.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/pico/utf8stub.c b/pico/utf8stub.c
new file mode 100644
index 00000000..d8738c9a
--- /dev/null
+++ b/pico/utf8stub.c
@@ -0,0 +1,86 @@
+#if !defined(lint) && !defined(DOS)
+static char rcsid[] = "$Id: utf8stub.c 769 2007-10-24 00:15:40Z hubert@u.washington.edu $";
+#endif
+
+/*
+ * ========================================================================
+ * Copyright 2006-2007 University of Washington
+ * Copyright 2013 Eduardo Chappa
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * ========================================================================
+ */
+
+
+#include <system.h>
+#include "utf8stub.h"
+
+
+/*
+ * Stub functions to fill in functions used in utf8 support routines
+ */
+
+
+void *
+fs_get (size_t size)
+{
+ void *block = malloc (size ? size : (size_t) 1);
+ if (!block) fatal ("Out of memory");
+ return (block);
+}
+
+
+void
+fs_resize(void **block, size_t size)
+{
+ if (!(*block = realloc (*block,size ? size : (size_t) 1)))
+ fatal ("Can't resize memory");
+}
+
+void
+fs_give (void **block)
+{
+ free (*block);
+ *block = NULL;
+}
+
+void
+fatal(char *s)
+{
+ ;
+}
+
+
+int
+compare_ulong(unsigned long l1, unsigned long l2)
+{
+ if (l1 < l2) return -1;
+ if (l1 > l2) return 1;
+ return 0;
+}
+
+
+int
+compare_cstring(unsigned char *s1, unsigned char *s2)
+{
+ int i;
+ if (!s1) return s2 ? -1 : 0; /* empty string cases */
+ else if (!s2) return 1;
+ for (; *s1 && *s2; s1++,s2++)
+ if ((i = (compare_ulong (islower (*s1) ? toupper (*s1) : *s1,
+ islower (*s2) ? toupper (*s2) : *s2))) != 0)
+ return i; /* found a difference */
+ if (*s1) return 1; /* first string is longer */
+ return *s2 ? -1 : 0; /* second string longer : strings identical */
+}
+
+int
+panicking(void)
+{
+ return(0);
+}