]> git.mdlowis.com Git - projs/tide.git/commitdiff
added wrapper script to run a shell in tide like a terminal
authorMichael D. Lowis <mike@mdlowis.com>
Thu, 21 Nov 2019 04:26:38 +0000 (23:26 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Thu, 21 Nov 2019 04:26:38 +0000 (23:26 -0500)
.gitignore
bin/term [new file with mode: 0755]
src/tide.c

index c229b4287d26fe406459bf9635a56e4e866555a2..87035ea20862779530d4b7a2683907abd2080c0d 100644 (file)
@@ -44,17 +44,8 @@ xedit
 xpick
 DELETEME
 tests/libedit
-tests/term
-term
-xcpd
 tests/tide
-tide
-pick
 tests/pick
-hl-cpp
-pty
-tctl
-flaws.txt
 edit
 registrar
 fetch
@@ -65,3 +56,5 @@ bin/anvil
 .rscons*
 build/
 bin/fetchsel
+pick
+tide
\ No newline at end of file
diff --git a/bin/term b/bin/term
new file mode 100755 (executable)
index 0000000..cbefbd9
--- /dev/null
+++ b/bin/term
@@ -0,0 +1,3 @@
+#!/bin/sh
+export TERM=dumb
+tide -c "$SHELL"
\ No newline at end of file
index 281f7ae8eca93f7d493cd43a723822350cdbf181..5143166e3b647be8a086394d6f6cabb3de986095 100644 (file)
@@ -795,7 +795,8 @@ static void usage(void)
         "\n    -E 0,1  Enable/disable expanding tabs to spaces"
         "\n    -N 0,1  Enable/disable dos line ending style"
         "\n    -T str  String to use for the tags region"
-        "\n    -C str  Set the shell to use for command execution\n",
+        "\n    -C str  Set the shell to use for command execution\n"
+        "\n    -c cmd  Runs command interactively in the window\n",
         ARGV0);
     exit(1);
 }
@@ -820,6 +821,7 @@ static void edit_file(char* file, int line_num)
 
 int main(int argc, char** argv)
 {
+    char* termcmd = NULL;
     long int line_num = 0;
     #define BOOLARG() (EOPTARG(usage()), optarg_[0] == '0' ? 0 : 1)
     #define STRARG()  (EOPTARG(usage()))
@@ -832,6 +834,7 @@ int main(int argc, char** argv)
         case 'N': DosLineFeed = BOOLARG(); break;
         case 'T': TagString   = STRARG();  break;
         case 'C': ShellCmd[0] = STRARG();  break;
+        case 'c': termcmd     = STRARG();  break;
         case 'l': line_num    = NUMARG();  break;
         default:  usage();                 break;
     }
@@ -859,9 +862,17 @@ int main(int argc, char** argv)
     }
 
     /* set host name property */
-    char host[8192];
-    if (!gethostname(host, sizeof(host)))
-        win_prop_set("HOST", "host", host);
+    char buf[8192];
+    if (!gethostname(buf, sizeof(buf)))
+        win_prop_set("HOST", "host", buf);
+
+    /* exit */
+    if (termcmd)
+    {
+        termcmd = strmcat("&", termcmd, 0);
+        cmd_exec(termcmd);
+        free(termcmd);
+    }
 
     /* now create the window and start the event loop */
 #ifndef TEST