From 960f995130b6442fae1e6840f5b2c96da1af08b3 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 25 Aug 2014 13:07:05 +0800 Subject: [PATCH] Usermode - Hacky and stubbed libiconv and libintl clones/implementations --- Usermode/Libraries/libiconv.so_src/Makefile | 15 ++++++++ Usermode/Libraries/libiconv.so_src/iconv.c | 27 ++++++++++++++ .../libiconv.so_src/include_exp/iconv.h | 20 +++++++++++ Usermode/Libraries/libintl.so_src/Makefile | 16 +++++++++ Usermode/Libraries/libintl.so_src/gettext.c | 35 +++++++++++++++++++ .../libintl.so_src/include_exp/libintl.h | 13 +++++++ Usermode/Libraries/libintl.so_src/main.c | 7 ++++ 7 files changed, 133 insertions(+) create mode 100644 Usermode/Libraries/libiconv.so_src/Makefile create mode 100644 Usermode/Libraries/libiconv.so_src/iconv.c create mode 100644 Usermode/Libraries/libiconv.so_src/include_exp/iconv.h create mode 100644 Usermode/Libraries/libintl.so_src/Makefile create mode 100644 Usermode/Libraries/libintl.so_src/gettext.c create mode 100644 Usermode/Libraries/libintl.so_src/include_exp/libintl.h create mode 100644 Usermode/Libraries/libintl.so_src/main.c diff --git a/Usermode/Libraries/libiconv.so_src/Makefile b/Usermode/Libraries/libiconv.so_src/Makefile new file mode 100644 index 00000000..50f257ac --- /dev/null +++ b/Usermode/Libraries/libiconv.so_src/Makefile @@ -0,0 +1,15 @@ +# Acess 2 "libiconv" +# + +include ../Makefile.cfg + +CPPFLAGS += +CFLAGS += -Wall +LDFLAGS += -lc -soname libiconv.so + +OBJ = iconv.o +BIN = libiconv.so + +include ../Makefile.tpl + + diff --git a/Usermode/Libraries/libiconv.so_src/iconv.c b/Usermode/Libraries/libiconv.so_src/iconv.c new file mode 100644 index 00000000..d339555c --- /dev/null +++ b/Usermode/Libraries/libiconv.so_src/iconv.c @@ -0,0 +1,27 @@ +/* + */ +#include +#include + +// === CODE === +int SoMain(void) +{ + return 0; +} + +iconv_t iconv_open(const char *to, const char *from) +{ + return NULL; +} + +size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) +{ + _SysDebug("WTF are you using iconv for?"); + return 0; +} + +int iconv_close(iconv_t cd) +{ + return 0; +} + diff --git a/Usermode/Libraries/libiconv.so_src/include_exp/iconv.h b/Usermode/Libraries/libiconv.so_src/include_exp/iconv.h new file mode 100644 index 00000000..817abeed --- /dev/null +++ b/Usermode/Libraries/libiconv.so_src/include_exp/iconv.h @@ -0,0 +1,20 @@ +/* + * Acess2 libiconv + * - By John Hodge (thePowersGang) + * + * iconv.h + * - External header + */ +#ifndef _ICONV_H_ +#define _ICONV_H_ + +#include + +typedef void *iconv_t; + +extern iconv_t iconv_open(const char *to, const char *from); +extern size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); +extern int iconv_close(iconv_t cd); + +#endif + diff --git a/Usermode/Libraries/libintl.so_src/Makefile b/Usermode/Libraries/libintl.so_src/Makefile new file mode 100644 index 00000000..398ffc4e --- /dev/null +++ b/Usermode/Libraries/libintl.so_src/Makefile @@ -0,0 +1,16 @@ +# Acess 2 "libintl" +# + +include ../Makefile.cfg + +CPPFLAGS += +CFLAGS += -Wall +LDFLAGS += -lc + +OBJ = main.o gettext.o +BIN = libintl.so + +include ../Makefile.tpl + + + diff --git a/Usermode/Libraries/libintl.so_src/gettext.c b/Usermode/Libraries/libintl.so_src/gettext.c new file mode 100644 index 00000000..3b10d411 --- /dev/null +++ b/Usermode/Libraries/libintl.so_src/gettext.c @@ -0,0 +1,35 @@ +/* + */ +#include +#include + +// === CODE === +char *gettext(const char *msg) +{ + return dcgettext(NULL, msg, 0); +} +char *dgettext(const char *domain, const char *msg) +{ + return dcgettext(domain, msg, 0); +} +char *dcgettext(const char *domain, const char *msg, int category) +{ + return (char*)msg; +} + +char *ngettext(const char *msg, const char *msgp, unsigned long int n) +{ + return dcngettext(NULL, msg, msgp, n, 0); +} +char *dngettext(const char *domain, const char *msg, const char *msgp, unsigned long int n) +{ + return dcngettext(domain, msg, msgp, n, 0); +} +char *dcngettext(const char *domain, const char *msg, const char *msgp, unsigned long int n, int category) +{ + if( n == 1 ) + return (char*)msg; + else + return (char*)msgp; +} + diff --git a/Usermode/Libraries/libintl.so_src/include_exp/libintl.h b/Usermode/Libraries/libintl.so_src/include_exp/libintl.h new file mode 100644 index 00000000..54c09938 --- /dev/null +++ b/Usermode/Libraries/libintl.so_src/include_exp/libintl.h @@ -0,0 +1,13 @@ +/* + */ +#ifndef _LIBINTL_H_ +#define _LIBINTL_H_ + +extern char *gettext(const char *msg); +extern char *dgettext(const char *domain, const char *msg); +extern char *dcgettext(const char *domain, const char *msg, int category); +extern char *ngettext(const char *msg, const char *msgp, unsigned long int n); +extern char *dngettext(const char *domain, const char *msg, const char *msgp, unsigned long int n); +extern char *dcngettext(const char *domain, const char *msg, const char *msgp, unsigned long int n, int category); + +#endif diff --git a/Usermode/Libraries/libintl.so_src/main.c b/Usermode/Libraries/libintl.so_src/main.c new file mode 100644 index 00000000..30dead73 --- /dev/null +++ b/Usermode/Libraries/libintl.so_src/main.c @@ -0,0 +1,7 @@ +/* + */ + +int SoMain(void) +{ + return 0; +} -- 2.20.1