From 0293cc4bc0ff91e3c3634d4b6ae94bb8a45a3272 Mon Sep 17 00:00:00 2001 From: cuz Date: Tue, 7 Jan 2003 21:45:20 +0000 Subject: [PATCH] Fixed a problem with line continuations and -T git-svn-id: svn://svn.cc65.org/cc65/trunk@1893 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/codeseg.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/cc65/codeseg.c b/src/cc65/codeseg.c index ec229880c..fede7ae62 100644 --- a/src/cc65/codeseg.c +++ b/src/cc65/codeseg.c @@ -1282,9 +1282,21 @@ void CS_Output (const CodeSeg* S, FILE* F) /* Line info has changed, remember the new line info */ LI = E->LI; - /* Add the source line as a comment */ + /* Add the source line as a comment. Beware: When line continuation + * was used, the line may contain newlines. + */ if (AddSource) { - fprintf (F, ";\n; %s\n;\n", LI->Line); + const char* L = LI->Line; + fputs (";\n; ", F); + while (*L) { + if (*L == '\n') { + fputs ("\n; ", F); + } else { + fputc (*L, F); + } + ++L; + } + fputs ("\n;\n", F); } /* Add line debug info */ -- 2.39.5