summaryrefslogtreecommitdiff
path: root/usr.bin/rcs
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2019-01-09 17:57:06 +0000
committerJoris Vink <joris@cvs.openbsd.org>2019-01-09 17:57:06 +0000
commite80338a799cccbbb67de94c25fc54abbce278716 (patch)
tree54758a754bd64e555efe7ded38198ebc0dddeed4 /usr.bin/rcs
parent3b059c343d522391b4d6c78dac90e823797e1e5f (diff)
When expanding $Log$ make sure a newline is added if rd_log has none.
This can happen on new RCS files. Fixes $Log$ keyword expansion.
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r--usr.bin/rcs/rcs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c
index f4aca8cd97c..30415b9de17 100644
--- a/usr.bin/rcs/rcs.c
+++ b/usr.bin/rcs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.87 2019/01/09 17:55:28 joris Exp $ */
+/* $OpenBSD: rcs.c,v 1.88 2019/01/09 17:57:05 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1672,6 +1672,10 @@ rcs_expand_keywords(char *rcsfile_in, struct rcs_delta *rdp, BUF *bp, int mode)
++j;
buf_append(newbuf, rdp->rd_log + i, j);
}
+
+ if (i > 0 && rdp->rd_log[i - 1] != '\n')
+ buf_putc(newbuf, '\n');
+
buf_append(newbuf, line, line2 - line);
for (j = 0; c + j < fin; ++j) {
if (c[j] != ' ')