summaryrefslogtreecommitdiffstats
path: root/src/config.l
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2003-02-23 20:49:55 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2003-02-23 20:49:55 (GMT)
commit448b28836eb910f95e2f1903b4dea5eb8548e424 (patch)
tree4163d92b8a5b2126fe8413cc21df8eb3f247dbfa /src/config.l
parent067ee3cfc7a79acd42cedb3f89713b9ed5f47f93 (diff)
downloadDoxygen-448b28836eb910f95e2f1903b4dea5eb8548e424.zip
Doxygen-448b28836eb910f95e2f1903b4dea5eb8548e424.tar.gz
Doxygen-448b28836eb910f95e2f1903b4dea5eb8548e424.tar.bz2
Doxygen-1.3-rc3-20030223
Diffstat (limited to 'src/config.l')
-rw-r--r--src/config.l27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/config.l b/src/config.l
index fcc2f5b..dfc763f 100644
--- a/src/config.l
+++ b/src/config.l
@@ -104,14 +104,26 @@ void ConfigOption::writeStringValue(QTextStream &t,QCString &s)
{
const char *p=s.data();
char c;
- bool hasBlanks=FALSE;
+ bool needsEscaping=FALSE;
if (p)
{
- while ((c=*p++)!=0 && !hasBlanks) hasBlanks = (c==' ' || c=='\n' || c=='\t');
- if (hasBlanks)
- t << "\"" << s << "\"";
+ while ((c=*p++)!=0 && !needsEscaping)
+ needsEscaping = (c==' ' || c=='\n' || c=='\t' || c=='"');
+ if (needsEscaping)
+ {
+ t << "\"";
+ p=s.data();
+ while (*p)
+ {
+ if (*p=='"') t << "\\"; // escape quotes
+ t << *p++;
+ }
+ t << "\"";
+ }
else
+ {
t << s;
+ }
}
}
@@ -121,13 +133,10 @@ void ConfigOption::writeStringList(QTextStream &t,QStrList &l)
bool first=TRUE;
while (p)
{
- char c;
- const char *s=p;
- bool hasBlanks=FALSE;
- while ((c=*p++)!=0 && !hasBlanks) hasBlanks = (c==' ' || c=='\n' || c=='\t');
+ QCString s=p;
if (!first) t << " ";
first=FALSE;
- if (hasBlanks) t << "\"" << s << "\""; else t << s;
+ writeStringValue(t,s);
p = l.next();
if (p) t << " \\" << endl;
}