aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorerik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-02-08 19:58:47 +0000
committererik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-02-08 19:58:47 +0000
commita18125005d67c38a8ad7fb454571bb996664ad96 (patch)
treec90bda10731ad9333ce3b404f993354c9fc104b8 /tty.c
parent8ef3b44285a8ce5b83bed9cf32ce5f40b30ba72f (diff)
downloadbusybox-w32-a18125005d67c38a8ad7fb454571bb996664ad96.tar.gz
busybox-w32-a18125005d67c38a8ad7fb454571bb996664ad96.tar.bz2
busybox-w32-a18125005d67c38a8ad7fb454571bb996664ad96.zip
Some formatting updates (ran the code through indent)
-Erik git-svn-id: svn://busybox.net/trunk/busybox@357 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/tty.c b/tty.c
index 83abaffb5..8ac1c1fcd 100644
--- a/tty.c
+++ b/tty.c
@@ -1,3 +1,4 @@
1/* vi: set sw=4 ts=4: */
1/* 2/*
2 * Mini tty implementation for busybox 3 * Mini tty implementation for busybox
3 * 4 *
@@ -24,19 +25,23 @@
24#include <sys/types.h> 25#include <sys/types.h>
25 26
26static const char tty_usage[] = "tty\n\n" 27static const char tty_usage[] = "tty\n\n"
27"Print the file name of the terminal connected to standard input.\n" 28 "Print the file name of the terminal connected to standard input.\n"
28"\t-s\tprint nothing, only return an exit status\n";
29 29
30extern int tty_main(int argc, char **argv) { 30 "\t-s\tprint nothing, only return an exit status\n";
31
32extern int tty_main(int argc, char **argv)
33{
31 char *tty; 34 char *tty;
32 35
33 if (argc > 1) { 36 if (argc > 1) {
34 if (argv[1][0] != '-' || argv[1][1] != 's') usage (tty_usage); 37 if (argv[1][0] != '-' || argv[1][1] != 's')
35 } 38 usage(tty_usage);
36 else { 39 } else {
37 tty = ttyname (0); 40 tty = ttyname(0);
38 if (tty) puts (tty); 41 if (tty)
39 else puts ("not a tty"); 42 puts(tty);
43 else
44 puts("not a tty");
40 } 45 }
41 exit (isatty (0) ? TRUE : FALSE); 46 exit(isatty(0) ? TRUE : FALSE);
42} 47}