antiright-devel
[Top][All Lists]
Advanced

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

[Antiright-devel] antiright/gshterm Makefile gshterm.c gshterm.h ...


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright/gshterm Makefile gshterm.c gshterm.h ...
Date: Fri, 09 Feb 2007 16:02:03 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 07/02/09 16:02:03

Modified files:
        gshterm        : Makefile gshterm.c gshterm.h 
Added files:
        gshterm        : command_line.c command_line.h script.c script.h 

Log message:
        Refactored gshterm source tree.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/Makefile?cvsroot=antiright&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/gshterm.c?cvsroot=antiright&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/gshterm.h?cvsroot=antiright&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/command_line.c?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/command_line.h?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/script.c?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/gshterm/script.h?cvsroot=antiright&rev=1.1

Patches:
Index: Makefile
===================================================================
RCS file: /sources/antiright/antiright/gshterm/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- Makefile    8 Feb 2007 23:22:30 -0000       1.2
+++ Makefile    9 Feb 2007 16:02:03 -0000       1.3
@@ -7,7 +7,7 @@
 LDFLAGS+=`pkg-config --libs gtk+-2.0` -lgtkshell -lantiright
 LDFLAGS+=`pkg-config --libs vte`
 
-objects=main.o gshterm.o
+objects=main.o gshterm.o command_line.o script.o
 all: $(objects) 
        cc -o gshterm $(objects) $(LDFLAGS)
 

Index: gshterm.c
===================================================================
RCS file: /sources/antiright/antiright/gshterm/gshterm.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- gshterm.c   9 Feb 2007 03:16:12 -0000       1.2
+++ gshterm.c   9 Feb 2007 16:02:03 -0000       1.3
@@ -65,87 +65,4 @@
        return(terminal);
 }
 
-char*
-gshterm_command_script(char *command)
-{
-       char *script_name;
-       pid_t pid;
-
-
-       /* This is a workaround for vte's fscking up of option arrays.  */
-
-       pid=getpid();
-
-       asprintf(&script_name, "/tmp/gshterm.%d", (int)pid);
-
-       sysprintf("echo '#!/bin/sh' > %s", script_name);
-       sysprintf("echo %s >> %s", command, script_name);
-       free(command);
-       sysprintf("chmod +x %s", script_name);
-       sysprintf("cat %s", script_name);
-
-       return(script_name);
-}
-
-gboolean
-gshterm_handle_command_line_option(gchar option, gchar *arg)
-{
-       gboolean exec_reached=FALSE;
-
-       putchar(option);
-       assert(arg);
-       switch(option)
-       {
-               case 'e':
-                       exec_reached=TRUE;
-                       break;
-               case 'g':
-                       asprintf(&gsh_geometry, arg);
-                       break;
-               default:
-                       g_printerr("unknown option");
-       }
-
-       return(exec_reached);
-}
-gboolean
-gshterm_construct_command_from_args(int argc, char **argv, gchar **command)
-{
-       int counter;
-       gboolean exec_reached;
-
-       puts(*command);
-
-       for(counter=1, exec_reached=FALSE; counter < argc; counter++)
-       {
-               if(exec_reached)
-                       asprintf(command, "%s %s ", *command, argv[counter]);
-               else if(argv[counter][0] == '-')
-                       exec_reached=gshterm_handle_command_line_option(
-                               argv[counter][1], argv[counter+1]);
-
-#ifdef DEBUG
-               g_print("\n%d\t%s\n", counter, argv[counter]);
-#endif /* DEBUG */
-
-       }
-
-       return(exec_reached);
-
-}
-
-char*
-gshterm_construct_command(int argc, char **argv)
-{
-       gchar *command;
-
-       command=""; /* Initialize to empty for
-                      the first concatenation.  */
-
-       if(!gshterm_construct_command_from_args(
-               argc, argv, &command))
-               asprintf(&command, "/bin/sh");
-
-       return(command);
-}
 

Index: gshterm.h
===================================================================
RCS file: /sources/antiright/antiright/gshterm/gshterm.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- gshterm.h   8 Feb 2007 23:22:30 -0000       1.1
+++ gshterm.h   9 Feb 2007 16:02:03 -0000       1.2
@@ -26,6 +26,9 @@
 #include <vte/vte.h>
 #include <unistd.h>
 
+#include "command_line.h"
+#include "script.h"
+
 void
 gshterm_delete_tmp(gpointer data);
 
@@ -38,11 +41,5 @@
 GtkWidget *
 gshterm_setup_terminal();
 
-char*
-gshterm_command_script(char *command);
-
-char*
-gshterm_construct_command(int argc, char **argv);
-
 #endif
 

Index: command_line.c
===================================================================
RCS file: command_line.c
diff -N command_line.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ command_line.c      9 Feb 2007 16:02:03 -0000       1.1
@@ -0,0 +1,89 @@
+/*
+  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"
+
+extern char *gsh_geometry;
+
+char*
+gshterm_construct_command(int argc, char **argv)
+{
+        gchar *command;
+
+        command=""; /* Initialize to empty for
+                       the first concatenation.  */
+
+        if(!gshterm_construct_command_from_args(
+           argc, argv, &command))
+           asprintf(&command, "/bin/sh");
+
+        return(command);
+}
+gboolean
+gshterm_handle_command_line_option(gchar option, gchar *arg)
+{
+       gboolean exec_reached=FALSE;
+
+       putchar(option);
+       assert(arg);
+       switch(option)
+       {
+               case 'e':
+                       exec_reached=TRUE;
+                       break;
+               case 'g':
+                       asprintf(&gsh_geometry, arg);
+                       break;
+               default:
+                       g_printerr("unknown option");
+       }
+
+       return(exec_reached);
+}
+
+gboolean
+gshterm_construct_command_from_args(int argc, char **argv, gchar **command)
+{
+       int counter;
+       gboolean exec_reached;
+
+       puts(*command);
+
+       for(counter=1, exec_reached=FALSE; counter < argc; counter++)
+       {
+               if(exec_reached)
+                       asprintf(command, "%s %s ", *command, argv[counter]);
+               else if(argv[counter][0] == '-')
+                       exec_reached=gshterm_handle_command_line_option(
+                               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
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ command_line.h      9 Feb 2007 16:02:03 -0000       1.1
@@ -0,0 +1,33 @@
+/*
+  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
+
+gboolean
+gshterm_construct_command_from_args(int argc, char **argv, gchar **command);
+
+char*
+gshterm_construct_command(int argc, char **argv);
+
+#endif /* GSHTERM_COMMAND_LINE_H */
+

Index: script.c
===================================================================
RCS file: script.c
diff -N script.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ script.c    9 Feb 2007 16:02:03 -0000       1.1
@@ -0,0 +1,47 @@
+/*
+  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_command_script(char *command)
+{
+       char *script_name;
+       pid_t pid;
+
+
+       /* This is a workaround for vte's fscking up of option arrays.  */
+
+       pid=getpid();
+
+       asprintf(&script_name, "/tmp/gshterm.%d", (int)pid);
+
+       sysprintf("echo '#!/bin/sh' > %s", script_name);
+       sysprintf("echo %s >> %s", command, script_name);
+       free(command);
+       sysprintf("chmod +x %s", script_name);
+       sysprintf("cat %s", script_name);
+
+       return(script_name);
+}
+
+

Index: script.h
===================================================================
RCS file: script.h
diff -N script.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ script.h    9 Feb 2007 16:02:03 -0000       1.1
@@ -0,0 +1,30 @@
+/*
+  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 */
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]