From: cuz Date: Tue, 7 Jan 2003 21:45:20 +0000 (+0000) Subject: Fixed a problem with line continuations and -T X-Git-Tag: V2.12.0~1790 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0293cc4bc0ff91e3c3634d4b6ae94bb8a45a3272;p=cc65 Fixed a problem with line continuations and -T git-svn-id: svn://svn.cc65.org/cc65/trunk@1893 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- 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 */