X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcc65%2Fcodeseg.c;h=fede7ae6215b12c694a0afd8668e9a77a752aefa;hb=c130e597b013e37c94afd6651be1e8859ba7e5ac;hp=ec229880cd5f57161a257a1bfff788987322a16a;hpb=abcc981253f0889cbfb2d6784562a4466ea9cb6e;p=cc65 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 */