X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcc65%2Fcodeseg.c;h=fede7ae6215b12c694a0afd8668e9a77a752aefa;hb=73dfa23c987d8a7f1154801b85c171f9e01dcd58;hp=06260ff3a30c71488968d6afb10057237ab69c7c;hpb=70755921a959d71bbf94f4fc0425cdb3ba26d71c;p=cc65 diff --git a/src/cc65/codeseg.c b/src/cc65/codeseg.c index 06260ff3a..fede7ae62 100644 --- a/src/cc65/codeseg.c +++ b/src/cc65/codeseg.c @@ -39,6 +39,7 @@ /* common */ #include "chartype.h" #include "check.h" +#include "debugflag.h" #include "global.h" #include "hashstr.h" #include "strutil.h" @@ -1281,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 */