[vte/vte-next: 13/114] Remove deprecated vte_terminal_fork_command



commit c8bf7db220b9621be2017e96e4213d83e7f56330
Author: Christian Persch <chpe gnome org>
Date:   Mon May 2 21:12:44 2011 +0200

    Remove deprecated vte_terminal_fork_command

 doc/reference/vte-sections.txt |    1 -
 src/pty.c                      |   67 ----------------------
 src/reflect.c                  |   20 ++++---
 src/vte.c                      |  121 ----------------------------------------
 src/vtedeprecated.h            |    6 --
 src/vtepty-private.h           |    8 ---
 6 files changed, 12 insertions(+), 211 deletions(-)
---
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
index d1ebb65..97c16bc 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -99,7 +99,6 @@ vte_terminal_search_set_wrap_around
 vte_get_user_shell
 
 <SUBSECTION>
-vte_terminal_fork_command
 vte_terminal_fork_command_full
 vte_terminal_get_pty
 vte_terminal_get_pty_object
diff --git a/src/pty.c b/src/pty.c
index 32fae3f..1f77a35 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -347,45 +347,6 @@ vte_pty_child_setup (VtePty *pty)
  */
 
 /*
- * __vte_pty_get_argv:
- * @command: the command to run
- * @argv: the argument vector
- * @flags: (inout) flags from #GSpawnFlags
- *
- * Creates an argument vector to pass to g_spawn_async() from @command and
- * @argv, modifying * flags if necessary.
- *
- * Returns: a newly allocated array of strings. Free with g_strfreev()
- */
-char **
-__vte_pty_get_argv (const char *command,
-                    char **argv,
-                    GSpawnFlags *flags /* inout */)
-{
-	char **argv2;
-	int i, argc;
-
-        g_return_val_if_fail(command != NULL, NULL);
-
-	/* push the command into argv[0] */
-	argc = argv ? g_strv_length (argv) : 0;
-	argv2 = g_new (char *, argc + 2);
-
-	argv2[0] = g_strdup (command);
-
-	for (i = 0; i < argc; i++) {
-		argv2[i+1] = g_strdup (argv[i]);
-	}
-	argv2[i+1] = NULL;
-
-        if (argv) {
-                *flags |= G_SPAWN_FILE_AND_ARGV_ZERO;
-        }
-
-	return argv2;
-}
-
-/*
  * __vte_pty_merge_environ:
  * @envp: environment vector
  *
@@ -441,34 +402,6 @@ __vte_pty_merge_environ (char **envp, const char *term_value)
 }
 
 /*
- * __vte_pty_get_pty_flags:
- * @lastlog: %TRUE if the session should be logged to the lastlog
- * @utmp: %TRUE if the session should be logged to the utmp/utmpx log
- * @wtmp: %TRUE if the session should be logged to the wtmp/wtmpx log
- *
- * Combines the @lastlog, @utmp, @wtmp arguments into the coresponding
- * #VtePtyFlags flags.
- *
- * Returns: flags from #VtePtyFlags
- */
-VtePtyFlags
-__vte_pty_get_pty_flags(gboolean lastlog,
-                        gboolean utmp,
-                        gboolean wtmp)
-{
-        VtePtyFlags flags = VTE_PTY_DEFAULT;
-
-        if (!lastlog)
-                flags |= VTE_PTY_NO_LASTLOG;
-        if (!utmp)
-                flags |= VTE_PTY_NO_UTMP;
-        if (!wtmp)
-                flags |= VTE_PTY_NO_WTMP;
-
-        return flags;
-}
-
-/*
  * __vte_pty_spawn:
  * @pty: a #VtePty
  * @directory: the name of a directory the command should start in, or %NULL
diff --git a/src/reflect.c b/src/reflect.c
index 6d43649..71d9598 100644
--- a/src/reflect.c
+++ b/src/reflect.c
@@ -71,14 +71,18 @@ terminal_init_vte(GtkWidget **terminal)
 static void
 terminal_shell_vte(GtkWidget *terminal)
 {
-	vte_terminal_fork_command(VTE_TERMINAL(terminal),
-				  getenv("SHELL") ? getenv("SHELL") : "/bin/sh",
-				  NULL,
-				  NULL,
-				  g_get_home_dir() ? g_get_home_dir() : NULL,
-				  FALSE,
-				  FALSE,
-				  FALSE);
+        char *argv[2];
+
+        argv[0] = vte_get_user_shell ();
+        argv[1] = NULL;
+	vte_terminal_fork_command_full(VTE_TERMINAL(terminal),
+                                       VTE_PTY_DEFAULT,
+                                       g_get_home_dir() ? g_get_home_dir() : NULL,
+                                       argv,
+                                       NULL,
+                                       0, NULL, NULL,
+                                       NULL,
+                                       NULL);
 }
 static GtkAdjustment *
 terminal_adjustment_vte(GtkWidget *terminal)
diff --git a/src/vte.c b/src/vte.c
index 525367c..1935c0e 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -3382,127 +3382,6 @@ vte_get_user_shell (void)
         return NULL;
 }
 
-static char *
-_vte_terminal_get_user_shell_with_fallback (void)
-{
-        char *command;
-        const gchar *env;
-
-        if ((command = vte_get_user_shell ()))
-                return command;
-
-        if ((env = g_getenv ("SHELL")))
-                return g_strdup (env);
-
-        return g_strdup ("/bin/sh");
-}
-
-/*
- * _vte_terminal_get_argv:
- * @command: the command to run
- * @argv: the argument vector
- * @flags: (inout) flags from #GSpawnFlags
- *
- * Creates an argument vector to pass to g_spawn_async() from @command and
- * @argv, modifying * flags if necessary.
- * Like __vte_pty_get_argv(), but returns the argument vector to spawn
- * the user's shell if @command is %NULL.
- *
- * Returns: a newly allocated array of strings. Free with g_strfreev()
- */
-static char **
-_vte_terminal_get_argv (const char *command,
-                        char **argv,
-                        GSpawnFlags *flags /* inout */)
-{
-	char **argv2;
-        char *shell = NULL;
-
-        argv2 = __vte_pty_get_argv(command ? command : (shell = _vte_terminal_get_user_shell_with_fallback ()),
-                                   argv,
-                                   flags);
-        g_free(shell);
-        return argv2;
-}
-
-/**
- * vte_terminal_fork_command:
- * @terminal: a #VteTerminal
- * @command: (allow-none) (type filename): the name of a binary to run, or %NULL to spawn the user's shell
- * @argv: (allow-none) (array zero-terminated=1) (element-type filename): the argument list to be passed to @command, or %NULL
- * @envv: (allow-none) (array zero-terminated=1) (element-type filename): a list of environment variables to be added to the environment before
- *   starting @command, or %NULL
- * @working_directory: (allow-none) (type filename): the name of a directory the command should start in, or %NULL
- * @lastlog: %TRUE if the session should be logged to the lastlog
- * @utmp: %TRUE if the session should be logged to the utmp/utmpx log
- * @wtmp: %TRUE if the session should be logged to the wtmp/wtmpx log
- *
- * Starts the specified command under a newly-allocated controlling
- * pseudo-terminal.  The @argv and @envv lists should be %NULL-terminated, and
- * argv[0] is expected to be the name of the file being run, as it would be if
- * execve() were being called.  TERM is automatically set to reflect the
- * terminal widget's emulation setting.  If @lastlog, @utmp, or @wtmp are %TRUE,
- * logs the session to the specified system log files.
- *
- * Note that all file descriptors except stdin/stdout/stderr will be closed
- * before calling exec() in the child.
- *
- * Returns: the PID of the new process, or <literal>-1</literal> on failure
- *
- * Deprecated: 0.26: Use vte_terminal_fork_command_full()
- */
-pid_t
-vte_terminal_fork_command(VteTerminal *terminal,
-			  const char *command,
-                          char **argv,
-                          char **envv,
-			  const char *working_directory,
-			  gboolean lastlog,
-                          gboolean utmp,
-                          gboolean wtmp)
-{
-        char **real_argv;
-        GSpawnFlags spawn_flags;
-        GPid child_pid;
-        gboolean ret;
-#ifdef VTE_DEBUG
-        GError *error = NULL;
-        GError **err = &error;
-#else
-        GError **err = NULL;
-#endif
-
-        g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
-
-        spawn_flags = G_SPAWN_CHILD_INHERITS_STDIN |
-                      G_SPAWN_SEARCH_PATH;
-        real_argv = _vte_terminal_get_argv (command, argv, &spawn_flags);
-
-        ret = vte_terminal_fork_command_full(terminal,
-                                             __vte_pty_get_pty_flags(lastlog, utmp, wtmp),
-                                             working_directory,
-                                             real_argv,
-                                             envv,
-                                             spawn_flags,
-                                             NULL, NULL,
-                                             &child_pid,
-                                             err);
-        g_strfreev (real_argv);
-
-#ifdef VTE_DEBUG
-        if (error) {
-                _vte_debug_print(VTE_DEBUG_MISC,
-                                "vte_terminal_fork_command failed: %s\n", error->message);
-                g_error_free(error);
-        }
-#endif
-
-        if (!ret)
-                return -1;
-
-        return (pid_t) child_pid;
-}
-
 /**
  * vte_terminal_fork_command_full:
  * @terminal: a #VteTerminal
diff --git a/src/vtedeprecated.h b/src/vtedeprecated.h
index f2a1f00..be0feb5 100644
--- a/src/vtedeprecated.h
+++ b/src/vtedeprecated.h
@@ -75,12 +75,6 @@ void vte_terminal_set_font_full(VteTerminal *terminal,
 void vte_terminal_set_font_from_string_full(VteTerminal *terminal,
 					    const char *name,
 					    VteTerminalAntiAlias antialias) G_GNUC_DEPRECATED;
-pid_t vte_terminal_fork_command(VteTerminal *terminal,
-				const char *command, char **argv,
-				char **envv, const char *working_directory,
-				gboolean lastlog,
-				gboolean utmp,
-				gboolean wtmp) G_GNUC_DEPRECATED;
 void vte_terminal_set_pty(VteTerminal *terminal, int pty_master);
 int vte_terminal_get_pty(VteTerminal *terminal);
 
diff --git a/src/vtepty-private.h b/src/vtepty-private.h
index 4c2f210..ce13ed1 100644
--- a/src/vtepty-private.h
+++ b/src/vtepty-private.h
@@ -18,14 +18,6 @@
 
 G_BEGIN_DECLS
 
-VtePtyFlags __vte_pty_get_pty_flags(gboolean lastlog,
-                                    gboolean utmp,
-                                    gboolean wtmp);
-
-char **__vte_pty_get_argv (const char *command,
-                           char **argv,
-                           GSpawnFlags *flags /* inout */);
-
 gboolean __vte_pty_spawn (VtePty *pty,
                           const char *working_directory,
                           char **argv,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]