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.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" @(#)tty.1 8.1 (Berkeley) 6/6/93
|
.\" @(#)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
|
.Dd June 6, 1993
|
||||||
.Dt TTY 1
|
.Dt TTY 1
|
||||||
@ -42,11 +42,11 @@
|
|||||||
.Nm tty
|
.Nm tty
|
||||||
.Nd return user's terminal name
|
.Nd return user's terminal name
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm tty
|
.Nm
|
||||||
.Op Fl s
|
.Op Fl s
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
.Nm tty
|
.Nm
|
||||||
utility writes the name of the terminal attached to standard input
|
utility writes the name of the terminal attached to standard input
|
||||||
to standard output.
|
to standard output.
|
||||||
The name that is written is the string returned by
|
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
|
.Xr ttyname 3
|
||||||
.Sh STANDARDS
|
.Sh STANDARDS
|
||||||
The
|
The
|
||||||
.Nm tty
|
.Nm
|
||||||
function is expected to be
|
utility is expected to be
|
||||||
.St -p1003.2
|
.St -p1003.2
|
||||||
compatible.
|
compatible.
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
|
@ -32,17 +32,25 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static const char copyright[] =
|
||||||
"@(#) Copyright (c) 1988, 1993\n\
|
"@(#) Copyright (c) 1988, 1993\n\
|
||||||
The Regents of the University of California. All rights reserved.\n";
|
The Regents of the University of California. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/6/93";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
static void usage __P((void));
|
||||||
|
|
||||||
|
int
|
||||||
main(argc, argv)
|
main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
@ -58,8 +66,7 @@ main(argc, argv)
|
|||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
default:
|
default:
|
||||||
fputs("usage: tty [-s]\n", stderr);
|
usage();
|
||||||
exit(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
t = ttyname(0);
|
t = ttyname(0);
|
||||||
@ -67,3 +74,10 @@ main(argc, argv)
|
|||||||
puts(t ? t : "not a tty");
|
puts(t ? t : "not a tty");
|
||||||
exit(t ? 0 : 1);
|
exit(t ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
fprintf(stderr, "usage: tty [-s]\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user