+2005-02-07 Matthias Clasen <mclasen@redhat.com>
+
+ * glib/glib.symbols:
+ * glib/gutils.h:
+ * glib/gutils.c (g_listenv): New function to list all
+ environment variables. (#166327, Hans Petter Jansson)
+
2005-02-07 Tor Lillqvist <tml@novell.com>
* glib-zip.in: Add gmodule-no-export-2.0.pc.
+2005-02-07 Matthias Clasen <mclasen@redhat.com>
+
+ * glib/glib.symbols:
+ * glib/gutils.h:
+ * glib/gutils.c (g_listenv): New function to list all
+ environment variables. (#166327, Hans Petter Jansson)
+
2005-02-07 Tor Lillqvist <tml@novell.com>
* glib-zip.in: Add gmodule-no-export-2.0.pc.
+2005-02-07 Matthias Clasen <mclasen@redhat.com>
+
+ * glib/glib.symbols:
+ * glib/gutils.h:
+ * glib/gutils.c (g_listenv): New function to list all
+ environment variables. (#166327, Hans Petter Jansson)
+
2005-02-07 Tor Lillqvist <tml@novell.com>
* glib-zip.in: Add gmodule-no-export-2.0.pc.
+2005-02-07 Matthias Clasen <mclasen@redhat.com>
+
+ * glib/glib.symbols:
+ * glib/gutils.h:
+ * glib/gutils.c (g_listenv): New function to list all
+ environment variables. (#166327, Hans Petter Jansson)
+
2005-02-07 Tor Lillqvist <tml@novell.com>
* glib-zip.in: Add gmodule-no-export-2.0.pc.
+2005-02-07 Matthias Clasen <mclasen@redhat.com>
+
+ * glib/glib-sections.txt: Add g_listenv.
+
2005-02-04 Matthias Clasen <mclasen@redhat.com>
* glib/tmpl/linked_lists_double.sgml:
g_getenv
g_setenv
g_unsetenv
+g_listenv
g_get_user_name
g_get_real_name
g_get_user_cache_dir
g_key_file_set_value
g_key_file_to_data G_GNUC_MALLOC
glib_check_version
+g_listenv
g_list_alloc
g_list_append
g_list_concat
}
#ifndef G_OS_WIN32
-#ifndef HAVE_UNSETENV
+
/* According to the Single Unix Specification, environ is not in
* any system header, although unistd.h often declares it.
*/
extern char **environ;
-#endif
+
#endif
/**
#endif /* G_OS_WIN32 */
}
+/**
+ * g_listenv:
+ *
+ * Gets the names of all variables set in the environment.
+ *
+ * Return: a NUL-terminated list of strings which must be freed
+ * with g_strfreev().
+ *
+ * Since: 2.8
+ */
+gchar **
+g_listenv (void)
+{
+ gchar **result, *eq;
+ gint len, i;
+
+ len = g_strv_length (environ);
+ result = g_new0 (gchar *, len + 1);
+
+ for (i = 0; i < len; i++)
+ {
+ eq = strchr (environ[i], '=');
+ result[i] = g_strndup (environ[i], eq - environ[i]);
+ }
+
+ result[len] = NULL;
+
+ return result;
+}
+
G_LOCK_DEFINE_STATIC (g_utils_global);
static gchar *g_tmp_dir = NULL;
const gchar *value,
gboolean overwrite);
void g_unsetenv (const gchar *variable);
-
+gchar** g_listenv (void);
/* we try to provide a usefull equivalent for ATEXIT if it is
* not defined, but use is actually abandoned. people should