? g_get_user_shell.patch
? posixwin32function.patch
Index: glib/gutils.c
===================================================================
RCS file: /cvs/gnome/glib/glib/gutils.c,v
retrieving revision 1.175
diff -u -r1.175 gutils.c
--- glib/gutils.c	30 Jun 2005 19:43:47 -0000	1.175
+++ glib/gutils.c	6 Jul 2005 18:45:40 -0000
@@ -1362,6 +1362,7 @@
 static	gchar	*g_tmp_dir = NULL;
 static	gchar	*g_user_name = NULL;
 static	gchar	*g_real_name = NULL;
+static  gchar   *g_posix_shell = NULL;
 static	gchar	*g_home_dir = NULL;
 static	gchar	*g_host_name = NULL;
 
@@ -1470,6 +1471,9 @@
 	{
 	  g_tmp_dir = g_strdup ("/tmp");
 	}
+	
+	g_posix_shell = g_strdup(g_getenv ("SHELL"));
+	
 #endif	/* !G_OS_WIN32 */
       
 #ifdef G_OS_WIN32
@@ -1511,6 +1515,7 @@
       
       if (!g_home_dir)
 	g_home_dir = get_windows_directory_root ();
+	    
 #endif /* G_OS_WIN32 */
       
 #ifdef HAVE_PWD_H
@@ -1606,6 +1611,9 @@
 
 	    if (!g_home_dir)
 	      g_home_dir = g_strdup (pw->pw_dir);
+		
+		if (!g_posix_shell)
+		  g_posix_shell = g_strdup(pw->pw_shell);
 	  }
 	g_free (buffer);
       }
@@ -1736,6 +1744,29 @@
 }
 
 /**
+ * g_posix_get_shell:
+ *
+ * Gets the preffered shell of the user. Usually the environment setting "SHELL".
+ * If not set it will lookup it up in the <filename>passwd</filename> file.
+ *
+ * Returns: the user's perferred shell or NULL
+ *
+ * Since: 2.8
+ */
+G_CONST_RETURN gchar*
+g_posix_get_shell (void)
+{
+  G_LOCK (g_utils_global);
+  if (!g_tmp_dir)
+    g_get_any_init ();
+  G_UNLOCK (g_utils_global);
+ 
+  return g_posix_shell;
+}
+
+
+
+/**
  * g_get_home_dir:
  *
  * Gets the current user's home directory. 
Index: glib/gutils.h
===================================================================
RCS file: /cvs/gnome/glib/glib/gutils.h,v
retrieving revision 1.36
diff -u -r1.36 gutils.h
--- glib/gutils.h	22 Jun 2005 08:54:28 -0000	1.36
+++ glib/gutils.h	6 Jul 2005 18:45:40 -0000
@@ -115,6 +115,7 @@
 
 G_CONST_RETURN gchar* g_get_user_name        (void);
 G_CONST_RETURN gchar* g_get_real_name        (void);
+G_CONST_RETURN gchar* g_posix_get_shell       (void);
 G_CONST_RETURN gchar* g_get_home_dir         (void);
 G_CONST_RETURN gchar* g_get_tmp_dir          (void);
 G_CONST_RETURN gchar* g_get_host_name	     (void);
Index: glib/gwin32.c
===================================================================
RCS file: /cvs/gnome/glib/glib/gwin32.c,v
retrieving revision 1.52
diff -u -r1.52 gwin32.c
--- glib/gwin32.c	9 Jun 2005 10:46:21 -0000	1.52
+++ glib/gwin32.c	6 Jul 2005 18:45:42 -0000
@@ -614,6 +614,8 @@
 #define SUBLANG_UZBEK_CYRILLIC 0x02
 #endif
 
+static  gchar   *g_win32_get_shell = NULL;
+
 gchar *
 g_win32_getlocale (void)
 {
@@ -1522,5 +1524,33 @@
   return retval;
 }
 
-#define __G_WIN32_C__
+/**
+ * g_win32_get_shell:
+ *
+ * Gets the preffered shell of the user. Usually the environment setting "COMSPEC".
+ * If not set it will look for cmd.exe or command.com.
+ *
+ * Returns: the user's perferred shell or NULL
+ *
+ * Since: 2.8
+ */
+gchar *
+g_win32_get_shell (void)
+{
+	static gboolean beenhere = FALSE;
+		
+	if (!beenhere)
+	{
+		g_win32_shell = g_strdup(g_getenv ("COMSPEC"));
+	
+		if (!g_user_shell)
+			g_user_shell = g_find_program_in_path ("cmd.exe");
+
+		if (!g_user_shell)
+			g_user_shell = g_find_program_in_path ("command.com");
+    }
+	
+  return g_win32_shell;
+}
+
 #include "galiasdef.c"
Index: glib/gwin32.h
===================================================================
RCS file: /cvs/gnome/glib/glib/gwin32.h,v
retrieving revision 1.15
diff -u -r1.15 gwin32.h
--- glib/gwin32.h	27 Apr 2005 09:50:09 -0000	1.15
+++ glib/gwin32.h	6 Jul 2005 18:45:42 -0000
@@ -93,6 +93,8 @@
 
 gchar*          g_win32_locale_filename_from_utf8 (const gchar *utf8filename);
 
+gchar*  g_win32_get_shell(void);
+
 #define G_WIN32_IS_NT_BASED() (g_win32_get_windows_version () < 0x80000000)
 #define G_WIN32_HAVE_WIDECHAR_API() (G_WIN32_IS_NT_BASED ())
 
