Annotation of src/usr.bin/tty/tty.1, Revision 1.14
1.14 ! jmc 1: .\" $OpenBSD: tty.1,v 1.13 2009/02/08 17:15:10 jmc Exp $
1.1 deraadt 2: .\" $NetBSD: tty.1,v 1.4 1994/12/07 00:46:55 jtc Exp $
3: .\"
4: .\" Copyright (c) 1990, 1993
5: .\" The Regents of the University of California. All rights reserved.
6: .\"
7: .\" This code is derived from software contributed to Berkeley by
8: .\" the Institute of Electrical and Electronics Engineers, Inc.
9: .\"
10: .\" Redistribution and use in source and binary forms, with or without
11: .\" modification, are permitted provided that the following conditions
12: .\" are met:
13: .\" 1. Redistributions of source code must retain the above copyright
14: .\" notice, this list of conditions and the following disclaimer.
15: .\" 2. Redistributions in binary form must reproduce the above copyright
16: .\" notice, this list of conditions and the following disclaimer in the
17: .\" documentation and/or other materials provided with the distribution.
1.10 millert 18: .\" 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 19: .\" may be used to endorse or promote products derived from this software
20: .\" without specific prior written permission.
21: .\"
22: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: .\" SUCH DAMAGE.
33: .\"
34: .\" @(#)tty.1 8.1 (Berkeley) 6/6/93
35: .\"
1.14 ! jmc 36: .Dd $Mdocdate: February 8 2009 $
1.1 deraadt 37: .Dt TTY 1
38: .Os
39: .Sh NAME
40: .Nm tty
41: .Nd return user's terminal name
42: .Sh SYNOPSIS
43: .Nm tty
44: .Op Fl s
45: .Sh DESCRIPTION
46: The
1.9 aaron 47: .Nm
1.1 deraadt 48: utility writes the name of the terminal attached to standard input
49: to standard output.
50: The name that is written is the string returned by
51: .Xr ttyname 3 .
1.9 aaron 52: .Pp
53: If the standard input is not a terminal, the message
54: .Dq not a tty
1.1 deraadt 55: is written.
1.9 aaron 56: .Pp
1.1 deraadt 57: The options are as follows:
58: .Bl -tag -width Ds
59: .It Fl s
60: Don't write the terminal name; only the exit status is affected
61: when this option is specified.
62: The
63: .Fl s
64: option is deprecated in favor of the
65: .Dq Li "test -t 0"
66: command.
67: .El
1.14 ! jmc 68: .Sh EXIT STATUS
1.9 aaron 69: The
70: .Nm
71: utility exits 0 if the standard input is a terminal, 1 if the standard input
1.14 ! jmc 72: is not a terminal, or \*(Gt1 if an error occurred.
1.1 deraadt 73: .Sh SEE ALSO
1.6 aaron 74: .Xr stty 1 ,
1.1 deraadt 75: .Xr test 1 ,
1.6 aaron 76: .Xr ttyname 3 ,
77: .Xr tty 4
1.1 deraadt 78: .Sh STANDARDS
79: The
1.9 aaron 80: .Nm
1.11 jmc 81: utility is compliant with the
1.13 jmc 82: .St -p1003.1-2008
1.11 jmc 83: specification.
84: .Pp
85: The flag
86: .Op Fl s
87: is an extension to that specification.
1.8 aaron 88: .Sh HISTORY
89: A
90: .Nm
91: command appeared in
92: .At v1 .