From: John Hodge Date: Mon, 25 Aug 2014 05:07:05 +0000 (+0800) Subject: Usermode - Hacky and stubbed libiconv and libintl clones/implementations X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=960f995130b6442fae1e6840f5b2c96da1af08b3;hp=d8238c6af5d96fb4c3638a253d16fb497f865f16;p=tpg%2Facess2.git Usermode - Hacky and stubbed libiconv and libintl clones/implementations --- 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; +}