diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-09-20 17:34:35 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-09-20 17:34:35 +0000 |
commit | 956db731c392f1de63f5993fc1447ddb1af6f5e7 (patch) | |
tree | 45f8c404bdd04ddb9082e71ee5fc39c232cf2971 | |
parent | 01ea88b69998f4289ee5d3222efb57ec76c22031 (diff) |
Don't strip trailing '/' in source, fts(3) now does this for us.
-rw-r--r-- | bin/cp/cp.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/bin/cp/cp.c b/bin/cp/cp.c index dfed11e277f..d390785e235 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cp.c,v 1.9 1997/09/01 18:29:17 deraadt Exp $ */ +/* $OpenBSD: cp.c,v 1.10 1997/09/20 17:34:34 millert Exp $ */ /* $NetBSD: cp.c,v 1.14 1995/09/07 06:14:51 jtc Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)cp.c 8.5 (Berkeley) 4/29/95"; #else -static char rcsid[] = "$OpenBSD: cp.c,v 1.9 1997/09/01 18:29:17 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: cp.c,v 1.10 1997/09/20 17:34:34 millert Exp $"; #endif #endif /* not lint */ @@ -107,7 +107,7 @@ main(argc, argv) struct stat to_stat, tmp_stat; enum op type; int Hflag, Lflag, Pflag, ch, fts_options, r; - char *p, **av; + char *target; Hflag = Lflag = Pflag = Rflag = 0; while ((ch = getopt(argc, argv, "HLPRfipr")) != -1) @@ -179,10 +179,10 @@ main(argc, argv) (void)umask(myumask); /* Save the target base in "to". */ - p = argv[--argc]; - if (strlen(p) >= sizeof(to.p_path)) - errx(1, "%s: name too long", p); - (void)strcpy(to.p_path, p); + target = argv[--argc]; + if (strlen(target) >= sizeof(to.p_path)) + errx(1, "%s: name too long", target); + (void)strcpy(to.p_path, target); to.p_end = to.p_path + strlen(to.p_path); if (to.p_path == to.p_end) { *to.p_end++ = '.'; @@ -194,13 +194,6 @@ main(argc, argv) /* Set end of argument list for fts(3). */ argv[argc] = NULL; - /* Strip trailing slashes from source files */ - for (av = argv; *av != NULL; av++) { - p = *av + strlen(*av); - while (p > *av + 1 && p[-1] == '/') - *--p = '\0'; - } - /* * Cp has two distinct cases: * |