aboutsummaryrefslogtreecommitdiff
path: root/test/functional/fixtures/shell-test.c
diff options
context:
space:
mode:
authorScott Prager <splinterofchaos@gmail.com>2015-05-02 10:30:30 -0400
committerScott Prager <splinterofchaos@gmail.com>2015-05-02 10:30:30 -0400
commit1c2c90ab0720784473805d20c359499a2d3d2ccf (patch)
tree8c4e587c91bbf91748c7ace6338aa3f609eaec0f /test/functional/fixtures/shell-test.c
parent205466830207a920c62146b7b689fac2e395431a (diff)
parent1eb33969220b267cf45adb286f0b7b6d14805eff (diff)
downloadrneovim-1c2c90ab0720784473805d20c359499a2d3d2ccf.tar.gz
rneovim-1c2c90ab0720784473805d20c359499a2d3d2ccf.tar.bz2
rneovim-1c2c90ab0720784473805d20c359499a2d3d2ccf.zip
Merge pull request #2424 from splinterofchaos/term-no-sh
use an argument vector for termopen() / unify jobstart, termopen, and system
Diffstat (limited to 'test/functional/fixtures/shell-test.c')
-rw-r--r--test/functional/fixtures/shell-test.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/functional/fixtures/shell-test.c b/test/functional/fixtures/shell-test.c
new file mode 100644
index 0000000000..5fa8a58049
--- /dev/null
+++ b/test/functional/fixtures/shell-test.c
@@ -0,0 +1,25 @@
+// A simple implementation of a shell for testing
+// `termopen([&sh, &shcf, '{cmd'}])` and `termopen([&sh])`.
+//
+// If launched with no arguments, prints "ready $ ", otherwise prints
+// "ready $ {cmd}\n".
+
+#include <stdio.h>
+#include <string.h>
+
+int main(int argc, char **argv)
+{
+ fprintf(stderr, "ready $ ");
+
+ if (argc == 3) {
+ // argv should be {"terminal-test", "EXE", "prog args..."}
+ if (strcmp(argv[1], "EXE") != 0) {
+ fprintf(stderr, "first argument must be 'EXE'\n");
+ return 2;
+ }
+
+ fprintf(stderr, "%s\n", argv[2]);
+ }
+
+ return 0;
+}