summaryrefslogtreecommitdiffstats
path: root/intl/os2compat.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2002-03-15 18:32:24 +0000
committerBruno Haible <bruno@clisp.org>2009-06-23 12:07:51 +0200
commit80f98cac13c76b6f17d38df44576043ad9784119 (patch)
tree785bbd4d38246849b3a1a1ce31fe5236b0a8e31d /intl/os2compat.c
parent0382ac87360ebd393e2b887ebdae00d5556fbbad (diff)
downloadexternal_gettext-80f98cac13c76b6f17d38df44576043ad9784119.zip
external_gettext-80f98cac13c76b6f17d38df44576043ad9784119.tar.gz
external_gettext-80f98cac13c76b6f17d38df44576043ad9784119.tar.bz2
OS/2 update from Andrew Zabolotny <zap@cobra.ru>.
Diffstat (limited to 'intl/os2compat.c')
-rw-r--r--intl/os2compat.c55
1 files changed, 26 insertions, 29 deletions
diff --git a/intl/os2compat.c b/intl/os2compat.c
index 681e98a..3ca8266 100644
--- a/intl/os2compat.c
+++ b/intl/os2compat.c
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <string.h>
+#include <sys/param.h>
/* A version of getenv() that works from DLLs */
extern unsigned long DosScanEnv (const unsigned char *pszName, unsigned char **ppszValue);
@@ -38,64 +39,60 @@ _nl_getenv (const char *name)
}
/* A fixed size buffer. */
-#define LOCALEDIR_MAX 260
-char _nl_default_dirname__[LOCALEDIR_MAX+1];
+char _nl_default_dirname__[MAXPATHLEN+1];
-char *_os2_libdir = NULL;
-char *_os2_localealiaspath = NULL;
-char *_os2_localedir = NULL;
+char *_nlos2_libdir = NULL;
+char *_nlos2_localealiaspath = NULL;
+char *_nlos2_localedir = NULL;
static __attribute__((constructor)) void
-os2_initialize ()
+nlos2_initialize ()
{
char *root = getenv ("UNIXROOT");
char *gnulocaledir = getenv ("GNULOCALEDIR");
- _os2_libdir = gnulocaledir;
- if (!_os2_libdir)
+ _nlos2_libdir = gnulocaledir;
+ if (!_nlos2_libdir)
{
if (root)
{
size_t sl = strlen (root);
- _os2_libdir = (char *) malloc (sl + strlen (LIBDIR) + 1);
- memcpy (_os2_libdir, root, sl);
- memcpy (_os2_libdir + sl, LIBDIR, strlen (LIBDIR) + 1);
+ _nlos2_libdir = (char *) malloc (sl + strlen (LIBDIR) + 1);
+ memcpy (_nlos2_libdir, root, sl);
+ memcpy (_nlos2_libdir + sl, LIBDIR, strlen (LIBDIR) + 1);
}
else
- _os2_libdir = LIBDIR;
+ _nlos2_libdir = LIBDIR;
}
- _os2_localealiaspath = gnulocaledir;
- if (!_os2_localealiaspath)
+ _nlos2_localealiaspath = gnulocaledir;
+ if (!_nlos2_localealiaspath)
{
if (root)
{
size_t sl = strlen (root);
- _os2_localealiaspath = (char *) malloc (sl + strlen (LOCALE_ALIAS_PATH) + 1);
- memcpy (_os2_localealiaspath, root, sl);
- memcpy (_os2_localealiaspath + sl, LOCALE_ALIAS_PATH, strlen (LOCALE_ALIAS_PATH) + 1);
+ _nlos2_localealiaspath = (char *) malloc (sl + strlen (LOCALE_ALIAS_PATH) + 1);
+ memcpy (_nlos2_localealiaspath, root, sl);
+ memcpy (_nlos2_localealiaspath + sl, LOCALE_ALIAS_PATH, strlen (LOCALE_ALIAS_PATH) + 1);
}
else
- _os2_localealiaspath = LOCALE_ALIAS_PATH;
+ _nlos2_localealiaspath = LOCALE_ALIAS_PATH;
}
- _os2_localedir = gnulocaledir;
- if (!_os2_localedir)
+ _nlos2_localedir = gnulocaledir;
+ if (!_nlos2_localedir)
{
if (root)
{
size_t sl = strlen (root);
- _os2_localedir = (char *) malloc (sl + strlen (LOCALEDIR) + 1);
- memcpy (_os2_localedir, root, sl);
- memcpy (_os2_localedir + sl, LOCALEDIR, strlen (LOCALEDIR) + 1);
+ _nlos2_localedir = (char *) malloc (sl + strlen (LOCALEDIR) + 1);
+ memcpy (_nlos2_localedir, root, sl);
+ memcpy (_nlos2_localedir + sl, LOCALEDIR, strlen (LOCALEDIR) + 1);
}
else
- _os2_localedir = LOCALEDIR;
+ _nlos2_localedir = LOCALEDIR;
}
- {
- extern const char _nl_default_dirname__[];
- if (strlen (_os2_localedir) <= LOCALEDIR_MAX)
- strcpy (_nl_default_dirname__, _os2_localedir);
- }
+ if (strlen (_nlos2_localedir) <= MAXPATHLEN)
+ strcpy (_nl_default_dirname__, _nlos2_localedir);
}