[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Antiright-devel] antiright/gshterm Makefile command_line.c comma...
From: |
Jeffrey Bedard |
Subject: |
[Antiright-devel] antiright/gshterm Makefile command_line.c comma... |
Date: |
Fri, 16 Mar 2007 00:41:52 +0000 |
CVSROOT: /sources/antiright
Module name: antiright
Changes by: Jeffrey Bedard <jefbed> 07/03/16 00:41:52
Removed files:
gshterm : Makefile command_line.c command_line.h
gshterm.c gshterm.h main.c script.c script.h
Log message:
Integrated with gtkshell.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/Makefile?cvsroot=antiright&r1=1.8&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/command_line.c?cvsroot=antiright&r1=1.8&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/command_line.h?cvsroot=antiright&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/gshterm.c?cvsroot=antiright&r1=1.12&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/gshterm.h?cvsroot=antiright&r1=1.8&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/main.c?cvsroot=antiright&r1=1.15&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/script.c?cvsroot=antiright&r1=1.7&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/script.h?cvsroot=antiright&r1=1.3&r2=0
Patches:
Index: Makefile
===================================================================
RCS file: Makefile
diff -N Makefile
--- Makefile 16 Mar 2007 00:39:31 -0000 1.8
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,49 +0,0 @@
-###############################################################################
-#
-# AntiRight
-# (c) 2004-2007 Jeffrey Bedard
-# address@hidden
-#
-# This file is part of AntiRight.
-#
-# AntiRight is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# AntiRight is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with AntiRight; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301 USA
-#
-###############################################################################
-
-include ../config.mk
-
-#CFLAGS+=`pkg-config --cflags gtk+-2.0` -g3 -Wall -W -Werror
-CFLAGS+=`pkg-config --cflags gtk+-2.0` $(DEFS) -I../libantiright -I../gtkshell
-CFLAGS+=`pkg-config --cflags vte`
-LDFLAGS+=-L../libantiright -L../gtkshell -L./
-LDFLAGS+=`pkg-config --libs gtk+-2.0` -lgtkshell -lantiright
-LDFLAGS+=`pkg-config --libs vte`
-
-objects=gshterm.o command_line.o script.o
-program=main.o
-
-all: gshterm
-
-gshterm: $(objects) $(program)
- ar rcs libgshterm.a $(objects)
- $(CC) -o gshterm $(program) $(LDFLAGS) -lgshterm
-
-clean:
- rm -f gshterm *.o libgshterm.a
-
-install:
- install gshterm $(PREFIX)/bin
-
Index: command_line.c
===================================================================
RCS file: command_line.c
diff -N command_line.c
--- command_line.c 7 Mar 2007 06:44:47 -0000 1.8
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,107 +0,0 @@
-/*
- AntiRight
- (c) 2007 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#include "gshterm.h"
-
-char *
-gshterm_construct_command(struct GSHTerm * term, int argc, char **argv)
-{
- gchar *command;
-
- command = (gchar*)""; /* Initialize to empty for the first
- * concatenation. */
-
- ARIFNB(gshterm_construct_command_from_args(
- term, argc, argv, &command))
- {
- char *shell;
-
- shell = getenv("SHELL");
- ARIFNP(shell)
- ar_asprintf(&command, "/bin/sh");
- else
- ar_asprintf(&command, "%s", shell);
- }
-
- return (command);
-}
-
-static gboolean
-gshterm_handle_command_line_option(
- struct GSHTerm * term, gchar option, gchar *arg)
-{
- ARIFNP(arg)
- {
- ARWARN("gshterm: invalid argument");
- return FALSE;
- }
-
-#ifdef DEBUG
- putchar(option);
-#endif /* DEBUG */
-
- switch (option)
- {
- case 'e':
- return TRUE;
- case 'f':
- ar_asprintf(&term->font, arg);
- break;
- case 'g':
- ar_asprintf(&term->gsh->geometry, arg);
- break;
- case 's':
- term->font_size = (gint) atoi(arg);
- break;
- default:
- g_warning("gshterm: unknown option: -%c\n", option);
- }
- return FALSE;
-}
-
-gboolean
-gshterm_construct_command_from_args(
- struct GSHTerm * term, int argc, char **argv, gchar **command)
-{
- int counter;
- gboolean exec_reached;
-
-#ifdef DEBUG
- puts(*command);
-#endif /* DEBUG */
-
- for (counter = 1, exec_reached = FALSE; counter < argc; counter++)
- {
- if (exec_reached)
- ar_asprintf(command, "%s %s ", *command, argv[counter]);
- else if (argv[counter][0] == '-')
- exec_reached = gshterm_handle_command_line_option(
- term, argv[counter][1], argv[counter + 1]);
-
-#ifdef DEBUG
- g_print("\n%d\t%s\n", counter, argv[counter]);
-#endif /* DEBUG */
-
- }
-
- return (exec_reached);
-}
Index: command_line.h
===================================================================
RCS file: command_line.h
diff -N command_line.h
--- command_line.h 28 Feb 2007 03:53:51 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,35 +0,0 @@
-/*
- AntiRight
- (c) 2007 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#ifndef GSHTERM_COMMAND_LINE_H
-#define GSHTERM_COMMAND_LINE_H
-
-#include "gshterm.h"
-
-gboolean
-gshterm_construct_command_from_args(
- struct GSHTerm * term, int argc, char **argv, gchar **command);
-
-char *
- gshterm_construct_command(struct GSHTerm * term, int argc, char **argv);
-
-#endif /* GSHTERM_COMMAND_LINE_H */
Index: gshterm.c
===================================================================
RCS file: gshterm.c
diff -N gshterm.c
--- gshterm.c 16 Mar 2007 00:39:31 -0000 1.12
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,109 +0,0 @@
-/*
- AntiRight
- (c) 2007 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#include "gshterm.h"
-
-static void
-set_font(struct GSHTerm * term)
-{
- gchar *final_font;
-
- ARIFNP(term->font)
- ar_asprintf(&final_font, "Mono 12");
- else
- {
- if (term->font_size == 0)
-
- /*
- * If size is unspecified, then either the user
- * may have specified a font size as part of
- * the font string, or we will rely on system
- * defaults.
- */
- ar_asprintf(&final_font, "%s", term->font);
- else
- ar_asprintf(&final_font, "%s %d", term->font,
- term->font_size);
-
- g_free(term->font);
- term->font = NULL;
- }
-
- vte_terminal_set_font_from_string(VTE_TERMINAL(term->widget),
- final_font);
- g_free(final_font);
-}
-void
-gshterm_set_terminal_options(struct GSHTerm * term)
-{
- vte_terminal_set_size(VTE_TERMINAL(term->widget), 80, 32);
- vte_terminal_set_allow_bold(VTE_TERMINAL(term->widget), TRUE);
- vte_terminal_set_backspace_binding(VTE_TERMINAL(term->widget),
- VTE_ERASE_ASCII_BACKSPACE);
- set_font(term);
-
- vte_terminal_set_background_transparent(
- VTE_TERMINAL(term->widget), TRUE);
-}
-
-struct GSHTerm *
-gshterm_setup_terminal(struct GSHTerm * term)
-{
- GtkWidget * column;
-
-#ifdef DEBUG
- ARPASSERT(term);
- ARPASSERT(term->gsh);
- ARPASSERT(term->gsh->window);
-#endif /* DEBUG */
-
- term->widget = vte_terminal_new();
- column=gtk_vbox_new(FALSE, 2);
- gtk_container_add(GTK_CONTAINER(term->gsh->window), column);
- gtk_widget_show(term->gsh->window);
- term->gsh->window=column;
- gtk_widget_show(term->gsh->window);
- gtk_container_add(GTK_CONTAINER(term->gsh->window), term->widget);
- gsh_setup_containers(term->gsh);
- gshterm_set_terminal_options(term);
- gtk_widget_show(term->widget);
-
- return (term);
-}
-
-struct GSHTerm *
-GSHTerm_new()
-{
- struct GSHTerm *term;
-
- term = (struct GSHTerm *) xmalloc(sizeof(struct GSHTerm));
-
- ARPASSERT(term);
-
- term->gsh = NULL;
- term->font = NULL;
- term->font_size = 0;
- term->widget = NULL;
-
- return term;
-}
-
Index: gshterm.h
===================================================================
RCS file: gshterm.h
diff -N gshterm.h
--- gshterm.h 28 Feb 2007 03:53:51 -0000 1.8
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,51 +0,0 @@
-/*
- AntiRight
- (c) 2007 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#ifndef GSHTERM_H
-#define GSHTERM_H
-
-#include <gtkshell.h>
-#include <vte/vte.h>
-#include <unistd.h>
-
-struct GSHTerm
-{
- struct GSH *gsh;
- gchar *script;
- gchar *font;
- gint font_size;
- GtkWidget *widget;
-};
-
-#include "command_line.h"
-#include "script.h"
-
-void
- gshterm_set_terminal_options(struct GSHTerm * term);
-
-struct GSHTerm *
- gshterm_setup_terminal();
-
-struct GSHTerm *
- GSHTerm_new();
-
-#endif
Index: main.c
===================================================================
RCS file: main.c
diff -N main.c
--- main.c 16 Mar 2007 00:39:31 -0000 1.15
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,86 +0,0 @@
-/*
- AntiRight
- (c) 2007 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301 USA
-*/
-
-#include "gshterm.h"
-#include <unistd.h>
-
-
-static struct GSHTerm *
-gshterm_init_and_script(int *argc, char ***argv)
-{
- struct GSHTerm *term;
-
- term = GSHTerm_new();
-
- term->gsh = gsh_init(argc, argv);
-
-#ifdef DEBUG
- ARPASSERT(term->gsh);
- ARPASSERT(term->gsh->window);
-#endif /* DEBUG */
-
- term->script = gshterm_command_script
- (gshterm_construct_command(term, *argc, *argv));
-
-
- gshterm_setup_terminal(term);
-
- return (term);
-}
-
-int
-main(int argc, char **argv)
-{
- struct GSHTerm *term;
- gpointer script;
-
- /* Initialize GTK, GSH, and GSHTerm. */
- term = gshterm_init_and_script(&argc, &argv);
-
- gsh_parse_arguments(term->gsh, argc, argv);
-
- gsh_check_and_set_geometry(term->gsh);
-
- g_signal_connect(G_OBJECT(term->widget), "child-exited",
- G_CALLBACK(gtk_main_quit), NULL);
-
- /* Run the script in the terminal widget. */
- vte_terminal_fork_command(VTE_TERMINAL(term->widget),
- term->script, NULL, NULL, NULL,
- TRUE, TRUE, TRUE);
-
- script = term->script;
-
- gtk_widget_show(term->gsh->window);
-
-
- g_free(term->gsh);
- g_free(term);
-
- gtk_main();
-
- unlink(script);
- g_free(script);
-
- return (0);
-}
Index: script.c
===================================================================
RCS file: script.c
diff -N script.c
--- script.c 1 Mar 2007 06:13:41 -0000 1.7
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,70 +0,0 @@
-/*
- AntiRight
- (c) 2007 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#include "gshterm.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-
-/* Returned value must be freed. */
-char *
-gshterm_command_script(char *command)
-{
- gchar *script_name;
- FILE *script;
- gint fd;
-
-#ifdef DEBUG
- ARBUG("gshterm_command_script()");
-#endif /* DEBUG */
-
- ARPASSERT(command);
-
- /* This is a workaround for vte's fscking up of option arrays. */
-
- fd = g_file_open_tmp("gshterm.XXXXXX", &script_name, NULL);
- ARASSERT(fd != -1);
-
- /*
- * Do this immediately after opening in order to reduce the
- * possiblity of script modification exploit.
- */
- if (fchmod(fd, S_IXUSR | S_IRUSR | S_IWUSR) != 0)
- ARERR("script file does not exist");
-
- ARIFNP((script=fdopen(fd, "w")))
- ARERR("script file could not be opened");
-
- //fflush(script);
- if(fsync(fd) == EOF)
- ARERR("cannot write script file");
-
- fprintf(script, "#!/bin/sh\n%s\n", command);
- g_free(command);
- fclose(script); /* Close and flush buffers. */
-
-#ifdef DEBUG
- sysprintf("cat %s", script_name);
- ARBUG("end gshterm_command_script()");
-#endif /* DEBUG */
-
- return (script_name);
-}
Index: script.h
===================================================================
RCS file: script.h
diff -N script.h
--- script.h 28 Feb 2007 03:53:51 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-/*
- AntiRight
- (c) 2007 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#ifndef GSHTERM_SCRIPT_H
-#define GSHTERM_SCRIPT_H
-
-char *
- gshterm_command_script(char *command);
-
-#endif /* GSHTERM_SCRIPT_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Antiright-devel] antiright/gshterm Makefile command_line.c comma...,
Jeffrey Bedard <=