|
a/src/utils/smallut.cpp |
|
b/src/utils/smallut.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.12 2006-01-04 11:33:44 dockes Exp $ (C) 2004 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.13 2006-01-19 12:01:43 dockes Exp $ (C) 2004 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
#ifndef TEST_SMALLUT
|
4 |
#ifndef TEST_SMALLUT
|
5 |
#include <string>
|
5 |
#include <string>
|
6 |
#include <ctype.h>
|
6 |
#include <ctype.h>
|
7 |
#include <unistd.h>
|
7 |
#include <unistd.h>
|
|
... |
|
... |
309 |
pos = s.find_last_not_of(ws);
|
309 |
pos = s.find_last_not_of(ws);
|
310 |
if (pos != string::npos && pos != s.length()-1)
|
310 |
if (pos != string::npos && pos != s.length()-1)
|
311 |
s.replace(pos+1, string::npos, "");
|
311 |
s.replace(pos+1, string::npos, "");
|
312 |
}
|
312 |
}
|
313 |
|
313 |
|
|
|
314 |
// Escape things that would look like markup
|
|
|
315 |
string escapeHtml(const string &in)
|
|
|
316 |
{
|
|
|
317 |
string out;
|
|
|
318 |
for (string::size_type pos = 0; pos < in.length(); pos++) {
|
|
|
319 |
switch(in.at(pos)) {
|
|
|
320 |
case '<':
|
|
|
321 |
out += "<";
|
|
|
322 |
break;
|
|
|
323 |
case '&':
|
|
|
324 |
out += "&";
|
|
|
325 |
break;
|
|
|
326 |
default:
|
|
|
327 |
out += in.at(pos);
|
|
|
328 |
}
|
|
|
329 |
}
|
|
|
330 |
return out;
|
|
|
331 |
}
|
|
|
332 |
|
314 |
#else
|
333 |
#else
|
315 |
|
334 |
|
316 |
#include <string>
|
335 |
#include <string>
|
317 |
#include "smallut.h"
|
336 |
#include "smallut.h"
|
318 |
|
337 |
|