diff options
author | michaels <michaels@cvs.openbsd.org> | 1997-04-12 17:30:24 +0000 |
---|---|---|
committer | michaels <michaels@cvs.openbsd.org> | 1997-04-12 17:30:24 +0000 |
commit | 46000ad1d2ad2d7d099402459dbe1db5b0c2772c (patch) | |
tree | 709d0e894fdc3353d4e1370747dae0affc2cb553 /bin/mv/mv.c | |
parent | 61619bcb95ca78d1e65039ffb283aefddd8d0da8 (diff) |
don't print more directory slashes than user specified on error.
Reported by Nick Sayer (nsayer@quack.kfu.com) in FreeBSD pr bin/3025.
Diffstat (limited to 'bin/mv/mv.c')
-rw-r--r-- | bin/mv/mv.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/bin/mv/mv.c b/bin/mv/mv.c index 9e089da3f5d..88c89bfc025 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mv.c,v 1.7 1997/03/01 20:43:51 millert Exp $ */ +/* $OpenBSD: mv.c,v 1.8 1997/04/12 17:30:23 michaels Exp $ */ /* $NetBSD: mv.c,v 1.9 1995/03/21 09:06:52 cgd Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)mv.c 8.2 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: mv.c,v 1.7 1997/03/01 20:43:51 millert Exp $"; +static char rcsid[] = "$OpenBSD: mv.c,v 1.8 1997/04/12 17:30:23 michaels Exp $"; #endif #endif /* not lint */ @@ -123,8 +123,10 @@ main(argc, argv) (void)strcpy(path, argv[argc - 1]); baselen = strlen(path); endp = &path[baselen]; - *endp++ = '/'; - ++baselen; + if (*(endp - 1) != '/') { + *endp++ = '/'; + ++baselen; + } for (rval = 0; --argc; ++argv) { if ((p = strrchr(*argv, '/')) == NULL) p = *argv; |