summaryrefslogtreecommitdiff
path: root/usr.bin/tty
diff options
context:
space:
mode:
authorPhilippe Charnier <charnier@FreeBSD.org>1997-08-18 07:30:15 +0000
committerPhilippe Charnier <charnier@FreeBSD.org>1997-08-18 07:30:15 +0000
commit759bde1062406981a3d608e6417937c96cf754c4 (patch)
tree17c9c643689a62b1ec65d198e798856e1e65ef4a /usr.bin/tty
parent0e879078f376543174371d0d7c00b049fb9978a3 (diff)
downloadsrc-test-759bde1062406981a3d608e6417937c96cf754c4.tar.gz
src-test-759bde1062406981a3d608e6417937c96cf754c4.zip
Add usage().
Notes
Notes: svn path=/head/; revision=28372
Diffstat (limited to 'usr.bin/tty')
-rw-r--r--usr.bin/tty/tty.110
-rw-r--r--usr.bin/tty/tty.c20
2 files changed, 22 insertions, 8 deletions
diff --git a/usr.bin/tty/tty.1 b/usr.bin/tty/tty.1
index 9c47b705885a8..67f2d634b3517 100644
--- a/usr.bin/tty/tty.1
+++ b/usr.bin/tty/tty.1
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)tty.1 8.1 (Berkeley) 6/6/93
-.\" $Id$
+.\" $Id: tty.1,v 1.4 1997/02/22 19:57:29 peter Exp $
.\"
.Dd June 6, 1993
.Dt TTY 1
@@ -42,11 +42,11 @@
.Nm tty
.Nd return user's terminal name
.Sh SYNOPSIS
-.Nm tty
+.Nm
.Op Fl s
.Sh DESCRIPTION
The
-.Nm tty
+.Nm
utility writes the name of the terminal attached to standard input
to standard output.
The name that is written is the string returned by
@@ -73,8 +73,8 @@ not a terminal, and >1 if an error occurs.
.Xr ttyname 3
.Sh STANDARDS
The
-.Nm tty
-function is expected to be
+.Nm
+utility is expected to be
.St -p1003.2
compatible.
.Sh HISTORY
diff --git a/usr.bin/tty/tty.c b/usr.bin/tty/tty.c
index 88cd60af5531a..7a7e688d8a3ec 100644
--- a/usr.bin/tty/tty.c
+++ b/usr.bin/tty/tty.c
@@ -32,17 +32,25 @@
*/
#ifndef lint
-static char copyright[] =
+static const char copyright[] =
"@(#) Copyright (c) 1988, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
+#if 0
static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/6/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include <stdio.h>
+#include <unistd.h>
+static void usage __P((void));
+
+int
main(argc, argv)
int argc;
char **argv;
@@ -58,8 +66,7 @@ main(argc, argv)
break;
case '?':
default:
- fputs("usage: tty [-s]\n", stderr);
- exit(2);
+ usage();
}
t = ttyname(0);
@@ -67,3 +74,10 @@ main(argc, argv)
puts(t ? t : "not a tty");
exit(t ? 0 : 1);
}
+
+static void
+usage()
+{
+ fprintf(stderr, "usage: tty [-s]\n");
+ exit(2);
+}