* getopt returns -1 not EOF

* cleanup use of .Nm in manpage
This commit is contained in:
lukem 1997-09-14 07:15:25 +00:00
parent aa125494d1
commit df49b6cc7f
2 changed files with 15 additions and 15 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: cp.1,v 1.9 1995/07/25 19:36:45 jtc Exp $ .\" $NetBSD: cp.1,v 1.10 1997/09/14 07:15:25 lukem Exp $
.\" .\"
.\" Copyright (c) 1989, 1990, 1993, 1994 .\" Copyright (c) 1989, 1990, 1993, 1994
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -43,14 +43,14 @@
.Nm cp .Nm cp
.Nd copy files .Nd copy files
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm cp .Nm
.Oo .Oo
.Fl R .Fl R
.Op Fl H | Fl L | Fl P .Op Fl H | Fl L | Fl P
.Oc .Oc
.Op Fl fip .Op Fl fip
.Ar source_file target_file .Ar source_file target_file
.Nm cp .Nm
.Oo .Oo
.Fl R .Fl R
.Op Fl H | Fl L | Fl P .Op Fl H | Fl L | Fl P
@ -59,7 +59,7 @@
.Ar source_file ... target_directory .Ar source_file ... target_directory
.Sh DESCRIPTION .Sh DESCRIPTION
In the first synopsis form, the In the first synopsis form, the
.Nm cp .Nm
utility copies the contents of the utility copies the contents of the
.Ar source_file .Ar source_file
to the to the
@ -71,7 +71,7 @@ is copied to the destination
.Ar target_directory . .Ar target_directory .
The names of the files themselves are not changed. The names of the files themselves are not changed.
If If
.Nm cp .Nm
detects an attempt to copy a file to itself, the copy will fail. detects an attempt to copy a file to itself, the copy will fail.
.Pp .Pp
The following options are available: The following options are available:
@ -93,11 +93,11 @@ option is specified, no symbolic links are followed.
If If
.Ar source_file .Ar source_file
designates a directory, designates a directory,
.Nm cp .Nm
copies the directory and the entire subtree connected at that point. copies the directory and the entire subtree connected at that point.
This option also causes symbolic links to be copied, rather than This option also causes symbolic links to be copied, rather than
indirected through, and for indirected through, and for
.Nm cp .Nm
to create special files rather than copying them as normal files. to create special files rather than copying them as normal files.
Created directories have the same mode as the corresponding source Created directories have the same mode as the corresponding source
directory, unmodified by the process' umask. directory, unmodified by the process' umask.
@ -112,7 +112,7 @@ option is ignored if the
option is specified.) option is specified.)
.It Fl i .It Fl i
Causes Causes
.Nm cp .Nm
to write a prompt to the standard error output before copying a file to write a prompt to the standard error output before copying a file
that would overwrite an existing file. that would overwrite an existing file.
If the response from the standard input begins with the character If the response from the standard input begins with the character
@ -120,7 +120,7 @@ If the response from the standard input begins with the character
the file copy is attempted. the file copy is attempted.
.It Fl p .It Fl p
Causes Causes
.Nm cp .Nm
to preserve in the copy as many of the modification time, access time, to preserve in the copy as many of the modification time, access time,
file flags, file mode, user ID, and group ID as allowed by permissions. file flags, file mode, user ID, and group ID as allowed by permissions.
.Pp .Pp
@ -188,11 +188,11 @@ option is specified.
In addition, these options override each other and the In addition, these options override each other and the
command's actions are determined by the last one specified. command's actions are determined by the last one specified.
.Pp .Pp
.Nm Cp .Nm
exits 0 on success, >0 if an error occurred. exits 0 on success, >0 if an error occurred.
.Sh COMPATIBILITY .Sh COMPATIBILITY
Historic versions of the Historic versions of the
.Nm cp .Nm
utility had a utility had a
.Fl r .Fl r
option. option.
@ -207,7 +207,7 @@ or fifo's.
.Xr symlink 7 .Xr symlink 7
.Sh STANDARDS .Sh STANDARDS
The The
.Nm cp .Nm
utility is expected to be utility is expected to be
.St -p1003.2 .St -p1003.2
compatible. compatible.

View File

@ -1,4 +1,4 @@
/* $NetBSD: cp.c,v 1.18 1997/07/20 05:13:36 thorpej Exp $ */ /* $NetBSD: cp.c,v 1.19 1997/09/14 07:15:28 lukem Exp $ */
/* /*
* Copyright (c) 1988, 1993, 1994 * Copyright (c) 1988, 1993, 1994
@ -47,7 +47,7 @@ __COPYRIGHT(
#if 0 #if 0
static char sccsid[] = "@(#)cp.c 8.5 (Berkeley) 4/29/95"; static char sccsid[] = "@(#)cp.c 8.5 (Berkeley) 4/29/95";
#else #else
__RCSID("$NetBSD: cp.c,v 1.18 1997/07/20 05:13:36 thorpej Exp $"); __RCSID("$NetBSD: cp.c,v 1.19 1997/09/14 07:15:28 lukem Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -111,7 +111,7 @@ main(argc, argv)
char *target; char *target;
Hflag = Lflag = Pflag = Rflag = 0; Hflag = Lflag = Pflag = Rflag = 0;
while ((ch = getopt(argc, argv, "HLPRfipr")) != EOF) while ((ch = getopt(argc, argv, "HLPRfipr")) != -1)
switch (ch) { switch (ch) {
case 'H': case 'H':
Hflag = 1; Hflag = 1;