~ubuntu-branches/ubuntu/maverick/texinfo/maverick

« back to all changes in this revision

Viewing changes to intl/os2compat.c

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2005-10-28 15:10:30 UTC
  • mto: (2.1.1 dapper) (3.1.4 hardy)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20051028151030-9nsf2s2k2z3fktjt
Tags: upstream-4.8
ImportĀ upstreamĀ versionĀ 4.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include <stdlib.h>
25
25
#include <string.h>
 
26
#include <sys/param.h>
26
27
 
27
28
/* A version of getenv() that works from DLLs */
28
29
extern unsigned long DosScanEnv (const unsigned char *pszName, unsigned char **ppszValue);
37
38
    return value;
38
39
}
39
40
 
40
 
char _nl_default_dirname[] =    /* a 260+1 bytes large buffer */
41
 
  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
42
 
  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
43
 
  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
44
 
  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
45
 
  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
46
 
  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
47
 
  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
48
 
  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
49
 
  "\0\0\0\0"
50
 
#define LOCALEDIR_MAX 260
 
41
/* A fixed size buffer.  */
 
42
char libintl_nl_default_dirname[MAXPATHLEN+1];
51
43
 
52
 
char *_os2_libdir = NULL;
53
 
char *_os2_localealiaspath = NULL;
54
 
char *_os2_localedir = NULL;
 
44
char *_nlos2_libdir = NULL;
 
45
char *_nlos2_localealiaspath = NULL;
 
46
char *_nlos2_localedir = NULL;
55
47
 
56
48
static __attribute__((constructor)) void
57
 
os2_initialize ()
 
49
nlos2_initialize ()
58
50
{
59
51
  char *root = getenv ("UNIXROOT");
60
52
  char *gnulocaledir = getenv ("GNULOCALEDIR");
61
53
 
62
 
  _os2_libdir = gnulocaledir;
63
 
  if (!_os2_libdir)
 
54
  _nlos2_libdir = gnulocaledir;
 
55
  if (!_nlos2_libdir)
64
56
    {
65
57
      if (root)
66
58
        {
67
59
          size_t sl = strlen (root);
68
 
          _os2_libdir = (char *) malloc (sl + strlen (LIBDIR) + 1);
69
 
          memcpy (_os2_libdir, root, sl);
70
 
          memcpy (_os2_libdir + sl, LIBDIR, strlen (LIBDIR) + 1);
 
60
          _nlos2_libdir = (char *) malloc (sl + strlen (LIBDIR) + 1);
 
61
          memcpy (_nlos2_libdir, root, sl);
 
62
          memcpy (_nlos2_libdir + sl, LIBDIR, strlen (LIBDIR) + 1);
71
63
        }
72
64
      else
73
 
        _os2_libdir = LIBDIR;
 
65
        _nlos2_libdir = LIBDIR;
74
66
    }
75
67
 
76
 
  _os2_localealiaspath = gnulocaledir;
77
 
  if (!_os2_localealiaspath)
 
68
  _nlos2_localealiaspath = gnulocaledir;
 
69
  if (!_nlos2_localealiaspath)
78
70
    {
79
71
      if (root)
80
72
        {
81
73
          size_t sl = strlen (root);
82
 
          _os2_localealiaspath = (char *) malloc (sl + strlen (LOCALE_ALIAS_PATH) + 1);
83
 
          memcpy (_os2_localealiaspath, root, sl);
84
 
          memcpy (_os2_localealiaspath + sl, LOCALE_ALIAS_PATH, strlen (LOCALE_ALIAS_PATH) + 1);
 
74
          _nlos2_localealiaspath = (char *) malloc (sl + strlen (LOCALE_ALIAS_PATH) + 1);
 
75
          memcpy (_nlos2_localealiaspath, root, sl);
 
76
          memcpy (_nlos2_localealiaspath + sl, LOCALE_ALIAS_PATH, strlen (LOCALE_ALIAS_PATH) + 1);
85
77
        }
86
78
     else
87
 
        _os2_localealiaspath = LOCALE_ALIAS_PATH;
 
79
        _nlos2_localealiaspath = LOCALE_ALIAS_PATH;
88
80
    }
89
81
 
90
 
  _os2_localedir = gnulocaledir;
91
 
  if (!_os2_localedir)
 
82
  _nlos2_localedir = gnulocaledir;
 
83
  if (!_nlos2_localedir)
92
84
    {
93
85
      if (root)
94
86
        {
95
87
          size_t sl = strlen (root);
96
 
          _os2_localedir = (char *) malloc (sl + strlen (LOCALEDIR) + 1);
97
 
          memcpy (_os2_localedir, root, sl);
98
 
          memcpy (_os2_localedir + sl, LOCALEDIR, strlen (LOCALEDIR) + 1);
 
88
          _nlos2_localedir = (char *) malloc (sl + strlen (LOCALEDIR) + 1);
 
89
          memcpy (_nlos2_localedir, root, sl);
 
90
          memcpy (_nlos2_localedir + sl, LOCALEDIR, strlen (LOCALEDIR) + 1);
99
91
        }
100
92
      else
101
 
        _os2_localedir = LOCALEDIR;
 
93
        _nlos2_localedir = LOCALEDIR;
102
94
    }
103
95
 
104
 
  {
105
 
    extern const char _nl_default_dirname__[];
106
 
    if (strlen (_os2_localedir) <= LOCALEDIR_MAX)
107
 
      strcpy (_nl_default_dirname__, _os2_localedir);
108
 
  }
 
96
  if (strlen (_nlos2_localedir) <= MAXPATHLEN)
 
97
    strcpy (libintl_nl_default_dirname, _nlos2_localedir);
109
98
}