mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-26 07:55:01 +00:00
Add usage().
This commit is contained in:
parent
0e879078f3
commit
759bde1062
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28372
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user