Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add stub implementation for libintl/gettext
These adds the stubs from gettext-tiny 0.0.5 from here: https://github.com/sabotage-linux/gettext-tiny
- Loading branch information
1 parent
4fa7ed9
commit b39b515
Showing
8 changed files
with
200 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#ifndef LIBINTL_H | ||
#define LIBINTL_H | ||
|
||
char *gettext(const char *msgid); | ||
char *dgettext(const char *domainname, const char *msgid); | ||
char *dcgettext(const char *domainname, const char *msgid, int category); | ||
char *ngettext(const char *msgid1, const char *msgid2, unsigned long n); | ||
char *dngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n); | ||
char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n, int category); | ||
|
||
char *textdomain(const char *domainname); | ||
char *bind_textdomain_codeset(const char *domainname, const char *codeset); | ||
char *bindtextdomain(const char *domainname, const char *dirname); | ||
|
||
#undef gettext_noop | ||
#define gettext_noop(X) X | ||
|
||
#ifndef LIBINTL_NO_MACROS | ||
/* if these macros are defined, configure checks will detect libintl as | ||
* built into the libc because test programs will work without -lintl. | ||
* for example: | ||
* checking for ngettext in libc ... yes | ||
* the consequence is that -lintl will not be added to the LDFLAGS. | ||
* so if for some reason you want that libintl.a gets linked, | ||
* add -DLIBINTL_NO_MACROS=1 to your CPPFLAGS. */ | ||
|
||
#define gettext(X) ((char*) (X)) | ||
#define dgettext(dom, X) ((void)(dom), (char*) (X)) | ||
#define dcgettext(dom, X, cat) ((void)(dom), (void)(cat), (char*) (X)) | ||
#define ngettext(X, Y, N) \ | ||
((char*) (((N) == 1) ? ((void)(Y), (X)) : ((void)(X), (Y)))) | ||
#define dngettext(dom, X, Y, N) \ | ||
((dom), (char*) (((N) == 1) ? ((void)(Y), (X)) : ((void)(X), (Y)))) | ||
#define dcngettext(dom, X, Y, N, cat) \ | ||
((dom), (cat), (char*) (((N) == 1) ? ((void)(Y), (X)) : ((void)(X), (Y)))) | ||
#define bindtextdomain(X, Y) ((void)(X), (void)(Y), (char*) "/") | ||
#define bind_textdomain_codeset(dom, codeset) \ | ||
((void)(dom), (void)(codeset), (char*) 0) | ||
#define textdomain(X) ((void)(X), (char*) "messages") | ||
|
||
#undef ENABLE_NLS | ||
#undef DISABLE_NLS | ||
#define DISABLE_NLS 1 | ||
|
||
#if __GNUC__ +0 > 3 | ||
/* most ppl call bindtextdomain() without using its return value | ||
thus we get tons of warnings about "statement with no effect" */ | ||
#pragma GCC diagnostic ignored "-Wunused-value" | ||
#endif | ||
|
||
#endif | ||
|
||
#include <stdio.h> | ||
#define gettext_printf(args...) printf(args) | ||
|
||
/* to supply LC_MESSAGES and other stuff GNU expects to be exported when | ||
including libintl.h */ | ||
#include <locale.h> | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Makefile for uClibc-ng | ||
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. | ||
|
||
top_srcdir=../ | ||
top_builddir=../ | ||
include $(top_builddir)Rules.mak | ||
all: libs | ||
include Makefile.in | ||
include $(top_srcdir)Makerules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Makefile for uClibc-ng | ||
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. | ||
|
||
subdirs += libintl | ||
|
||
CFLAGS-libintl := -DNOT_IN_libc -DIS_IN_libintl $(SSP_ALL_CFLAGS) | ||
|
||
libintl_DIR := $(top_srcdir)libintl | ||
libintl_OUT := $(top_builddir)libintl | ||
|
||
libintl_SRC-$(UCLIBC_HAS_LIBINTL) := libintl.c | ||
|
||
libintl_SRC := $(addprefix $(libintl_DIR)/,$(libintl_SRC-y)) | ||
libintl_OBJ := $(patsubst $(libintl_DIR)/%.c,$(libintl_OUT)/%.o,$(libintl_SRC)) | ||
|
||
ifeq ($(DOPIC),y) | ||
libintl-a-y := $(libintl_OBJ:.o=.os) | ||
else | ||
libintl-a-y := $(libintl_OBJ) | ||
endif | ||
libintl-so-y := $(libintl_OBJ:.o=.os) | ||
|
||
objclean-y += CLEAN_libintl | ||
|
||
$(libintl_OUT)/libintl.oS: $(libintl_SRC) | ||
$(Q)$(RM) $@ | ||
$(compile-m) | ||
|
||
CLEAN_libintl: | ||
$(do_rm) $(addprefix $(libintl_OUT)/*., o os oS a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* Copyright (C) 2003 Manuel Novoa III | ||
* Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> | ||
* | ||
* Trivial Stubs, Public Domain. | ||
*/ | ||
|
||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <errno.h> | ||
|
||
char *gettext(const char *msgid) | ||
{ | ||
return (char *) msgid; | ||
} | ||
|
||
char *dgettext(const char *domainname, const char *msgid) | ||
{ | ||
(void) domainname; | ||
return (char *) msgid; | ||
} | ||
|
||
char *dcgettext(const char *domainname, const char *msgid, int category) | ||
{ | ||
(void) domainname; | ||
(void) category; | ||
return (char *) msgid; | ||
} | ||
|
||
char *ngettext(const char *msgid1, const char *msgid2, unsigned long n) | ||
{ | ||
return (char *) ((n == 1) ? msgid1 : msgid2); | ||
} | ||
|
||
char *dngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n) | ||
{ | ||
(void) domainname; | ||
return (char *) ((n == 1) ? msgid1 : msgid2); | ||
} | ||
|
||
char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n, int category) | ||
{ | ||
(void) domainname; | ||
(void) category; | ||
return (char *) ((n == 1) ? msgid1 : msgid2); | ||
} | ||
|
||
char *textdomain(const char *domainname) | ||
{ | ||
static const char default_str[] = "messages"; | ||
|
||
if (domainname && *domainname && strcmp(domainname, default_str)) { | ||
errno = EINVAL; | ||
return NULL; | ||
} | ||
return (char *) default_str; | ||
} | ||
|
||
char *bindtextdomain(const char *domainname, const char *dirname) | ||
{ | ||
static const char dir[] = "/"; | ||
|
||
if (!domainname || !*domainname | ||
|| (dirname && ((dirname[0] != '/') || dirname[1])) | ||
) { | ||
errno = EINVAL; | ||
return NULL; | ||
} | ||
|
||
return (char *) dir; | ||
} | ||
|
||
char *bind_textdomain_codeset(const char *domainname, const char *codeset) | ||
{ | ||
if (!domainname || !*domainname || (codeset && strcasecmp(codeset, "UTF-8"))) { | ||
errno = EINVAL; | ||
} | ||
return NULL; | ||
} | ||
|
||
/* trick configure tests checking for gnu libintl, as in the copy included in gdb */ | ||
const char *_nl_expand_alias () { return NULL; } | ||
int _nl_msg_cat_cntr = 0; |