diff options
author | Nalin Dahyabhai <nalin@src.gnome.org> | 2002-06-14 19:26:41 +0000 |
---|---|---|
committer | Nalin Dahyabhai <nalin@src.gnome.org> | 2002-06-14 19:26:41 +0000 |
commit | 72df40d75cf96445a573fd20973b1fd81f83b2fd (patch) | |
tree | 92f336d20838379b3cdeae2fc294ebaf545b97bb /python/vte.override | |
parent | 7c97366c65ce0378b601addbbe8bb9cb246f5300 (diff) |
Add a parameter for passing in environment variables to add. Preprocess
* src/vte.c, src/vte.h (vte_terminal_fork_command): Add a parameter for passing
in environment variables to add.
* src/termcap.c: Preprocess out unused comment() and generate() funcs.
* src/Makefile.am: Bump library version number.
* vte.spec: 0.4.0
Diffstat (limited to 'python/vte.override')
-rw-r--r-- | python/vte.override | 84 |
1 files changed, 53 insertions, 31 deletions
diff --git a/python/vte.override b/python/vte.override index d6f6a80..a2fda97 100644 --- a/python/vte.override +++ b/python/vte.override @@ -14,42 +14,64 @@ ignore vte_terminal_get_text %% override vte_terminal_fork_command kwargs static PyObject * -_wrap_vte_terminal_fork_command(PyGObject *self, PyObject *args, - PyObject *kwargs) +_wrap_vte_terminal_fork_command(PyGObject * self, PyObject * args, + PyObject * kwargs) { - gchar **argv = NULL; - gchar *command = NULL; - static char *kwlist[] = { "command", "argv", NULL }; - PyObject *py_argv = NULL; - int i, n_args; - pid_t pid; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|sO:fork_command", - kwlist, &command, &py_argv)) - return NULL; - - - if (py_argv != NULL && py_argv != Py_None) { - if (!PySequence_Check(py_argv)) { - PyErr_SetString(PyExc_TypeError, "argv must be a sequence"); - return NULL; + gchar **argv = NULL, **envv = NULL; + gchar *command = NULL; + static char *kwlist[] = { "command", "argv", NULL }; + PyObject *py_argv = NULL, *py_envv = NULL; + int i, n_args, n_envs; + pid_t pid; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|sOO:fork_command", + kwlist, &command, &py_argv, + &py_envv)) { + return NULL; + } + + + if (py_argv != NULL && py_argv != Py_None) { + if (!PySequence_Check(py_argv)) { + PyErr_SetString(PyExc_TypeError, + "argv must be a sequence"); + return NULL; + } + + n_args = PySequence_Length(py_argv); + argv = g_new(gchar *, n_args + 1); + for (i = 0; i < n_args; i++) { + PyObject *item = PySequence_GetItem(py_argv, i); + Py_DECREF(item); /* PySequence_GetItem INCREF's */ + argv[i] = PyString_AsString(item); + } + argv[n_args] = NULL; } - n_args = PySequence_Length(py_argv); - argv = g_new(gchar *, n_args + 1); - for (i = 0; i < n_args; i++) { - PyObject *item = PySequence_GetItem(py_argv, i); - Py_DECREF(item); /* PySequence_GetItem INCREF's */ - argv[i] = PyString_AsString(item); + if (py_envv != NULL && py_envv != Py_None) { + if (!PySequence_Check(py_envv)) { + PyErr_SetString(PyExc_TypeError, + "envv must be a sequence"); + return NULL; + } + + n_envs = PySequence_Length(py_envv); + envv = g_new(gchar *, n_envs + 1); + for (i = 0; i < n_envs; i++) { + PyObject *item = PySequence_GetItem(py_envv, i); + Py_DECREF(item); /* PySequence_GetItem INCREF's */ + envv[i] = PyString_AsString(item); + } + envv[n_envs] = NULL; } - argv[n_args] = NULL; - } - pid = vte_terminal_fork_command(VTE_TERMINAL(self->obj), command, argv); + pid = vte_terminal_fork_command(VTE_TERMINAL(self->obj), + command, argv, envv); + + if (argv) { + g_free(argv); + } - if (argv) - g_free(argv); - - return PyInt_FromLong(pid); + return PyInt_FromLong(pid); } %% |