Deleted Added
full compact
cp.c (163233) cp.c (174890)
1/*-
2 * Copyright (c) 1988, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * David Hitz of Auspex Systems Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 28 unchanged lines hidden (view full) ---

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41static char sccsid[] = "@(#)cp.c 8.2 (Berkeley) 4/1/94";
42#endif /* not lint */
43#endif
44#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1988, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * David Hitz of Auspex Systems Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 28 unchanged lines hidden (view full) ---

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41static char sccsid[] = "@(#)cp.c 8.2 (Berkeley) 4/1/94";
42#endif /* not lint */
43#endif
44#include <sys/cdefs.h>
45__FBSDID("$FreeBSD: head/bin/cp/cp.c 163233 2006-10-11 10:26:34Z trhodes $");
45__FBSDID("$FreeBSD: head/bin/cp/cp.c 174890 2007-12-25 00:40:32Z edwin $");
46
47/*
48 * Cp copies source files to target files.
49 *
50 * The global PATH_T structure "to" always contains the path to the
51 * current target file. Since fts(3) does not change directories,
52 * this path can be either absolute or dot-relative.
53 *

--- 152 unchanged lines hidden (view full) ---

206 r = stat(to.p_path, &to_stat);
207 if (r == -1 && errno != ENOENT)
208 err(1, "%s", to.p_path);
209 if (r == -1 || !S_ISDIR(to_stat.st_mode)) {
210 /*
211 * Case (1). Target is not a directory.
212 */
213 if (argc > 1) {
46
47/*
48 * Cp copies source files to target files.
49 *
50 * The global PATH_T structure "to" always contains the path to the
51 * current target file. Since fts(3) does not change directories,
52 * this path can be either absolute or dot-relative.
53 *

--- 152 unchanged lines hidden (view full) ---

206 r = stat(to.p_path, &to_stat);
207 if (r == -1 && errno != ENOENT)
208 err(1, "%s", to.p_path);
209 if (r == -1 || !S_ISDIR(to_stat.st_mode)) {
210 /*
211 * Case (1). Target is not a directory.
212 */
213 if (argc > 1) {
214 usage();
214 warnx("Target is not a directory");
215 exit(1);
216 }
217 /*
218 * Need to detect the case:
219 * cp -R dir foo
220 * Where dir is a directory and foo does not exist, where
221 * we want pathname concatenations turned on but not for
222 * the initial mkdir().

--- 293 unchanged lines hidden ---
215 exit(1);
216 }
217 /*
218 * Need to detect the case:
219 * cp -R dir foo
220 * Where dir is a directory and foo does not exist, where
221 * we want pathname concatenations turned on but not for
222 * the initial mkdir().

--- 293 unchanged lines hidden ---