I have a small patch here that adds an usefull "-c" bash-like option to DFBTerm.
This way you can run commands like dfbterm -c "top -S" on the fly.



Regards, Claudio


=================================================== --- DFBTerm/src/term.c 2004-05-20 14:27:24.000000000 +0200 +++ DFBTerm-klan/src/term.c 2004-06-04 18:44:58.000000000 +0200 @@ -154,6 +154,7 @@ IDirectFBFont *font; struct _vtx *vtx; Term *term; + char *command = NULL; int fontsize = TERM_DEFAULT_FONTSIZE; char *geometry = 0; char *geosep = 0; @@ -222,6 +223,11 @@

               termpos = 1;
          }
+      else if (strstr (argv[i], "-c") == argv[i]) {
+           if (argv[i + 1] && *argv[i + 1] && *argv[i + 1] != '-')
+          command = strdup (argv[++i]);
+      }
+
     }

     ret = DirectFBCreate (&dfb);
@@ -331,7 +337,15 @@

          setenv ("TERM", "xterm", 1);

-          execl (shell, name, NULL);
+      if(command) {
+            char cmd[strlen (command) + 1];
+        strcpy (cmd, command);
+        free (command);
+                execl (shell, name, "-c", cmd, NULL);
+      }
+      else {
+        execl (shell, name,  NULL);
+      }

          perror ("Could not exec");
          _exit(127);
@@ -450,7 +464,8 @@

static void term_usage (void)
{
- printf ("\n usage: dfbterm [--fontsize=X] [--size=COLSxROWS] [--position=X,Y] [dfb-options]");
+ printf ("\n usage: dfbterm [--fontsize=X] [--size=COLSxROWS] [--position=X,Y]");
+ printf ("\n [-c \"shell commands\"] [dfb-options]");
printf ("\n (defaults: --fontsize=%d --size=%dx%d)\n\n",
TERM_DEFAULT_FONTSIZE, TERM_DEFAULT_WIDTH, TERM_DEFAULT_HEIGHT);
}







Reply via email to