1
0
mirror of git://git.suckless.org/sbase synced 2024-12-25 08:22:44 +00:00
sbase/tty.c

27 lines
397 B
C
Raw Normal View History

2011-06-02 20:15:35 +00:00
/* See LICENSE file for copyright and license details. */
#include <unistd.h>
2011-06-02 20:15:35 +00:00
#include <stdio.h>
#include <stdlib.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");
return tty ? EXIT_SUCCESS : EXIT_FAILURE;
2011-06-02 20:15:35 +00:00
}