summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/buf.c
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1996-09-22 02:28:36 +0000
committersteve <steve@FreeBSD.org>1996-09-22 02:28:36 +0000
commita43b707795a51c0af5320d933cbf0d274a3661b4 (patch)
treea2c9ef65b1d82123e4257224bc26b25928f7c74a /usr.bin/make/buf.c
parent29accf9e0f060860daa99411dc2966ee23229fb5 (diff)
downloadFreeBSD-src-a43b707795a51c0af5320d933cbf0d274a3661b4.zip
FreeBSD-src-a43b707795a51c0af5320d933cbf0d274a3661b4.tar.gz
Fix for PR# 1095, make's continuation line handling buggy
when used with .elif. Additional fixes include: - fix continuation line handling when using .for - plug up a memory leak
Diffstat (limited to 'usr.bin/make/buf.c')
-rw-r--r--usr.bin/make/buf.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/usr.bin/make/buf.c b/usr.bin/make/buf.c
index a4ecaf6..68315e7 100644
--- a/usr.bin/make/buf.c
+++ b/usr.bin/make/buf.c
@@ -434,3 +434,28 @@ Buf_Destroy (buf, freeData)
}
free ((char *)buf);
}
+
+/*-
+ *-----------------------------------------------------------------------
+ * Buf_ReplaceLastByte --
+ * Replace the last byte in a buffer.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * If the buffer was empty intially, then a new byte will be added.
+ * Otherwise, the last byte is overwritten.
+ *
+ *-----------------------------------------------------------------------
+ */
+void
+Buf_ReplaceLastByte (buf, byte)
+ Buffer buf; /* buffer to augment */
+ Byte byte; /* byte to be written */
+{
+ if (buf->inPtr == buf->outPtr)
+ Buf_AddByte(buf, byte);
+ else
+ *(buf->inPtr - 1) = byte;
+}
OpenPOWER on IntegriCloud