sbase/tty.c

28 lines
376 B
C
Raw Normal View History

2011-06-02 20:15:35 +00:00
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "util.h"
static void
usage(void)
{
eprintf("usage: %s\n", argv0);
}
2011-06-02 20:15:35 +00:00
int
main(int argc, char *argv[])
2011-06-02 20:15:35 +00:00
{
char *tty;
ARGBEGIN {
default:
usage();
} ARGEND;
tty = ttyname(STDIN_FILENO);
puts(tty ? tty : "not a tty");
2014-10-02 22:46:04 +00:00
return tty ? 0 : 1;
2011-06-02 20:15:35 +00:00
}