diff options
author | Thomas White <taw@physics.org> | 2016-09-12 17:33:39 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2016-09-12 17:34:09 +0200 |
commit | 2e659056eb10ae76308eef8a5e4f68f000030d04 (patch) | |
tree | b556e50bf97cac2fe4c5d741823e703751e2d881 /libcrystfel/src | |
parent | bfb07b9abbd12deb8fa6c8a730c018604fd620a7 (diff) |
Add newline at end of geometry file in stream, if not already present
Diffstat (limited to 'libcrystfel/src')
-rw-r--r-- | libcrystfel/src/stream.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index ba49ebb0..d374a3d3 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -1598,6 +1598,7 @@ void write_geometry_file(Stream *st, const char *geom_filename) { char line[2014]; FILE *geom_fh; char *rval; + int eol; if ( geom_filename == NULL ) return; @@ -1612,8 +1613,14 @@ void write_geometry_file(Stream *st, const char *geom_filename) { do { rval = fgets(line, 1023, geom_fh); if ( rval != NULL ) fputs(line, st->fh); + eol = ( line[strlen(line)-1] == '\n' ); } while ( rval != NULL ); + + if ( !eol ) { + fprintf(st->fh, "\n"); + } + fclose(geom_fh); fprintf(st->fh, GEOM_END_MARKER"\n"); |