diff --git a/mm_io.cpp b/mm_io.cpp index c223e960d..e0cb38934 100644 --- a/mm_io.cpp +++ b/mm_io.cpp @@ -272,6 +272,18 @@ string mm_io_c::getline() { #endif +size_t mm_io_c::writeline_unix_newlines(const char *s) { + int i; + size_t bytes_written; + + bytes_written = 0; + for (i = 0; i < strlen(s); i++) + if (s[i] != '\r') + bytes_written += write(&s[i], 1); + + return bytes_written; +} + /* * Dummy class for output to /dev/null. Needed for two pass stuff. */ diff --git a/mm_io.h b/mm_io.h index c521911e2..40377329b 100644 --- a/mm_io.h +++ b/mm_io.h @@ -48,6 +48,7 @@ public: virtual bool eof(); virtual char *gets(char *buffer, size_t max_size); virtual string getline(); + virtual size_t writeline_unix_newlines(const char *s); }; class mm_null_io_c: public mm_io_c {