summaryrefslogtreecommitdiffstats
path: root/usr.bin/tty
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-08-18 07:30:15 +0000
committercharnier <charnier@FreeBSD.org>1997-08-18 07:30:15 +0000
commitbb57ad2407023ae28885ef4f4d9f1636f6e39230 (patch)
treeee101ad90a728c5556a0a9e32febd3909217884f /usr.bin/tty
parent467a801d978294483ea1c800047e075736a71d3f (diff)
downloadFreeBSD-src-bb57ad2407023ae28885ef4f4d9f1636f6e39230.zip
FreeBSD-src-bb57ad2407023ae28885ef4f4d9f1636f6e39230.tar.gz
Add usage().
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 9c47b70..67f2d63 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 88cd60a..7a7e688 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);
+}
OpenPOWER on IntegriCloud