Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/cp Add and document -N: When used with -p, it will not c...



details:   https://anonhg.NetBSD.org/src/rev/994e6036c389
branches:  trunk
changeset: 583629:994e6036c389
user:      elad <elad%NetBSD.org@localhost>
date:      Mon Aug 15 17:13:35 2005 +0000

description:
Add and document -N: When used with -p, it will not copy the file flags.
PR 13645.

diffstat:

 bin/cp/cp.1     |  12 ++++++++----
 bin/cp/cp.c     |  11 +++++++----
 bin/cp/extern.h |   4 ++--
 bin/cp/utils.c  |   6 +++---
 4 files changed, 20 insertions(+), 13 deletions(-)

diffs (138 lines):

diff -r 9bb05286392a -r 994e6036c389 bin/cp/cp.1
--- a/bin/cp/cp.1       Mon Aug 15 10:52:42 2005 +0000
+++ b/bin/cp/cp.1       Mon Aug 15 17:13:35 2005 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: cp.1,v 1.24 2003/08/07 09:05:02 agc Exp $
+.\"    $NetBSD: cp.1,v 1.25 2005/08/15 17:13:35 elad Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993, 1994
 .\"    The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"    @(#)cp.1        8.3 (Berkeley) 4/18/94
 .\"
-.Dd December 18, 2002
+.Dd August 15, 2005
 .Dt CP 1
 .Os
 .Sh NAME
@@ -45,7 +45,7 @@
 .Op Fl H | Fl L | Fl P
 .Oc
 .Op Fl f | i
-.Op Fl pv
+.Op Fl Npv
 .Ar source_file target_file
 .Nm cp
 .Oo
@@ -53,7 +53,7 @@
 .Op Fl H | Fl L | Fl P
 .Oc
 .Op Fl f | i
-.Op Fl pv
+.Op Fl Npv
 .Ar source_file ... target_directory
 .Sh DESCRIPTION
 In the first synopsis form, the
@@ -83,6 +83,10 @@
 If the
 .Fl R
 option is specified, all symbolic links are followed.
+.It Fl N
+When used with
+.Fl p ,
+don't copy file flags.
 .It Fl P
 If the
 .Fl R
diff -r 9bb05286392a -r 994e6036c389 bin/cp/cp.c
--- a/bin/cp/cp.c       Mon Aug 15 10:52:42 2005 +0000
+++ b/bin/cp/cp.c       Mon Aug 15 17:13:35 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cp.c,v 1.36 2005/06/26 19:10:48 christos Exp $ */
+/* $NetBSD: cp.c,v 1.37 2005/08/15 17:13:35 elad Exp $ */
 
 /*
  * Copyright (c) 1988, 1993, 1994
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)cp.c       8.5 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: cp.c,v 1.36 2005/06/26 19:10:48 christos Exp $");
+__RCSID("$NetBSD: cp.c,v 1.37 2005/08/15 17:13:35 elad Exp $");
 #endif
 #endif /* not lint */
 
@@ -85,7 +85,7 @@
 PATH_T to = { to.p_path, empty };
 
 uid_t myuid;
-int Rflag, fflag, iflag, pflag, rflag, vflag; 
+int Rflag, fflag, iflag, pflag, rflag, vflag, Nflag;
 mode_t myumask;
 
 enum op { FILE_TO_FILE, FILE_TO_DIR, DIR_TO_DNE };
@@ -105,7 +105,7 @@
        (void)setlocale(LC_ALL, "");
 
        Hflag = Lflag = Pflag = Rflag = 0;
-       while ((ch = getopt(argc, argv, "HLPRfiprv")) != -1) 
+       while ((ch = getopt(argc, argv, "HLNPRfiprv")) != -1) 
                switch (ch) {
                case 'H':
                        Hflag = 1;
@@ -115,6 +115,9 @@
                        Lflag = 1;
                        Hflag = Pflag = 0;
                        break;
+               case 'N':
+                       Nflag = 1;
+                       break;
                case 'P':
                        Pflag = 1;
                        Hflag = Lflag = 0;
diff -r 9bb05286392a -r 994e6036c389 bin/cp/extern.h
--- a/bin/cp/extern.h   Mon Aug 15 10:52:42 2005 +0000
+++ b/bin/cp/extern.h   Mon Aug 15 17:13:35 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.10 2005/06/26 19:10:48 christos Exp $ */
+/* $NetBSD: extern.h,v 1.11 2005/08/15 17:13:35 elad Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -42,7 +42,7 @@
 
 extern PATH_T to;
 extern uid_t myuid;
-extern int eflag, fflag, iflag, pflag;
+extern int eflag, fflag, iflag, pflag, Nflag;
 extern mode_t myumask;
 
 #include <sys/cdefs.h>
diff -r 9bb05286392a -r 994e6036c389 bin/cp/utils.c
--- a/bin/cp/utils.c    Mon Aug 15 10:52:42 2005 +0000
+++ b/bin/cp/utils.c    Mon Aug 15 17:13:35 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: utils.c,v 1.27 2004/01/04 16:04:18 jschauma Exp $ */
+/* $NetBSD: utils.c,v 1.28 2005/08/15 17:13:35 elad Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)utils.c    8.3 (Berkeley) 4/1/94";
 #else
-__RCSID("$NetBSD: utils.c,v 1.27 2004/01/04 16:04:18 jschauma Exp $");
+__RCSID("$NetBSD: utils.c,v 1.28 2005/08/15 17:13:35 elad Exp $");
 #endif
 #endif /* not lint */
 
@@ -299,7 +299,7 @@
                rval = 1;
        }
 
-       if (!islink) {
+       if (!islink && !Nflag) {
                /*
                 * XXX
                 * NFS doesn't support chflags; ignore errors unless



Home | Main Index | Thread Index | Old Index