1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1998 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GLib Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GLib at ftp://ftp.gtk.org/pub/gtk/.
28 * MT safe for the unix part, FIXME: make the win32 part MT safe as well.
44 #include <sys/types.h>
45 #ifdef HAVE_SYS_PARAM_H
46 #include <sys/param.h>
49 /* implement gutils's inline functions
51 #define G_IMPLEMENT_INLINES 1
54 #include "gprintfint.h"
57 #define G_PATH_LENGTH MAXPATHLEN
58 #elif defined (PATH_MAX)
59 #define G_PATH_LENGTH PATH_MAX
60 #elif defined (_PC_PATH_MAX)
61 #define G_PATH_LENGTH sysconf(_PC_PATH_MAX)
63 #define G_PATH_LENGTH 2048
66 #ifdef G_PLATFORM_WIN32
67 # define STRICT /* Strict typing, please */
70 # include <lmcons.h> /* For UNLEN */
72 #endif /* G_PLATFORM_WIN32 */
82 #ifdef HAVE_BIND_TEXTDOMAIN_CODESET
86 const guint glib_major_version = GLIB_MAJOR_VERSION;
87 const guint glib_minor_version = GLIB_MINOR_VERSION;
88 const guint glib_micro_version = GLIB_MICRO_VERSION;
89 const guint glib_interface_age = GLIB_INTERFACE_AGE;
90 const guint glib_binary_age = GLIB_BINARY_AGE;
92 #if !defined (HAVE_MEMMOVE) && !defined (HAVE_WORKING_BCOPY)
94 g_memmove (gpointer dest, gconstpointer src, gulong len)
96 gchar* destptr = dest;
97 const gchar* srcptr = src;
98 if (src + len < dest || dest + len < src)
100 bcopy (src, dest, len);
103 else if (dest <= src)
106 *(destptr++) = *(srcptr++);
113 *(--destptr) = *(--srcptr);
116 #endif /* !HAVE_MEMMOVE && !HAVE_WORKING_BCOPY */
119 g_atexit (GVoidFunc func)
122 const gchar *error = NULL;
124 /* keep this in sync with glib.h */
126 #ifdef G_NATIVE_ATEXIT
127 result = ATEXIT (func);
129 error = g_strerror (errno);
130 #elif defined (HAVE_ATEXIT)
131 # ifdef NeXT /* @#%@! NeXTStep */
132 result = !atexit ((void (*)(void)) func);
134 error = g_strerror (errno);
136 result = atexit ((void (*)(void)) func);
138 error = g_strerror (errno);
140 #elif defined (HAVE_ON_EXIT)
141 result = on_exit ((void (*)(int, void *)) func, NULL);
143 error = g_strerror (errno);
146 error = "no implementation";
147 #endif /* G_NATIVE_ATEXIT */
150 g_error ("Could not register atexit() function: %s", error);
153 /* Based on execvp() from GNU Libc.
154 * Some of this code is cut-and-pasted into gspawn.c
158 my_strchrnul (const gchar *str, gchar c)
160 gchar *p = (gchar*)str;
161 while (*p && (*p != c))
169 gchar *inner_find_program_in_path (const gchar *program);
172 g_find_program_in_path (const gchar *program)
174 const gchar *last_dot = strrchr (program, '.');
176 if (last_dot == NULL || strchr (last_dot, '\\') != NULL)
178 const gint program_length = strlen (program);
179 const gchar *pathext = getenv ("PATHEXT");
181 gchar *decorated_program;
185 pathext = ".com;.exe;.bat";
191 p = my_strchrnul (pathext, ';');
193 decorated_program = g_malloc (program_length + (p-pathext) + 1);
194 memcpy (decorated_program, program, program_length);
195 memcpy (decorated_program+program_length, pathext, p-pathext);
196 decorated_program [program_length + (p-pathext)] = '\0';
198 retval = inner_find_program_in_path (decorated_program);
199 g_free (decorated_program);
203 } while (*p++ != '\0');
207 return inner_find_program_in_path (program);
210 #define g_find_program_in_path inner_find_program_in_path
214 * g_find_program_in_path:
215 * @program: a program name
217 * Locates the first executable named @program in the user's path, in the
218 * same way that execvp() would locate it. Returns an allocated string
219 * with the absolute path name, or NULL if the program is not found in
220 * the path. If @program is already an absolute path, returns a copy of
221 * @program if @program exists and is executable, and NULL otherwise.
223 * On Windows, if @program does not have a file type suffix, tries to
224 * append the suffixes in the PATHEXT environment variable (if that
225 * doesn't exists, the suffixes .com, .exe, and .bat) in turn, and
226 * then look for the resulting file name in the same way as
227 * CreateProcess() would. This means first in the directory where the
228 * program was loaded from, then in the current directory, then in the
229 * Windows 32-bit system directory, then in the Windows directory, and
230 * finally in the directories in the PATH environment variable. If
231 * the program is found, the return value contains the full name
232 * including the type suffix.
234 * Return value: absolute path, or NULL
237 g_find_program_in_path (const gchar *program)
239 const gchar *path, *p;
240 gchar *name, *freeme;
247 g_return_val_if_fail (program != NULL, NULL);
249 /* If it is an absolute path, or a relative path including subdirectories,
250 * don't look in PATH.
252 if (g_path_is_absolute (program)
253 || strchr (program, G_DIR_SEPARATOR) != NULL)
255 if (g_file_test (program, G_FILE_TEST_IS_EXECUTABLE))
256 return g_strdup (program);
261 path = g_getenv ("PATH");
265 /* There is no `PATH' in the environment. The default
266 * search path in GNU libc is the current directory followed by
267 * the path `confstr' returns for `_CS_PATH'.
270 /* In GLib we put . last, for security, and don't use the
271 * unportable confstr(); UNIX98 does not actually specify
272 * what to search if PATH is unset. POSIX may, dunno.
275 path = "/bin:/usr/bin:.";
280 gchar moddir[MAXPATHLEN], sysdir[MAXPATHLEN], windir[MAXPATHLEN];
282 GetModuleFileName (NULL, moddir, sizeof (moddir));
283 tmp = g_path_get_dirname (moddir);
284 GetSystemDirectory (sysdir, sizeof (sysdir));
285 GetWindowsDirectory (windir, sizeof (windir));
286 path_tmp = g_strconcat (tmp, ";.;", sysdir, ";", windir,
287 (path != NULL ? ";" : NULL),
288 (path != NULL ? path : NULL),
295 len = strlen (program) + 1;
296 pathlen = strlen (path);
297 freeme = name = g_malloc (pathlen + len + 1);
299 /* Copy the file name at the top, including '\0' */
300 memcpy (name + pathlen + 1, program, len);
301 name = name + pathlen;
302 /* And add the slash before the filename */
303 *name = G_DIR_SEPARATOR;
311 p = my_strchrnul (path, G_SEARCHPATH_SEPARATOR);
314 /* Two adjacent colons, or a colon at the beginning or the end
315 * of `PATH' means to search the current directory.
319 startp = memcpy (name - (p - path), path, p - path);
321 if (g_file_test (startp, G_FILE_TEST_IS_EXECUTABLE))
324 ret = g_strdup (startp);
332 while (*p++ != '\0');
343 g_parse_debug_string (const gchar *string,
344 const GDebugKey *keys,
350 g_return_val_if_fail (string != NULL, 0);
352 if (!g_ascii_strcasecmp (string, "all"))
354 for (i=0; i<nkeys; i++)
355 result |= keys[i].value;
359 const gchar *p = string;
361 gboolean done = FALSE;
372 for (i=0; i<nkeys; i++)
373 if (g_ascii_strncasecmp(keys[i].key, p, q - p) == 0 &&
374 keys[i].key[q - p] == '\0')
375 result |= keys[i].value;
386 * @file_name: the name of the file.
388 * Gets the name of the file without any leading directory components.
389 * It returns a pointer into the given file name string.
391 * Return value: the name of the file without any leading directory components.
393 * Deprecated: Use g_path_get_basename() instead.
395 G_CONST_RETURN gchar*
396 g_basename (const gchar *file_name)
398 register gchar *base;
400 g_return_val_if_fail (file_name != NULL, NULL);
402 base = strrchr (file_name, G_DIR_SEPARATOR);
407 if (g_ascii_isalpha (file_name[0]) && file_name[1] == ':')
408 return (gchar*) file_name + 2;
409 #endif /* G_OS_WIN32 */
411 return (gchar*) file_name;
415 g_path_get_basename (const gchar *file_name)
417 register gssize base;
418 register gssize last_nonslash;
422 g_return_val_if_fail (file_name != NULL, NULL);
424 if (file_name[0] == '\0')
426 return g_strdup (".");
428 last_nonslash = strlen (file_name) - 1;
430 while (last_nonslash >= 0 && file_name [last_nonslash] == G_DIR_SEPARATOR)
433 if (last_nonslash == -1)
434 /* string only containing slashes */
435 return g_strdup (G_DIR_SEPARATOR_S);
438 if (last_nonslash == 1 && g_ascii_isalpha (file_name[0]) && file_name[1] == ':')
439 /* string only containing slashes and a drive */
440 return g_strdup (G_DIR_SEPARATOR_S);
441 #endif /* G_OS_WIN32 */
443 base = last_nonslash;
445 while (base >=0 && file_name [base] != G_DIR_SEPARATOR)
449 if (base == -1 && g_ascii_isalpha (file_name[0]) && file_name[1] == ':')
451 #endif /* G_OS_WIN32 */
453 len = last_nonslash - base;
454 retval = g_malloc (len + 1);
455 memcpy (retval, file_name + base + 1, len);
461 g_path_is_absolute (const gchar *file_name)
463 g_return_val_if_fail (file_name != NULL, FALSE);
465 if (file_name[0] == G_DIR_SEPARATOR
467 || file_name[0] == '/'
473 /* Recognize drive letter on native Windows */
474 if (g_ascii_isalpha (file_name[0]) && file_name[1] == ':' && (file_name[2] == G_DIR_SEPARATOR || file_name[2] == '/'))
476 #endif /* G_OS_WIN32 */
481 G_CONST_RETURN gchar*
482 g_path_skip_root (const gchar *file_name)
484 g_return_val_if_fail (file_name != NULL, NULL);
486 #ifdef G_PLATFORM_WIN32
487 /* Skip \\server\share (Win32) or //server/share (Cygwin) */
488 if (file_name[0] == G_DIR_SEPARATOR &&
489 file_name[1] == G_DIR_SEPARATOR &&
494 if ((p = strchr (file_name + 2, G_DIR_SEPARATOR)) > file_name + 2 &&
499 while (file_name[0] && file_name[0] != G_DIR_SEPARATOR)
502 /* Possibly skip a backslash after the share name */
503 if (file_name[0] == G_DIR_SEPARATOR)
506 return (gchar *)file_name;
511 /* Skip initial slashes */
512 if (file_name[0] == G_DIR_SEPARATOR)
514 while (file_name[0] == G_DIR_SEPARATOR)
516 return (gchar *)file_name;
521 if (g_ascii_isalpha (file_name[0]) && file_name[1] == ':' && file_name[2] == G_DIR_SEPARATOR)
522 return (gchar *)file_name + 3;
529 g_path_get_dirname (const gchar *file_name)
531 register gchar *base;
534 g_return_val_if_fail (file_name != NULL, NULL);
536 base = strrchr (file_name, G_DIR_SEPARATOR);
538 return g_strdup (".");
539 while (base > file_name && *base == G_DIR_SEPARATOR)
541 len = (guint) 1 + base - file_name;
543 base = g_new (gchar, len + 1);
544 g_memmove (base, file_name, len);
551 g_get_current_dir (void)
553 gchar *buffer = NULL;
555 static gulong max_len = 0;
558 max_len = (G_PATH_LENGTH == -1) ? 2048 : G_PATH_LENGTH;
560 /* We don't use getcwd(3) on SUNOS, because, it does a popen("pwd")
561 * and, if that wasn't bad enough, hangs in doing so.
563 #if (defined (sun) && !defined (__SVR4)) || !defined(HAVE_GETCWD)
564 buffer = g_new (gchar, max_len + 1);
566 dir = getwd (buffer);
567 #else /* !sun || !HAVE_GETCWD */
568 while (max_len < G_MAXULONG / 2)
570 buffer = g_new (gchar, max_len + 1);
572 dir = getcwd (buffer, max_len);
574 if (dir || errno != ERANGE)
580 #endif /* !sun || !HAVE_GETCWD */
582 if (!dir || !*buffer)
584 /* hm, should we g_error() out here?
585 * this can happen if e.g. "./" has mode \0000
587 buffer[0] = G_DIR_SEPARATOR;
591 dir = g_strdup (buffer);
597 G_CONST_RETURN gchar*
598 g_getenv (const gchar *variable)
601 g_return_val_if_fail (variable != NULL, NULL);
603 return getenv (variable);
605 G_LOCK_DEFINE_STATIC (getenv);
611 static GArray *environs = NULL;
616 g_return_val_if_fail (variable != NULL, NULL);
621 environs = g_array_new (FALSE, FALSE, sizeof (struct env_struct));
623 /* First we try to find the envinronment variable inside the already
627 for (i = 0; i < environs->len; i++)
629 env = &g_array_index (environs, struct env_struct, i);
630 if (strcmp (env->key, variable) == 0)
632 g_assert (env->value);
638 /* If not found, we ask the system */
640 system_env = getenv (variable);
647 /* On Windows NT, it is relatively typical that environment variables
648 * contain references to other environment variables. Handle that by
649 * calling ExpandEnvironmentStrings.
652 g_array_set_size (environs, environs->len + 1);
654 env = &g_array_index (environs, struct env_struct, environs->len - 1);
656 /* First check how much space we need */
657 length = ExpandEnvironmentStrings (system_env, dummy, 2);
659 /* Then allocate that much, and actualy do the expansion and insert
660 * the new found pair into our buffer
663 env->value = g_malloc (length);
664 env->key = g_strdup (variable);
666 ExpandEnvironmentStrings (system_env, env->value, length);
674 G_LOCK_DEFINE_STATIC (g_utils_global);
676 static gchar *g_tmp_dir = NULL;
677 static gchar *g_user_name = NULL;
678 static gchar *g_real_name = NULL;
679 static gchar *g_home_dir = NULL;
681 /* HOLDS: g_utils_global_lock */
683 g_get_any_init (void)
687 g_tmp_dir = g_strdup (g_getenv ("TMPDIR"));
689 g_tmp_dir = g_strdup (g_getenv ("TMP"));
691 g_tmp_dir = g_strdup (g_getenv ("TEMP"));
697 g_tmp_dir = g_strdup (P_tmpdir);
698 k = strlen (g_tmp_dir);
699 if (k > 1 && g_tmp_dir[k - 1] == G_DIR_SEPARATOR)
700 g_tmp_dir[k - 1] = '\0';
707 g_tmp_dir = g_strdup ("/tmp");
708 #else /* G_OS_WIN32 */
709 g_tmp_dir = g_strdup ("C:\\");
710 #endif /* G_OS_WIN32 */
714 /* We check $HOME first for Win32, though it is a last resort for Unix
715 * where we prefer the results of getpwuid().
717 g_home_dir = g_strdup (g_getenv ("HOME"));
719 /* In case HOME is Unix-style (it happens), convert it to
725 while ((p = strchr (g_home_dir, '/')) != NULL)
731 /* USERPROFILE is probably the closest equivalent to $HOME? */
732 if (getenv ("USERPROFILE") != NULL)
733 g_home_dir = g_strdup (g_getenv ("USERPROFILE"));
738 /* At least at some time, HOMEDRIVE and HOMEPATH were used
739 * to point to the home directory, I think. But on Windows
740 * 2000 HOMEDRIVE seems to be equal to SYSTEMDRIVE, and
741 * HOMEPATH is its root "\"?
743 if (getenv ("HOMEDRIVE") != NULL && getenv ("HOMEPATH") != NULL)
745 gchar *homedrive, *homepath;
747 homedrive = g_strdup (g_getenv ("HOMEDRIVE"));
748 homepath = g_strdup (g_getenv ("HOMEPATH"));
750 g_home_dir = g_strconcat (homedrive, homepath, NULL);
755 #endif /* G_OS_WIN32 */
759 struct passwd *pw = NULL;
760 gpointer buffer = NULL;
763 # if defined (HAVE_POSIX_GETPWUID_R) || defined (HAVE_NONPOSIX_GETPWUID_R)
765 # ifdef _SC_GETPW_R_SIZE_MAX
766 /* This reurns the maximum length */
767 glong bufsize = sysconf (_SC_GETPW_R_SIZE_MAX);
771 # else /* _SC_GETPW_R_SIZE_MAX */
773 # endif /* _SC_GETPW_R_SIZE_MAX */
778 buffer = g_malloc (bufsize);
781 # ifdef HAVE_POSIX_GETPWUID_R
782 error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
783 error = error < 0 ? errno : error;
784 # else /* HAVE_NONPOSIX_GETPWUID_R */
786 error = getpwuid_r (getuid (), &pwd, buffer, bufsize);
787 pw = error == 0 ? &pwd : NULL;
789 pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
790 error = pw ? 0 : errno;
792 # endif /* HAVE_NONPOSIX_GETPWUID_R */
796 /* we bail out prematurely if the user id can't be found
797 * (should be pretty rare case actually), or if the buffer
798 * should be sufficiently big and lookups are still not
801 if (error == 0 || error == ENOENT)
803 g_warning ("getpwuid_r(): failed due to unknown user id (%lu)",
807 if (bufsize > 32 * 1024)
809 g_warning ("getpwuid_r(): failed due to: %s.",
818 # endif /* HAVE_POSIX_GETPWUID_R || HAVE_NONPOSIX_GETPWUID_R */
823 pw = getpwuid (getuid ());
828 g_user_name = g_strdup (pw->pw_name);
829 g_real_name = g_strdup (pw->pw_gecos);
831 g_home_dir = g_strdup (pw->pw_dir);
836 #else /* !HAVE_PWD_H */
841 gchar buffer[UNLEN+1];
843 if (GetUserName ((LPTSTR) buffer, (LPDWORD) &len))
845 g_user_name = g_strdup (buffer);
846 g_real_name = g_strdup (buffer);
849 # endif /* G_OS_WIN32 */
851 #endif /* !HAVE_PWD_H */
854 g_home_dir = g_strdup (g_getenv ("HOME"));
857 /* change '\\' in %HOME% to '/' */
858 g_strdelimit (g_home_dir, "\\",'/');
861 g_user_name = g_strdup ("somebody");
863 g_real_name = g_strdup ("Unknown");
868 for (p = g_real_name; *p; p++)
872 p = g_strdup (g_real_name);
873 g_free (g_real_name);
881 G_CONST_RETURN gchar*
882 g_get_user_name (void)
884 G_LOCK (g_utils_global);
887 G_UNLOCK (g_utils_global);
892 G_CONST_RETURN gchar*
893 g_get_real_name (void)
895 G_LOCK (g_utils_global);
898 G_UNLOCK (g_utils_global);
903 /* Return the home directory of the user. If there is a HOME
904 * environment variable, its value is returned, otherwise use some
905 * system-dependent way of finding it out. If no home directory can be
906 * deduced, return NULL.
909 G_CONST_RETURN gchar*
910 g_get_home_dir (void)
912 G_LOCK (g_utils_global);
915 G_UNLOCK (g_utils_global);
920 /* Return a directory to be used to store temporary files. This is the
921 * value of the TMPDIR, TMP or TEMP environment variables (they are
922 * checked in that order). If none of those exist, use P_tmpdir from
923 * stdio.h. If that isn't defined, return "/tmp" on POSIXly systems,
924 * and C:\ on Windows.
927 G_CONST_RETURN gchar*
930 G_LOCK (g_utils_global);
933 G_UNLOCK (g_utils_global);
938 G_LOCK_DEFINE (g_prgname);
939 static gchar *g_prgname = NULL;
948 G_UNLOCK (g_prgname);
954 g_set_prgname (const gchar *prgname)
958 g_prgname = g_strdup (prgname);
959 G_UNLOCK (g_prgname);
962 G_LOCK_DEFINE (g_application_name);
963 static gchar *g_application_name = NULL;
966 * g_get_application_name:
968 * Gets a human-readable name for the application, as set by
969 * g_set_application_name(). This name should be localized if
970 * possible, and is intended for display to the user. Contrast with
971 * g_get_prgname(), which gets a non-localized name. If
972 * g_set_application_name() has not been called, returns the result of
973 * g_get_prgname() (which may be %NULL if g_set_prgname() has also not
976 * Return value: human-readable application name. may return %NULL
980 G_CONST_RETURN gchar*
981 g_get_application_name (void)
985 G_LOCK (g_application_name);
986 retval = g_application_name;
987 G_UNLOCK (g_application_name);
990 return g_get_prgname ();
996 * g_set_application_name:
997 * @application_name: localized name of the application
999 * Sets a human-readable name for the application. This name should be
1000 * localized if possible, and is intended for display to the user.
1001 * Contrast with g_set_prgname(), which sets a non-localized name.
1002 * g_set_prgname() will be called automatically by gtk_init(),
1003 * but g_set_application_name() will not.
1005 * Note that for thread safety reasons, this function can only
1008 * The application name will be used in contexts such as error messages,
1009 * or when displaying an application's name in the task list.
1013 g_set_application_name (const gchar *application_name)
1015 gboolean already_set = FALSE;
1017 G_LOCK (g_application_name);
1018 if (g_application_name)
1021 g_application_name = g_strdup (application_name);
1022 G_UNLOCK (g_application_name);
1025 g_warning ("g_set_application() name called multiple times");
1029 g_direct_hash (gconstpointer v)
1031 return GPOINTER_TO_UINT (v);
1035 g_direct_equal (gconstpointer v1,
1042 g_int_equal (gconstpointer v1,
1045 return *((const gint*) v1) == *((const gint*) v2);
1049 g_int_hash (gconstpointer v)
1051 return *(const gint*) v;
1055 * g_nullify_pointer:
1056 * @nullify_location: the memory address of the pointer.
1058 * Set the pointer at the specified location to %NULL.
1061 g_nullify_pointer (gpointer *nullify_location)
1063 g_return_if_fail (nullify_location != NULL);
1065 *nullify_location = NULL;
1071 * Get the codeset for the current locale.
1073 * Return value: a newly allocated string containing the name
1074 * of the codeset. This string must be freed with g_free().
1077 g_get_codeset (void)
1080 char *result = nl_langinfo (CODESET);
1081 return g_strdup (result);
1083 #ifdef G_PLATFORM_WIN32
1084 return g_strdup_printf ("CP%d", GetACP ());
1086 /* FIXME: Do something more intelligent based on setlocale (LC_CTYPE, NULL)
1088 return g_strdup ("ISO-8859-1");
1095 #include <libintl.h>
1097 #ifdef G_PLATFORM_WIN32
1099 G_WIN32_DLLMAIN_FOR_DLL_NAME (static, dll_name)
1101 static const gchar *
1102 _glib_get_locale_dir (void)
1104 static const gchar *cache = NULL;
1106 cache = g_win32_get_package_installation_subdirectory
1107 (GETTEXT_PACKAGE, dll_name, "lib\\locale");
1112 #undef GLIB_LOCALE_DIR
1113 #define GLIB_LOCALE_DIR _glib_get_locale_dir ()
1115 #endif /* G_PLATFORM_WIN32 */
1117 G_CONST_RETURN gchar *
1118 _glib_gettext (const gchar *str)
1120 static gboolean _glib_gettext_initialized = FALSE;
1122 if (!_glib_gettext_initialized)
1124 bindtextdomain(GETTEXT_PACKAGE, GLIB_LOCALE_DIR);
1125 # ifdef HAVE_BIND_TEXTDOMAIN_CODESET
1126 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
1128 _glib_gettext_initialized = TRUE;
1131 return dgettext (GETTEXT_PACKAGE, str);
1134 #endif /* ENABLE_NLS */