annotate intl/os2compat.c @ 1341:981ffc1cc402 trunk

[svn] - properly cast the GDK_WINDOW()
author nenolod
date Wed, 28 Jun 2006 01:31:31 -0700
parents cb178e5ad177
children f12d7e208b43
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 /* OS/2 compatibility functions.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 Copyright (C) 2001-2002 Free Software Foundation, Inc.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify it
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 under the terms of the GNU Library General Public License as published
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 by the Free Software Foundation; either version 2, or (at your option)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 any later version.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 Library General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 You should have received a copy of the GNU Library General Public
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 License along with this program; if not, write to the Free Software
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 USA. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 #define OS2_AWARE
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 #ifdef HAVE_CONFIG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21 #include <config.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #include <stdlib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25 #include <string.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 #include <sys/param.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 /* A version of getenv() that works from DLLs */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 extern unsigned long DosScanEnv (const unsigned char *pszName, unsigned char **ppszValue);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 char *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 _nl_getenv (const char *name)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 unsigned char *value;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35 if (DosScanEnv (name, &value))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38 return value;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41 /* A fixed size buffer. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42 char libintl_nl_default_dirname[MAXPATHLEN+1];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 char *_nlos2_libdir = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45 char *_nlos2_localealiaspath = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 char *_nlos2_localedir = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48 static __attribute__((constructor)) void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 nlos2_initialize ()
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 char *root = getenv ("UNIXROOT");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 char *gnulocaledir = getenv ("GNULOCALEDIR");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 _nlos2_libdir = gnulocaledir;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 if (!_nlos2_libdir)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 if (root)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 size_t sl = strlen (root);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 _nlos2_libdir = (char *) malloc (sl + strlen (LIBDIR) + 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 memcpy (_nlos2_libdir, root, sl);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 memcpy (_nlos2_libdir + sl, LIBDIR, strlen (LIBDIR) + 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 _nlos2_libdir = LIBDIR;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 _nlos2_localealiaspath = gnulocaledir;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 if (!_nlos2_localealiaspath)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 if (root)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73 size_t sl = strlen (root);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 _nlos2_localealiaspath = (char *) malloc (sl + strlen (LOCALE_ALIAS_PATH) + 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 memcpy (_nlos2_localealiaspath, root, sl);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 memcpy (_nlos2_localealiaspath + sl, LOCALE_ALIAS_PATH, strlen (LOCALE_ALIAS_PATH) + 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79 _nlos2_localealiaspath = LOCALE_ALIAS_PATH;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 _nlos2_localedir = gnulocaledir;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 if (!_nlos2_localedir)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 if (root)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87 size_t sl = strlen (root);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88 _nlos2_localedir = (char *) malloc (sl + strlen (LOCALEDIR) + 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89 memcpy (_nlos2_localedir, root, sl);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 memcpy (_nlos2_localedir + sl, LOCALEDIR, strlen (LOCALEDIR) + 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93 _nlos2_localedir = LOCALEDIR;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 if (strlen (_nlos2_localedir) <= MAXPATHLEN)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 strcpy (libintl_nl_default_dirname, _nlos2_localedir);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 }