From 2065e654a357c6bf45c5747e25b713415eab8983 Mon Sep 17 00:00:00 2001 From: fluxgen <fluxgen> Date: Sat, 26 Apr 2003 15:46:03 +0000 Subject: removed nl_types_cygnus and did some cleaning --- src/i18n.cc | 22 ++++++++++------------ src/i18n.hh | 29 ++++++++++++----------------- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/i18n.cc b/src/i18n.cc index 929b3fd..5b3b2ca 100644 --- a/src/i18n.cc +++ b/src/i18n.cc @@ -1,5 +1,5 @@ // i18n.hh for Fluxbox Window Manager -// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) +// Copyright (c) 2001 - 2003 Henrik Kinnunen (fluxgen(at)users.sourceforge.net) // // i18n.cc for Blackbox - an X11 Window manager // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) @@ -22,27 +22,21 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: i18n.cc,v 1.8 2002/12/02 22:50:57 fluxgen Exp $ +// $Id: i18n.cc,v 1.9 2003/04/26 15:46:03 fluxgen Exp $ //usr GNU extensions #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif // _GNU_SOURCE -#ifdef HAVE_CONFIG_H -#include "../config.h" -#endif // HAVE_CONFIG_H - #include "i18n.hh" #include <X11/Xlocale.h> - #include <cstdlib> #include <cstring> #include <cstdio> - #ifdef HAVE_LOCALE_H #include <locale.h> #endif // HAVE_LOCALE_H @@ -59,15 +53,18 @@ void NLSInit(const char *catalog) { I18n::I18n():m_multibyte(false), m_catalog_fd((nl_catd)(-1)) { -#ifdef HAVE_SETLOCALE +#ifdef HAVE_SETLOCALE //make sure we don't get 0 to m_locale string char *temp = setlocale(LC_ALL, ""); m_locale = ( temp ? temp : ""); if (m_locale.size() == 0) { cerr<<"Warning: Failed to set locale, reverting to \"C\""<<endl; #endif // HAVE_SETLOCALE + m_locale = "C"; -#ifdef HAVE_SETLOCALE + +#ifdef HAVE_SETLOCALE + } else { // MB_CUR_MAX returns the size of a char in the current locale if (MB_CUR_MAX > 1) @@ -109,7 +106,7 @@ void I18n::openCatalog(const char *catalog) { catalog_filename += '/'; catalog_filename += catalog; -#ifdef MCLoadBySet +#ifdef MCLoadBySet m_catalog_fd = catopen(catalog_filename.c_str(), MCLoadBySet); #else // !MCLoadBySet m_catalog_fd = catopen(catalog_filename.c_str(), NL_CAT_LOCALE); @@ -125,7 +122,8 @@ void I18n::openCatalog(const char *catalog) { } -const char *I18n::getMessage(int set_number, int message_number, const char *default_message) { +const char *I18n::getMessage(int set_number, int message_number, + const char *default_message) { #if defined(NLS) && defined(HAVE_CATGETS) if (m_catalog_fd != (nl_catd)-1) diff --git a/src/i18n.hh b/src/i18n.hh index 6f5febf..32503e0 100644 --- a/src/i18n.hh +++ b/src/i18n.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: i18n.hh,v 1.10 2002/12/01 13:42:07 rathnor Exp $ +// $Id: i18n.hh,v 1.11 2003/04/26 15:46:03 fluxgen Exp $ #ifndef I18N_HH #define I18N_HH @@ -30,37 +30,32 @@ #include "../nls/blackbox-nls.hh" #ifdef HAVE_CONFIG_H -#include "../config.h" +#include "config.h" #endif // HAVE_CONFIG_H -#ifdef HAVE_LOCALE_H -# include <locale.h> +#ifdef HAVE_LOCALE_H +#include <locale.h> #endif // HAVE_LOCALE_H -#ifdef HAVE_NL_TYPES_H +#ifdef HAVE_NL_TYPES_H // this is needed for linux libc5 systems extern "C" { -# include <nl_types.h> +#include <nl_types.h> } -#else // HAVE_NL_TYPES_H -#include "nl_types_cygnus.h" #endif // HAVE_NL_TYPES_H -#ifdef __CYGWIN32__ -# include "nl_types_cygnus.h" -#endif - #include <string> class I18n { public: static I18n *instance(); - inline const char *getLocale(void) const { return m_locale.c_str(); } - inline bool multibyte(void) const { return m_multibyte; } - inline const nl_catd &getCatalogFd(void) const { return m_catalog_fd; } + inline const char *getLocale() const { return m_locale.c_str(); } + inline bool multibyte() const { return m_multibyte; } + inline const nl_catd &getCatalogFd() const { return m_catalog_fd; } - const char *getMessage(int set_number, int message_number, const char *default_messsage = 0); - void openCatalog(const char *); + const char *getMessage(int set_number, int message_number, + const char *default_messsage = 0); + void openCatalog(const char *catalog); private: I18n(); ~I18n(); -- cgit v0.11.2