From e9d1d1e51c845d963178f6406e3bed36add69f94 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Thu, 3 Jul 2014 19:55:57 +0200 Subject: mot-encoder Remove trailing line breaks from DLS --- src/mot-encoder.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/mot-encoder.cpp') diff --git a/src/mot-encoder.cpp b/src/mot-encoder.cpp index 150d59c..ff577a6 100644 --- a/src/mot-encoder.cpp +++ b/src/mot-encoder.cpp @@ -530,6 +530,17 @@ void writeDLS(int output_fd, const char* dls_file, int padlen) dlslen = read(dlsfd, dlstext, MAXDLS); dlstext[dlslen] = 0x00; + + // Remove trailing line breaks from the file + char* endp = dlstext + dlslen; + while ( endp > dlstext && + (*endp == '\0' || *endp == '\n')) { + if (*endp == '\n') { + *endp == '\0'; + } + endp--; + } + fprintf(stderr, "mot-encoder writing DLS text \"%s\"\n", dlstext); create_dls_datagroup(dlstext, padlen); -- cgit v1.2.3