Make "copy the file" (the -c option) the default behaviour. The -c option

is kept for backwards compatibility but now has no effect.

Patch from Bruce Nourish in PR bin/23874, with some minor changes by me.
This commit is contained in:
simonb 2003-12-29 02:01:27 +00:00
parent 5c83b03a81
commit 60e35b79cc
2 changed files with 10 additions and 16 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: install.1,v 1.38 2003/08/07 11:17:50 agc Exp $ .\" $NetBSD: install.1,v 1.39 2003/12/29 02:01:27 simonb Exp $
.\" .\"
.\" Copyright (c) 1987, 1990, 1993 .\" Copyright (c) 1987, 1990, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\" .\"
.\" @(#)install.1 8.1 (Berkeley) 6/6/93 .\" @(#)install.1 8.1 (Berkeley) 6/6/93
.\" .\"
.Dd December 21, 2002 .Dd December 29, 2003
.Dt INSTALL 1 .Dt INSTALL 1
.Os .Os
.Sh NAME .Sh NAME
@ -144,9 +144,8 @@
.Ek .Ek
.Ar directory ...\& .Ar directory ...\&
.Sh DESCRIPTION .Sh DESCRIPTION
The file(s) are moved (copied if the The file(s) are copied
.Fl c (or linked if the
option is specified, or linked if the
.Fl l .Fl l
option is specified) to the target file or directory. option is specified) to the target file or directory.
If the destination is a directory, then the If the destination is a directory, then the
@ -205,9 +204,8 @@ The counter used starts from 0, and the first available name resulting
from the expansion is used. from the expansion is used.
.It Fl c .It Fl c
Copy the file. Copy the file.
This flag turns off the default behavior of This is the default behavior; the flag is maintained for backwards
.Nm compatibility only.
where it deletes the original file after creating the target.
.It Fl d .It Fl d
Create directories. Create directories.
Missing parent directories are created as required. Missing parent directories are created as required.

View File

@ -1,4 +1,4 @@
/* $NetBSD: xinstall.c,v 1.82 2003/12/16 20:51:57 heas Exp $ */ /* $NetBSD: xinstall.c,v 1.83 2003/12/29 02:01:27 simonb Exp $ */
/* /*
* Copyright (c) 1987, 1993 * Copyright (c) 1987, 1993
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93"; static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93";
#else #else
__RCSID("$NetBSD: xinstall.c,v 1.82 2003/12/16 20:51:57 heas Exp $"); __RCSID("$NetBSD: xinstall.c,v 1.83 2003/12/29 02:01:27 simonb Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -76,8 +76,7 @@ __RCSID("$NetBSD: xinstall.c,v 1.82 2003/12/16 20:51:57 heas Exp $");
#define STRIP_ARGS_MAX 32 #define STRIP_ARGS_MAX 32
#define BACKUP_SUFFIX ".old" #define BACKUP_SUFFIX ".old"
int dobackup, docopy, dodir, dostrip, dolink, dopreserve, dorename, int dobackup, dodir, dostrip, dolink, dopreserve, dorename, dounpriv;
dounpriv;
int numberedbackup; int numberedbackup;
int mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; int mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
char pathbuf[MAXPATHLEN]; char pathbuf[MAXPATHLEN];
@ -160,7 +159,7 @@ main(int argc, char *argv[])
dobackup = 1; dobackup = 1;
break; break;
case 'c': case 'c':
docopy = 1; /* ignored; was "docopy" which is now the default. */
break; break;
case 'd': case 'd':
dodir = 1; dodir = 1;
@ -672,9 +671,6 @@ install(char *from_name, char *to_name, u_int flags)
to_name = oto_name; to_name = oto_name;
} }
if (!docopy && !devnull && unlink(from_name))
err(1, "%s: unlink", from_name);
/* /*
* If provided a set of flags, set them, otherwise, preserve the * If provided a set of flags, set them, otherwise, preserve the
* flags, except for the dump flag. * flags, except for the dump flag.