summaryrefslogtreecommitdiff
path: root/util/sbase/tty.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/sbase/tty.c')
-rw-r--r--util/sbase/tty.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/util/sbase/tty.c b/util/sbase/tty.c
new file mode 100644
index 00000000..65151287
--- /dev/null
+++ b/util/sbase/tty.c
@@ -0,0 +1,31 @@
+/* See LICENSE file for copyright and license details. */
+#include <stdio.h>
+#include <unistd.h>
+
+#include "util.h"
+
+static void
+usage(void)
+{
+ enprintf(2, "usage: %s\n", argv0);
+}
+
+int
+main(int argc, char *argv[])
+{
+ char *tty;
+
+ ARGBEGIN {
+ default:
+ usage();
+ } ARGEND
+
+ if (argc)
+ usage();
+
+ tty = ttyname(STDIN_FILENO);
+ puts(tty ? tty : "not a tty");
+
+ enfshut(2, stdout, "<stdout>");
+ return !tty;
+}