Commit 9ba542ab authored by Christian Persch's avatar Christian Persch

widget: Remove deprecated vte_terminal_fork_command

parent d81edfe3
......@@ -95,7 +95,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
......
......@@ -370,45 +370,6 @@ vte_pty_child_setup (VtePty *pty)
* - replace current env rather than adding!
*/
/*
* __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
......@@ -472,34 +433,6 @@ __vte_pty_merge_environ (char **envp,
return (gchar **) g_ptr_array_free (array, FALSE);
}
/*
* __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
......
......@@ -67,14 +67,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",
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,
g_get_home_dir() ? g_get_home_dir() : NULL,
FALSE,
FALSE,
FALSE);
NULL);
}
static GtkAdjustment *
terminal_adjustment_vte(GtkWidget *terminal)
......
......@@ -3450,127 +3450,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
......
......@@ -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);
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment