This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, committed] make sure fixincl created files end with newline
- From: Bruce Korb <bkorb at gnu dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 24 Nov 2005 21:56:33 -0800
- Subject: [PATCH, committed] make sure fixincl created files end with newline
2005-11-24 Bruce Korb <bkorb@gnu.org>
* fixincl.c(write_replacement) "here strings" in AutoGen often/generally don't
have a terminating newline. This will check the last byte for '\n'.
Index: fixincl.c
===================================================================
--- fixincl.c (revision 107490)
+++ fixincl.c (working copy)
@@ -1202,7 +1202,10 @@
{
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);
}
}