This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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);
    }
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]