Check the last byte for '\n'

From-SVN: r107492
This commit is contained in:
Bruce Korb 2005-11-25 05:57:10 +00:00 committed by Bruce Korb
parent f375f46240
commit 66f788b0b3
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2005-11-24 Bruce Korb <bkorb@gnu.org>
* fixincl.c(write_replacement) "here strings" in AutoGen often/generally
don't have a terminating newline. Check the last byte for '\n'.
2005-11-13 Andreas Jaeger <aj@suse.de>
* check.tpl: Handle CVS additionally.

View File

@ -1202,7 +1202,10 @@ write_replacement (tFixDesc* p_fixd)
{
FILE* out_fp = create_file ();
fputs (pz_text, out_fp);
size_t sz = strlen (pz_text);
fwrite (pz_text, sz, 1, out_fp);
if (pz_text[ sz-1 ] != '\n')
fputc ('\n', out_fp);
fclose (out_fp);
}
}