=================================================================== RCS file: /cvs/texi2mdoc/util.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -p -r1.8 -r1.9 --- texi2mdoc/util.c 2015/02/23 11:56:39 1.8 +++ texi2mdoc/util.c 2015/02/23 14:36:03 1.9 @@ -1,4 +1,4 @@ -/* $Id: util.c,v 1.8 2015/02/23 11:56:39 kristaps Exp $ */ +/* $Id: util.c,v 1.9 2015/02/23 14:36:03 kristaps Exp $ */ /* * Copyright (c) 2015 Kristaps Dzonsons * @@ -190,6 +190,21 @@ texiputchars(struct texi *p, const char *s) while ('\0' != *s) texiputchar(p, *s++); +} + +/* + * This puts all characters onto the output stream but makes sure to + * escape mdoc(7) slashes. + */ +void +texiputbuf(struct texi *p, const char *buf, size_t start, size_t end) +{ + + for ( ; start < end; start++) { + texiputchar(p, buf[start]); + if ('\\' == buf[start]) + texiputchar(p, 'e'); + } } /*