/* tty -- print the path of the terminal connected to standard input
- Copyright (C) 1990-2003 Free Software Foundation, Inc.
+ Copyright (C) 1990-2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <sys/types.h>
#include "system.h"
-#include "exitfail.h"
#include "error.h"
+/* Exit statuses. */
+enum
+ {
+ TTY_FAILURE = 2,
+ TTY_WRITE_ERROR = 3
+ };
+
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "tty"
void
usage (int status)
{
- if (status != 0)
+ if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- exit_failure = 3;
+ initialize_exit_failure (TTY_WRITE_ERROR);
atexit (close_stdout);
silent = 0;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
- usage (2);
+ usage (TTY_FAILURE);
}
}
puts (_("not a tty"));
}
- exit (isatty (0) ? 0 : 1);
+ exit (isatty (0) ? EXIT_SUCCESS : EXIT_FAIL);
}