From 60e35b79ccf80de83200eca145942a6d0d1abc69 Mon Sep 17 00:00:00 2001 From: simonb Date: Mon, 29 Dec 2003 02:01:27 +0000 Subject: [PATCH] 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. --- usr.bin/xinstall/install.1 | 14 ++++++-------- usr.bin/xinstall/xinstall.c | 12 ++++-------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/usr.bin/xinstall/install.1 b/usr.bin/xinstall/install.1 index 46ddbc42acf2..de59ce8c422d 100644 --- a/usr.bin/xinstall/install.1 +++ b/usr.bin/xinstall/install.1 @@ -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 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)install.1 8.1 (Berkeley) 6/6/93 .\" -.Dd December 21, 2002 +.Dd December 29, 2003 .Dt INSTALL 1 .Os .Sh NAME @@ -144,9 +144,8 @@ .Ek .Ar directory ...\& .Sh DESCRIPTION -The file(s) are moved (copied if the -.Fl c -option is specified, or linked if the +The file(s) are copied +(or linked if the .Fl l option is specified) to the target file or directory. 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. .It Fl c Copy the file. -This flag turns off the default behavior of -.Nm -where it deletes the original file after creating the target. +This is the default behavior; the flag is maintained for backwards +compatibility only. .It Fl d Create directories. Missing parent directories are created as required. diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index bd49a6028ba3..bc7e6a159783 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -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 @@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\n\ #if 0 static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93"; #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 /* 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 BACKUP_SUFFIX ".old" -int dobackup, docopy, dodir, dostrip, dolink, dopreserve, dorename, - dounpriv; +int dobackup, dodir, dostrip, dolink, dopreserve, dorename, dounpriv; int numberedbackup; int mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; char pathbuf[MAXPATHLEN]; @@ -160,7 +159,7 @@ main(int argc, char *argv[]) dobackup = 1; break; case 'c': - docopy = 1; + /* ignored; was "docopy" which is now the default. */ break; case 'd': dodir = 1; @@ -672,9 +671,6 @@ install(char *from_name, char *to_name, u_int flags) 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 * flags, except for the dump flag.