diff options
author | 2003-07-21 23:02:35 +0000 | |
---|---|---|
committer | 2003-07-21 23:02:35 +0000 | |
commit | 37e8779f86d73af68c0ee95dca64b18732a5f34a (patch) | |
tree | 3df34eb9821b9c23d5d4930a6d8949e241524e50 /usr.bin/diff | |
parent | Fix printing of status when not in -l mode which was broken when the (diff) | |
download | wireguard-openbsd-37e8779f86d73af68c0ee95dca64b18732a5f34a.tar.xz wireguard-openbsd-37e8779f86d73af68c0ee95dca64b18732a5f34a.zip |
Don't print a trailing '/' in foo when printing "Only in foo: bar"
Diffstat (limited to 'usr.bin/diff')
-rw-r--r-- | usr.bin/diff/diff.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c index 149259e178a..e0be80890f1 100644 --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.31 2003/07/21 22:57:16 millert Exp $ */ +/* $OpenBSD: diff.c,v 1.32 2003/07/21 23:02:35 millert Exp $ */ /* * Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com> @@ -21,7 +21,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: diff.c,v 1.31 2003/07/21 22:57:16 millert Exp $"; +static const char rcsid[] = "$OpenBSD: diff.c,v 1.32 2003/07/21 23:02:35 millert Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -312,7 +312,9 @@ print_status(int val, char *path1, char *path2, char *entry) { switch (val) { case D_ONLY: - printf("Only in %s: %s\n", path1, entry); + /* must strip off the trailing '/' */ + printf("Only in %.*s: %s\n", (int)(strlen(path1) - 1), + path1, entry); break; case D_COMMON: printf("Common subdirectories: %s%s and %s%s\n", |