From 7d13c20f5ab8942add5c63af962fe11e3a9fe50e Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Wed, 23 May 2012 22:50:01 -0400 Subject: [PATCH] add primitive way of executing commands --- termite.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/termite.c b/termite.c index d5062ea..925aeb0 100644 --- a/termite.c +++ b/termite.c @@ -178,8 +178,17 @@ int main(int argc, char **argv) { GtkWidget *vte = vte_terminal_new(); - char *command_argv[2] = {vte_get_user_shell(), NULL}; - if (!command_argv[0]) command_argv[0] = "/bin/sh"; + + char **command_argv; + char *default_argv[2] = {NULL, NULL}; + + if (argc > 1) { + command_argv = &argv[1]; + } else { + default_argv[0] = vte_get_user_shell(); + if (!default_argv[0]) default_argv[0] = "/bin/sh"; + command_argv = default_argv; + } VtePty *pty = vte_terminal_pty_new(VTE_TERMINAL(vte), 0, &error);