projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Style, error_msg
[oweals/busybox.git]
/
coreutils
/
tty.c
diff --git
a/coreutils/tty.c
b/coreutils/tty.c
index 83abaffb59bba55546babe861a22d23079aecf9c..4510c29963ff88cfea1a13c508f0267c36066b2c 100644
(file)
--- a/
coreutils/tty.c
+++ b/
coreutils/tty.c
@@
-1,3
+1,4
@@
+/* vi: set sw=4 ts=4: */
/*
* Mini tty implementation for busybox
*
/*
* Mini tty implementation for busybox
*
@@
-19,24
+20,25
@@
*
*/
*
*/
-#include "internal.h"
#include <stdio.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/types.h>
+#include "busybox.h"
-static const char tty_usage[] = "tty\n\n"
-"Print the file name of the terminal connected to standard input.\n"
-"\t-s\tprint nothing, only return an exit status\n";
-
-extern int tty_main(int argc, char **argv) {
+extern int tty_main(int argc, char **argv)
+{
char *tty;
if (argc > 1) {
char *tty;
if (argc > 1) {
- if (argv[1][0] != '-' || argv[1][1] != 's') usage (tty_usage);
- }
- else {
- tty = ttyname (0);
- if (tty) puts (tty);
- else puts ("not a tty");
+ if (argv[1][0] != '-' || argv[1][1] != 's')
+ show_usage();
+ } else {
+ tty = ttyname(0);
+ if (tty)
+ puts(tty);
+ else
+ puts("not a tty");
}
}
-
exit (isatty (0) ? TRUE : FALS
E);
+
return(isatty(0) ? EXIT_SUCCESS : EXIT_FAILUR
E);
}
}