Commit graph

28 commits

Author SHA1 Message Date
Warner Losh 5a52e3d00d cp: Add -N flag, inspired by NetBSD's similar flag
Add -N to supress copying of file flags when -p is specified (explicitly
or implicitly). Often times we don't care about the flags or wish to be
able to copy to NFS, and this comes in handy for that. FreeBSD's and
NetBSD's cp are somewhat different, so I had to reimplement all but one
of the patch hunks...

Obtained from:		NetBSD (cp.1 1.25, cp.c 1.37, utils.c 1.28 by elad)
Sponsored by:		Netflix

Differential Revision:	https://reviews.freebsd.org/D42673
2023-12-07 13:36:44 -07:00
Warner Losh 90aea514c6 bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2023-11-26 22:23:28 -07:00
Warner Losh 42b388439b Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:23 -06:00
Alfonso Gregory e97468063d Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:17 -06:00
Pedro F. Giffuni 8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Warner Losh fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Bryan Drewery 7ea2450f42 Implement '-s' to copy as symlink, similar to the current -l link(2) handling.
This is also implemented in at least GNU coreutils cp.

While here also improve the '-l' handling to not open(2) the source file as
it does not actually need the descriptor.

Sponsored by:	EMC / Isilon Storage Division
2015-06-07 06:30:25 +00:00
Julian Elischer 6fa363774d Add an option to allow copying of a hierarchy while linking he regular files.
Bikeshedded to death on: hackers
Submitted by:andersonatcenttech.com
MFC in: 1 month
2006-08-24 20:45:38 +00:00
Christian S.J. Peron 9b4261c9b4 Attempt to complete the userspace integration of POSIX.1e extended ACLs.
This includes adding support for ACLs into cp(1) and mv(1) userspace
utilities.

For mv(1), if _PC_ACL_EXTENDED is in effect for the source AND destination
operands, the destination file's ACLs shall reflect the source.

For cp(1), if _PC_ACL_EXTENDED is in effect for both source and destination
operands, and -p has been specified, the ACLs from the source shall be
preserved on the destination.

MFC after:	1 month
2005-09-05 04:36:08 +00:00
Mark Murray 6195fb4102 Remove clause 3 from the UCB licenses.
OK'ed by:	imp, core
2004-04-06 20:06:54 +00:00
Matthew N. Dodd 947193d93f Use the correct data type and qualifier for signal flag. 2003-04-07 12:09:17 +00:00
Matthew N. Dodd 00d321a2b3 Add a SIGINFO handler. 2003-04-07 11:00:56 +00:00
Mark Murray ba8acd9de2 Constify and staticify for lint. 2002-10-18 14:45:00 +00:00
Johan Karlsson 786c276fe4 Add the -n option, which automatically answers "no" to the overwrite question.
PR:		7828
Suggested by:	Daniel O'Connor <doconnor@gsoft.com.au>
Approved by:	sheldonh (mentor)
MFC after:	2 weeks
2002-07-23 00:42:56 +00:00
Bruce Evans b909fa9cd0 Fixed some style bugs in revs 1.1 and 1.4. 2002-02-23 17:05:32 +00:00
Mark Murray 8bd08b5fac Fix warnings inspired by lint, a commercial lint and WARNS=4. 2002-02-22 21:24:14 +00:00
Warner Losh 5dce647c1b Modernization effort for bin/c*:
o __P has been reoved
  o Old-style K&R declarations have been converted to new C89 style
  o register has been removed
  o prototype for main() has been removed (gcc3 makes it an error)
  o int main(int argc, char *argv[]) is the preferred main definition.
  o Attempt to not break style(9) conformance for declarations more than
    they already are.

  Approved by: arch@, new style(9)
2002-02-02 06:15:22 +00:00
Bruce Evans e1d071dbfd Removed the broken code which claimed to lose the set[ug]id bits in
the !(pflag && setfile()) case for regular files unless the copy is
owned by the same user and group.  These bits have already been lost
(or never gained) in the correct way.  The code didn't actually lose
the bits; it depended on them being lost already (apparently in all
cases) and attempted to gain them as necessary, but it often gained
them (and sometimes collateral bits) when wrong:
- pflag && setfile() == 0 case (i.e., for a successful cp -p):
  setfile() copies all the attributes as correctly as possible (as
  specified by POSIX), and we sometimes messed up the up the mode by
  setting it again.  Also, if the file is immutable, then setting the
  mode again gave spurious errors (PR 20646).
- !pflag case.  If the target is created, POSIX requires it to not
  have the set[ug]id bits, but we sometimes copied them from the source.
  If the target already exists, POSIX requires its mode to be unchanged,
  but we sometimes copied the whole mode from the source.

PR:		20646
MFC after:	4 weeks
2001-06-11 13:57:54 +00:00
Warner Losh 34f9c106b9 Migrate from using MAXPATHLEN to MAX_PATH. Use strlcpy to copy the
strings.
2001-05-16 19:10:40 +00:00
Peter Wemm 2a4562393f $Id$ -> $FreeBSD$ 1999-08-27 23:15:48 +00:00
Michael Haro 4506e9078e Add a verbose mode to show what files are being copied.
Idea taken from obrien.

Reviewed by:	obrien
1999-08-26 02:44:56 +00:00
Peter Wemm b97fa2ef50 Revert $FreeBSD$ to $Id$ 1997-02-22 14:13:04 +00:00
Jordan K. Hubbard 1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Wolfram Schneider 6add522f93 Option -f implemented (remove + create)
option -f and -i are exclusive
respond `Y' is equal to `y'
fix usage string
remove isatty(3) check

Reviewed by:	pst
1996-03-08 06:58:08 +00:00
Wolfram Schneider d7e0e5ca0f delete my last commit
Submitted by:	pst, ache
1996-02-19 00:44:19 +00:00
Wolfram Schneider d6ea04ccf4 Option -f implemented (remove + create)
option -f and -i are exclusive
all flag variables initialized with zero
respond `Y' is equal to `y'
update usage string
1996-02-18 18:48:26 +00:00
David Greenman 89730b290a Added $Id$ 1994-09-24 02:59:15 +00:00
Rodney W. Grimes 4b88c807ea BSD 4.4 Lite bin Sources 1994-05-26 06:18:55 +00:00