[vte] widget: Remove deprecated vte_terminal_forkpty



commit d81edfe310786e322126fa4351c8542bfa5c7bac
Author: Christian Persch <chpe gnome org>
Date:   Mon May 2 21:09:23 2011 +0200

    widget: Remove deprecated vte_terminal_forkpty
    
    Conflicts:
        src/vteapp.c

 doc/reference/vte-sections.txt |    1 -
 src/pty.c                      |   42 ----------------------------
 src/vte.c                      |   60 ----------------------------------------
 src/vteapp.c                   |   30 ++++++++++++-------
 src/vtedeprecated.h            |    5 ---
 src/vtepty-private.h           |    4 --
 6 files changed, 19 insertions(+), 123 deletions(-)
---
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
index b7a8803..0567b33 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -97,7 +97,6 @@ vte_get_user_shell
 <SUBSECTION>
 vte_terminal_fork_command
 vte_terminal_fork_command_full
-vte_terminal_forkpty
 vte_terminal_get_pty
 vte_terminal_get_pty_object
 vte_terminal_pty_new
diff --git a/src/pty.c b/src/pty.c
index 6da4f58..cb95190 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -611,48 +611,6 @@ __vte_pty_spawn (VtePty *pty,
         return FALSE;
 }
 
-/*
- * __vte_pty_fork:
- * @pty: a #VtePty
- * @pid: (out) a location to store a #GPid, or %NULL
- * @error: a location to store a #GError, or %NULL
- *
- * Forks and calls vte_pty_child_setup() in the child.
- *
- * Returns: %TRUE on success, or %FALSE on failure with @error filled in
- */
-gboolean
-__vte_pty_fork(VtePty *pty,
-               GPid *pid,
-               GError **error)
-{
-#ifdef HAVE_FORK
-        gboolean ret = TRUE;
-
-        *pid = fork();
-        switch (*pid) {
-                case -1:
-                        g_set_error(error,
-                                    G_SPAWN_ERROR,
-                                    G_SPAWN_ERROR_FAILED,
-                                    "Unable to fork: %s",
-                                    g_strerror(errno));
-                        ret = FALSE;
-                case 0: /* child */
-                        vte_pty_child_setup(pty);
-                        break;
-                default: /* parent */
-                        break;
-        }
-
-       return ret;
-#else /* !HAVE_FORK */
-        g_set_error_literal(error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED,
-                            "No fork implementation");
-        return FALSE;
-#endif /* HAVE_FORK */
-}
-
 /**
  * vte_pty_set_size:
  * @pty: a #VtePty
diff --git a/src/vte.c b/src/vte.c
index 4d09f51..c302fea 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -3653,66 +3653,6 @@ vte_terminal_fork_command_full(VteTerminal *terminal,
         return TRUE;
 }
 
-/**
- * vte_terminal_forkpty:
- * @terminal: a #VteTerminal
- * @envv: a list of environment variables to be added to the environment before
- * starting returning in the child process, or %NULL
- * @working_directory: the name of a directory the child process should change to, 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 a new child process under a newly-allocated controlling
- * pseudo-terminal.  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
- * in the child.
- *
- * Note that @envv and @working_directory are silently ignored.
- *
- * Returns: the ID of the new process in the parent, 0 in the child, and -1 if
- * there was an error
- *
- * Since: 0.11.11
- *
- * Deprecated: 0.26: Use #VtePty and fork() instead
- */
-pid_t
-vte_terminal_forkpty(VteTerminal *terminal,
-                    char **envv, const char *working_directory,
-                    gboolean lastlog, gboolean utmp, gboolean wtmp)
-{
-#ifdef HAVE_FORK
-        VtePty *pty;
-        GPid pid;
-
-        g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
-
-        pty = vte_pty_new(__vte_pty_get_pty_flags(lastlog, utmp, wtmp), NULL);
-        if (pty == NULL)
-                return FALSE;
-
-        if (!__vte_pty_fork(pty,
-                            &pid,
-                            NULL)) {
-                g_object_unref(pty);
-                return FALSE;
-        }
-
-        vte_terminal_set_pty_object(terminal, pty);
-        // FIXMEchpe is that really right?
-        vte_terminal_watch_child(terminal, pid);
-
-        return pid;
-#else
-        return -1;
-#endif
-}
-
 /* Handle an EOF from the client. */
 static void
 vte_terminal_eof(GIOChannel *channel, VteTerminal *terminal)
diff --git a/src/vteapp.c b/src/vteapp.c
index 5a654a6..482b3dd 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -1025,28 +1025,32 @@ main(int argc, char **argv)
                        }
        #endif
                } else {
-                       long i;
-                        G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-                       i = vte_terminal_forkpty(terminal,
-                                                env_add, working_directory,
-                                                TRUE, TRUE, TRUE);
-                        G_GNUC_END_IGNORE_DEPRECATIONS;
-                       switch (i) {
+                        #ifdef HAVE_FORK
+                        VtePty *pty;
+                       pid_t pid;
+                        int i;
+
+                        pty = vte_pty_new(VTE_PTY_DEFAULT, NULL);
+                       pid = fork();
+                       switch (pid) {
                        case -1:
+                                g_object_unref(pty);
                                /* abnormal */
                                g_warning("Error in vte_terminal_forkpty(): %s",
                                          strerror(errno));
                                break;
                        case 0:
                                /* child */
+                                vte_pty_child_setup(pty);
+
                                for (i = 0; ; i++) {
                                        switch (i % 3) {
                                        case 0:
                                        case 1:
-                                               g_print("%ld\n", i);
+                                               g_print("%d\n", i);
                                                break;
                                        case 2:
-                                               g_printerr("%ld\n", i);
+                                               g_printerr("%d\n", i);
                                                break;
                                        }
                                        sleep(1);
@@ -1054,11 +1058,15 @@ main(int argc, char **argv)
                                _exit(0);
                                break;
                        default:
-                               g_print("Child PID is %ld (mine is %ld).\n",
-                                       (long) i, (long) getpid());
+                                vte_terminal_set_pty_object(terminal, pty);
+                                g_object_unref(pty);
+                                vte_terminal_watch_child(terminal, pid);
+                               g_print("Child PID is %d (mine is %d).\n",
+                                       (int) pid, (int) getpid());
                                /* normal */
                                break;
                        }
+                        #endif /* HAVE_FORK */
                }
        }
 
diff --git a/src/vtedeprecated.h b/src/vtedeprecated.h
index 3e57a10..757ffbc 100644
--- a/src/vtedeprecated.h
+++ b/src/vtedeprecated.h
@@ -81,11 +81,6 @@ pid_t vte_terminal_fork_command(VteTerminal *terminal,
                                gboolean lastlog,
                                gboolean utmp,
                                gboolean wtmp) G_GNUC_DEPRECATED;
-pid_t vte_terminal_forkpty(VteTerminal *terminal,
-                          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 ca986ad..5d74b05 100644
--- a/src/vtepty-private.h
+++ b/src/vtepty-private.h
@@ -36,8 +36,4 @@ gboolean __vte_pty_spawn (VtePty *pty,
                           GPid *child_pid /* out */,
                           GError **error);
 
-gboolean __vte_pty_fork(VtePty *pty,
-                        GPid *pid,
-                        GError **error);
-
 G_END_DECLS


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