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-31 10:18:41 +0100
commit611097d091c19b93c62ac113f50f0aa7899ce2f2 (patch)
tree22ec125c904dc0a7d99c5d4128c0fe6ba8ce7aff
parentc1666ce6eff49f7062134fa33aa8c45c3c8079b6 (diff)
downloadpaludis-611097d091c19b93c62ac113f50f0aa7899ce2f2.tar.gz
paludis-611097d091c19b93c62ac113f50f0aa7899ce2f2.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 a5266e6fb..d976caf7d 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