Index: client.c =================================================================== RCS file: /cvs/obsd/src/gnu/usr.bin/cvs/src/client.c,v retrieving revision 1.14 diff -u -p -u -p -r1.14 client.c --- client.c 21 Aug 2017 16:45:13 -0000 1.14 +++ client.c 3 Nov 2017 04:49:26 -0000 @@ -3385,6 +3385,13 @@ struct response responses[] = RSP_LINE("E", handle_e, response_type_normal, rs_essential), RSP_LINE("F", handle_f, response_type_normal, rs_optional), RSP_LINE("MT", handle_mt, response_type_normal, rs_optional), + /* + * Log message marker. + * Programs which parse rlog output need this feature so to correctly + * parse user-entered, free-form text in the commit messages. + * CVS client doesn't, so fliter it through handle_m. + */ + RSP_LINE("LOGM", handle_m, response_type_normal, rs_optional), /* Possibly should be response_type_error. */ RSP_LINE(NULL, NULL, response_type_normal, rs_essential) Index: cvs.h =================================================================== RCS file: /cvs/obsd/src/gnu/usr.bin/cvs/src/cvs.h,v retrieving revision 1.28 diff -u -p -u -p -r1.28 cvs.h --- cvs.h 3 Dec 2013 01:32:49 -0000 1.28 +++ cvs.h 3 Nov 2017 04:49:26 -0000 @@ -907,5 +907,6 @@ extern void cvs_outerr PROTO ((const cha extern void cvs_flusherr PROTO ((void)); extern void cvs_flushout PROTO ((void)); extern void cvs_output_tagged PROTO ((char *, char *)); +extern void cvs_output_logm PROTO ((const char *, size_t)); extern char *global_session_id; Index: log.c =================================================================== RCS file: /cvs/obsd/src/gnu/usr.bin/cvs/src/log.c,v retrieving revision 1.4 diff -u -p -u -p -r1.4 log.c --- log.c 20 Jan 2017 00:52:49 -0000 1.4 +++ log.c 3 Nov 2017 04:49:26 -0000 @@ -1586,9 +1586,7 @@ log_version (log_data, revlist, rcs, ver { /* FIXME: Technically, the log message could contain a null byte. */ - cvs_output (p->data, 0); - if (p->data[strlen (p->data) - 1] != '\n') - cvs_output ("\n", 1); + cvs_output_logm (p->data, 0); } } Index: server.c =================================================================== RCS file: /cvs/obsd/src/gnu/usr.bin/cvs/src/server.c,v retrieving revision 1.38 diff -u -p -u -p -r1.38 server.c --- server.c 14 Apr 2017 19:39:59 -0000 1.38 +++ server.c 3 Nov 2017 04:49:26 -0000 @@ -6771,3 +6771,46 @@ cvs_output_tagged (tag, text) cvs_output (text, 0); } } + +void +cvs_output_logm (str, len) + const char *str; + size_t len; +{ +#ifdef SERVER_SUPPORT + const char *p; + size_t n; + struct buffer *buf; + + if (!server_active || !supported_response ("LOGM")) + return cvs_output (str, len); + + if (error_use_protocol) + buf = buf_to_net; + else + buf = protocol; + + if (len == 0) + len = strlen (str); + + for (; p = strchr(str, '\n'); str = p + 1) + { + n = p - str + 1; + buf_output0 (buf, "LOGM "); + buf_output (buf, str, n); + len -= n; + } + if (len > 0) + { + buf_output0 (buf, "LOGM "); + buf_output (buf, str, len); + buf_output (buf, "\n", 1); + } + + if (!error_use_protocol) + buf_send_counted (protocol); + +#else /* !SERVER_SUPPORT */ + cvs_output (str, len); +#endif +}