[vte/vte-next: 12/47] Remove deprecated vte_terminal_forkpty



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

    Remove deprecated vte_terminal_forkpty

 doc/reference/vte-sections.txt |    1 -
 src/pty.c                      |   42 ----------------------------
 src/vte.c                      |   60 ----------------------------------------
 src/vteapp.c                   |   28 ++++++++++++------
 src/vtedeprecated.h            |    5 ---
 src/vtepty-private.h           |    4 --
 6 files changed, 19 insertions(+), 121 deletions(-)
---
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
index 226bd67..d1ebb65 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -101,7 +101,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 30405b0..32fae3f 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -569,48 +569,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 cb8ecc8..50b3c00 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -3587,66 +3587,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 c6ab68a..8f893cf 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -1027,26 +1027,32 @@ main(int argc, char **argv)
 			}
 	#endif
 		} else {
-			long i;
-			i = vte_terminal_forkpty(terminal,
-						 env_add, working_directory,
-						 TRUE, TRUE, TRUE);
-			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 +1060,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 6577d3a..f2a1f00 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 70347ee..4c2f210 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]