projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed option parsing. Grep would continue grepping, even when given a bad /
[oweals/busybox.git]
/
tty.c
diff --git
a/tty.c
b/tty.c
index f3c7fb74f5ceefb3297a839c6b170ebfd1a6da3f..4510c29963ff88cfea1a13c508f0267c36066b2c 100644
(file)
--- a/
tty.c
+++ b/
tty.c
@@
-20,17
+20,11
@@
*
*/
*
*/
-#include "internal.h"
#include <stdio.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/types.h>
-
-static const char tty_usage[] = "tty\n"
-#ifndef BB_FEATURE_TRIVIAL_HELP
- "\nPrint the file name of the terminal connected to standard input.\n\n"
- "Options:\n"
- "\t-s\tprint nothing, only return an exit status\n"
-#endif
- ;
+#include "busybox.h"
extern int tty_main(int argc, char **argv)
{
extern int tty_main(int argc, char **argv)
{
@@
-38,7
+32,7
@@
extern int tty_main(int argc, char **argv)
if (argc > 1) {
if (argv[1][0] != '-' || argv[1][1] != 's')
if (argc > 1) {
if (argv[1][0] != '-' || argv[1][1] != 's')
-
usage(tty_usage
);
+
show_usage(
);
} else {
tty = ttyname(0);
if (tty)
} else {
tty = ttyname(0);
if (tty)
@@
-46,5
+40,5
@@
extern int tty_main(int argc, char **argv)
else
puts("not a tty");
}
else
puts("not a tty");
}
- return(isatty(0) ?
TRUE : FALS
E);
+ return(isatty(0) ?
EXIT_SUCCESS : EXIT_FAILUR
E);
}
}