summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2018-03-06 16:22:54 +0800
committerJeremy Kerr <jk@ozlabs.org>2018-04-12 14:22:33 +0800
commit292a81fffc0ff0bb836f7e51514ccafc77aa475d (patch)
tree8e06f0db9c4e19fbafa3046ca3f5e5734d34d86f
parentc13dc815beecd283508c80ab0e426f12f2b14955 (diff)
downloadfbterm-292a81fffc0ff0bb836f7e51514ccafc77aa475d.tar.gz
fbterm-292a81fffc0ff0bb836f7e51514ccafc77aa475d.zip
config: add 'write-only' config option to use null input implementation
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r--src/fbconfig.cpp1
-rw-r--r--src/input.cpp5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/fbconfig.cpp b/src/fbconfig.cpp
index f1985d0..3bdfba3 100644
--- a/src/fbconfig.cpp
+++ b/src/fbconfig.cpp
@@ -238,6 +238,7 @@ bool Config::parseArgs(s32 argc, s8 **argv)
{ "font-height", required_argument, 0, 4 },
{ "ambiguous-wide", no_argument, 0, 'a' },
{ "shared-mem", required_argument, 0, 'm' },
+ { "write-only", no_argument, 0, 'w' },
#ifdef ENABLE_VESA
{ "vesa-mode", required_argument, 0, 3 },
#endif
diff --git a/src/input.cpp b/src/input.cpp
index 5403ce0..ea9dba7 100644
--- a/src/input.cpp
+++ b/src/input.cpp
@@ -74,8 +74,13 @@ protected:
TtyInput *TtyInput::createInstance()
{
+ bool write_only;
s8 buf[64];
+ Config::instance()->getOption("write-only", write_only);
+ if (write_only)
+ return new TtyInputNull();
+
if (ttyname_r(STDIN_FILENO, buf, sizeof(buf))) {
fprintf(stderr, "stdin isn't a tty!\n");
return 0;
OpenPOWER on IntegriCloud