*
*/
-#include "internal.h"
+#include "busybox.h"
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <sys/types.h>
-static const char tty_usage[] = "tty\n\n"
- "Print the file name of the terminal connected to standard input.\n\n"
- "Options:\n"
- "\t-s\tprint nothing, only return an exit status\n";
-
extern int tty_main(int argc, char **argv)
{
char *tty;
if (argc > 1) {
if (argv[1][0] != '-' || argv[1][1] != 's')
- usage(tty_usage);
+ show_usage();
} else {
tty = ttyname(0);
if (tty)
else
puts("not a tty");
}
- exit(isatty(0) ? TRUE : FALSE);
+ return(isatty(0) ? EXIT_SUCCESS : EXIT_FAILURE);
}