summaryrefslogtreecommitdiffstats
path: root/stubs
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2002-12-18 04:03:01 +0000
committerJeremy Katz <katzj@redhat.com>2002-12-18 04:03:01 +0000
commita0ecc493f50f693d23d8a16a040442bc67fe7a7a (patch)
treeeb835c1b40a6bcf3ac15de42e0f695c5acbbab39 /stubs
parent0d3756d7a030df2c93ca324726eae6941743f0f8 (diff)
downloadanaconda-a0ecc493f50f693d23d8a16a040442bc67fe7a7a.tar.gz
anaconda-a0ecc493f50f693d23d8a16a040442bc67fe7a7a.tar.xz
anaconda-a0ecc493f50f693d23d8a16a040442bc67fe7a7a.zip
add simple wrapper for wlite from dietstubs to provide wc functionality
without gconv data for ftp/http/hd stage2
Diffstat (limited to 'stubs')
-rw-r--r--stubs/Makefile9
-rw-r--r--stubs/unicode-lite.c45
2 files changed, 52 insertions, 2 deletions
diff --git a/stubs/Makefile b/stubs/Makefile
index 640f4653e..3aac5f14e 100644
--- a/stubs/Makefile
+++ b/stubs/Makefile
@@ -1,16 +1,21 @@
include ../Makefile.inc
LIBBZ = libbz2.so.1
+LIBUTF8 = libunicode-lite.so.1
-all: $(LIBBZ)
+all: $(LIBBZ) $(LIBUTF8)
$(LIBBZ): bzip.c
- gcc -fPIC -shared -o $(LIBBZ) bzip.c
+ gcc -fPIC -shared -o $@ $<
+
+$(LIBUTF8): unicode-lite.c
+ gcc -fPIC -shared -o $@ $< -lwlite
clean:
rm -f *.so.* *.o
install:
install $(LIBBZ) $(DESTDIR)/$(RUNTIMEDIR)
+ install $(LIBUTF8) $(DESTDIR)/$(RUNTIMEDIR)
depend:
diff --git a/stubs/unicode-lite.c b/stubs/unicode-lite.c
new file mode 100644
index 000000000..605395b8f
--- /dev/null
+++ b/stubs/unicode-lite.c
@@ -0,0 +1,45 @@
+/*
+ * unicode-lite.c - simple library to LD_PRELOAD for emulation of
+ * wide character functionality when glibc gconv data isn't available
+ *
+ * Matt Wilson <msw@redhat.com>
+ * Jeremy Katz <katzj@redhat.com>
+ *
+ * Copyright 2002 Red Hat, Inc.
+ *
+ * This software may be freely redistributed under the terms of the GNU
+ * General Public License.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+
+#define WLITE_REDEF_STDC 0
+#include <wlite_wchar.h>
+#include <wlite_wctype.h>
+
+
+int wcwidth (wchar_t c) {
+ return wlite_wcwidth(c);
+}
+
+size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, void *ps) {
+ return wlite_mbrtowc (pwc, s, n, ps);
+}
+
+int iswspace (wchar_t c) {
+ return wlite_iswctype((c), wlite_space_);
+}
+
+size_t wcrtomb(char *s, wchar_t wc, void *ps) {
+ return wlite_wcrtomb (s, wc, ps);
+}
+
+/* lie to slang to trick it into using unicode chars for linedrawing */
+char *setlocale (int category, const char *locale) {
+ if (locale == NULL || *locale == '\0')
+ return "en_US.UTF-8";
+ return 0;
+}