diff options
author | gavin <gavin@FreeBSD.org> | 2010-01-17 09:37:31 +0000 |
---|---|---|
committer | gavin <gavin@FreeBSD.org> | 2010-01-17 09:37:31 +0000 |
commit | b89a432ee1889ec29b188c301b5171234c9247bc (patch) | |
tree | 73f412a60e3f3b398602ff339d9c2ead04632a9c /bin/cp/cp.c | |
parent | a59ae58903333ab970f619900c812a3159a80a37 (diff) | |
download | FreeBSD-src-b89a432ee1889ec29b188c301b5171234c9247bc.zip FreeBSD-src-b89a432ee1889ec29b188c301b5171234c9247bc.tar.gz |
Implement an "-x" option to cp(1), for compatibility with Linux and
feature parity with du(1) and similar: When set, cp(1) will not traverse
mount points.
Initial patch by: Graham J Lee leeg teaching.physics.ox.ac.uk
PR: bin/88056
Initial patch by: Graham J Lee leeg teaching.physics.ox.ac.uk
Approved by: ed (mentor)
MFC after: 1 month
Diffstat (limited to 'bin/cp/cp.c')
-rw-r--r-- | bin/cp/cp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/cp/cp.c b/bin/cp/cp.c index feba50f..0ae57eb 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -101,8 +101,9 @@ main(int argc, char *argv[]) int Hflag, Lflag, Pflag, ch, fts_options, r, have_trailing_slash; char *target; + fts_options = FTS_NOCHDIR | FTS_PHYSICAL; Hflag = Lflag = Pflag = 0; - while ((ch = getopt(argc, argv, "HLPRafilnprv")) != -1) + while ((ch = getopt(argc, argv, "HLPRafilnprvx")) != -1) switch (ch) { case 'H': Hflag = 1; @@ -150,6 +151,9 @@ main(int argc, char *argv[]) case 'v': vflag = 1; break; + case 'x': + fts_options |= FTS_XDEV; + break; default: usage(); break; @@ -160,7 +164,6 @@ main(int argc, char *argv[]) if (argc < 2) usage(); - fts_options = FTS_NOCHDIR | FTS_PHYSICAL; if (Rflag && rflag) errx(1, "the -R and -r options may not be specified together"); if (rflag) |