aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-30 09:30:52 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-30 10:10:24 +0100
commit6b9a82479ce2bfd7b0b96d04f7d1baa9cded2212 (patch)
tree6ab630518940eb8771ad2787611bce7175e51d8a
parent416ca35e601c5a3995e3982803400bcb65d4fc9d (diff)
downloadpaludis-6b9a82479ce2bfd7b0b96d04f7d1baa9cded2212.tar.gz
paludis-6b9a82479ce2bfd7b0b96d04f7d1baa9cded2212.tar.xz
Better man page escaping
-rw-r--r--paludis/args/man.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/paludis/args/man.cc b/paludis/args/man.cc
index a5266e6..d976caf 100644
--- a/paludis/args/man.cc
+++ b/paludis/args/man.cc
@@ -472,7 +472,15 @@ namespace
{
void escape(std::ostream & stream, const std::string & s)
{
- for (std::string::const_iterator t(s.begin()), t_end(s.end()); t != t_end; ++t)
+ auto t(s.begin()), t_end(s.end());
+
+ if (t != t_end && *t == '\'')
+ {
+ stream << "\\'";
+ ++t;
+ }
+
+ for ( ; t != t_end ; ++t)
{
if ('\\' == *t)
stream << '\\';
@@ -634,7 +642,8 @@ ManWriter::start_notes()
void
ManWriter::note(const std::string & s)
{
- _os << s << endl << endl;
+ escape(_os, s);
+ _os << endl << endl;
}
void