Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

os2compat.c

00001 /* OS/2 compatibility functions.
00002    Copyright (C) 2001-2002 Free Software Foundation, Inc.
00003 
00004    This program is free software; you can redistribute it and/or modify it
00005    under the terms of the GNU Library General Public License as published
00006    by the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public
00015    License along with this program; if not, write to the Free Software
00016    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00017    USA.  */
00018 
00019 #define OS2_AWARE
00020 #ifdef HAVE_CONFIG_H
00021 #include <config.h>
00022 #endif
00023 
00024 #include <stdlib.h>
00025 #include <string.h>
00026 #include <sys/param.h>
00027 
00028 /* A version of getenv() that works from DLLs */
00029 extern unsigned long DosScanEnv (const unsigned char *pszName, unsigned char **ppszValue);
00030 
00031 char *
00032 _nl_getenv (const char *name)
00033 {
00034   unsigned char *value;
00035   if (DosScanEnv (name, &value))
00036     return NULL;
00037   else
00038     return value;
00039 }
00040 
00041 /* A fixed size buffer.  */
00042 char libintl_nl_default_dirname[MAXPATHLEN+1];
00043 
00044 char *_nlos2_libdir = NULL;
00045 char *_nlos2_localealiaspath = NULL;
00046 char *_nlos2_localedir = NULL;
00047 
00048 static __attribute__((constructor)) void
00049 nlos2_initialize ()
00050 {
00051   char *root = getenv ("UNIXROOT");
00052   char *gnulocaledir = getenv ("GNULOCALEDIR");
00053 
00054   _nlos2_libdir = gnulocaledir;
00055   if (!_nlos2_libdir)
00056     {
00057       if (root)
00058         {
00059           size_t sl = strlen (root);
00060           _nlos2_libdir = (char *) malloc (sl + strlen (LIBDIR) + 1);
00061           memcpy (_nlos2_libdir, root, sl);
00062           memcpy (_nlos2_libdir + sl, LIBDIR, strlen (LIBDIR) + 1);
00063         }
00064       else
00065         _nlos2_libdir = LIBDIR;
00066     }
00067 
00068   _nlos2_localealiaspath = gnulocaledir;
00069   if (!_nlos2_localealiaspath)
00070     {
00071       if (root)
00072         {
00073           size_t sl = strlen (root);
00074           _nlos2_localealiaspath = (char *) malloc (sl + strlen (LOCALE_ALIAS_PATH) + 1);
00075           memcpy (_nlos2_localealiaspath, root, sl);
00076           memcpy (_nlos2_localealiaspath + sl, LOCALE_ALIAS_PATH, strlen (LOCALE_ALIAS_PATH) + 1);
00077         }
00078      else
00079         _nlos2_localealiaspath = LOCALE_ALIAS_PATH;
00080     }
00081 
00082   _nlos2_localedir = gnulocaledir;
00083   if (!_nlos2_localedir)
00084     {
00085       if (root)
00086         {
00087           size_t sl = strlen (root);
00088           _nlos2_localedir = (char *) malloc (sl + strlen (LOCALEDIR) + 1);
00089           memcpy (_nlos2_localedir, root, sl);
00090           memcpy (_nlos2_localedir + sl, LOCALEDIR, strlen (LOCALEDIR) + 1);
00091         }
00092       else
00093         _nlos2_localedir = LOCALEDIR;
00094     }
00095 
00096   if (strlen (_nlos2_localedir) <= MAXPATHLEN)
00097     strcpy (libintl_nl_default_dirname, _nlos2_localedir);
00098 }

Generated on Tue Dec 20 10:14:20 2005 for vlc-0.8.4a by  doxygen 1.4.2