summaryrefslogtreecommitdiff
path: root/src/tty.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2004-08-03 23:14:08 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2004-08-03 23:14:08 +0000
commit86c940cf997e9ce416cc5e450abfa68838ea7ae7 (patch)
tree549d2425e41a6c0a500d74badb7fc95cb2eb07ec /src/tty.c
parent53e793837a36a54e765636b2cefec0c4d92d9a25 (diff)
downloadcoreutils-86c940cf997e9ce416cc5e450abfa68838ea7ae7.tar.xz
(silent, main): Use bool for booleans.
(main): 0 -> STDIN_FILENO.
Diffstat (limited to 'src/tty.c')
-rw-r--r--src/tty.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tty.c b/src/tty.c
index 83411dcb6..430f55b6b 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -46,8 +46,8 @@ enum
/* The name under which this program was run. */
char *program_name;
-/* If nonzero, return an exit status but produce no output. */
-static int silent;
+/* If true, return an exit status but produce no output. */
+static bool silent;
static struct option const longopts[] =
{
@@ -94,7 +94,7 @@ main (int argc, char **argv)
initialize_exit_failure (TTY_WRITE_ERROR);
atexit (close_stdout);
- silent = 0;
+ silent = false;
while ((optc = getopt_long (argc, argv, "s", longopts, NULL)) != -1)
{
@@ -104,7 +104,7 @@ main (int argc, char **argv)
break;
case 's':
- silent = 1;
+ silent = true;
break;
case_GETOPT_HELP_CHAR;
@@ -119,7 +119,7 @@ main (int argc, char **argv)
if (optind < argc)
error (0, 0, _("extra operand %s"), quote (argv[optind]));
- tty = ttyname (0);
+ tty = ttyname (STDIN_FILENO);
if (!silent)
{
if (tty)
@@ -128,5 +128,5 @@ main (int argc, char **argv)
puts (_("not a tty"));
}
- exit (isatty (0) ? EXIT_SUCCESS : EXIT_FAIL);
+ exit (isatty (STDIN_FILENO) ? EXIT_SUCCESS : EXIT_FAIL);
}