WARNSify, fix .Nm usage, getopt returns -1 not EOF

This commit is contained in:
lukem 1997-10-19 12:44:21 +00:00
parent 9b5a69b52c
commit cb7e4f16f1
2 changed files with 14 additions and 13 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: printenv.1,v 1.4 1997/01/09 15:17:31 tls Exp $
.\" $NetBSD: printenv.1,v 1.5 1997/10/19 12:44:21 lukem Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -34,7 +34,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)printenv.1 8.1 (Berkeley) 6/6/93
.\" $NetBSD: printenv.1,v 1.4 1997/01/09 15:17:31 tls Exp $
.\" $NetBSD: printenv.1,v 1.5 1997/10/19 12:44:21 lukem Exp $
.\"
.Dd June 6, 1993
.Dt PRINTENV 1
@ -43,10 +43,10 @@
.Nm printenv
.Nd print out the environment
.Sh SYNOPSIS
.Nm printenv
.Nm
.Op Ar name
.Sh DESCRIPTION
.Nm Printenv
.Nm
prints out the names and values of the variables in the environment,
with one name/value pair per line. If
.Ar name
@ -56,7 +56,7 @@ its value is printed.
If a
.Ar name
is specified and it is not defined in the environment,
.Nm printenv
.Nm
returns exit status 1, else it returns status 0.
.Sh SEE ALSO
.Xr csh 1 ,
@ -64,6 +64,6 @@ returns exit status 1, else it returns status 0.
.Xr environ 7
.Sh HISTORY
The
.Nm printenv
.Nm
command appeared in
.Bx 3.0 .

View File

@ -1,4 +1,4 @@
/* $NetBSD: printenv.c,v 1.5 1997/01/09 15:17:32 tls Exp $ */
/* $NetBSD: printenv.c,v 1.6 1997/10/19 12:44:26 lukem Exp $ */
/*
* Copyright (c) 1987, 1993
@ -33,15 +33,15 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
static char copyright[] =
"@(#) Copyright (c) 1987, 1993\n\
The Regents of the University of California. All rights reserved.\n";
__COPYRIGHT("@(#) Copyright (c) 1987, 1993\n\
The Regents of the University of California. All rights reserved.\n");
#endif /* not lint */
#ifndef lint
/*static char sccsid[] = "from: @(#)printenv.c 8.2 (Berkeley) 5/4/95";*/
static char rcsid[] = "$NetBSD: printenv.c,v 1.5 1997/01/09 15:17:32 tls Exp $";
__RCSID("$NetBSD: printenv.c,v 1.6 1997/10/19 12:44:26 lukem Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -51,7 +51,8 @@ static char rcsid[] = "$NetBSD: printenv.c,v 1.5 1997/01/09 15:17:32 tls Exp $";
#include <string.h>
#include <unistd.h>
void usage __P((void));
int main __P((int, char **));
void usage __P((void));
/*
* printenv
@ -69,7 +70,7 @@ main(argc, argv)
size_t len;
int ch;
while ((ch = getopt(argc, argv, "")) != EOF)
while ((ch = getopt(argc, argv, "")) != -1)
switch(ch) {
case '?':
default: