21 #ifndef XAPIAN_INCLUDED_APPEND_FILENAME_ARG_H 22 #define XAPIAN_INCLUDED_APPEND_FILENAME_ARG_H 30 const std::string& arg,
31 bool leading_space =
true) {
33 cmd.reserve(cmd.size() + arg.size() + 5);
36 const char* prefix = (arg[0] ==
'-') ?
" \".\\" :
" \"";
41 for (std::string::const_iterator i = arg.begin(); i != arg.end(); ++i) {
47 }
else if (*i < 32 || std::strchr(
"<>\"|*?", *i)) {
59 cmd.reserve(cmd.size() + arg.size() + 5);
63 const char* prefix = (arg[0] ==
'-') ?
" './" :
" '";
68 for (std::string::const_iterator i = arg.begin(); i != arg.end(); ++i) {
84 #endif // XAPIAN_INCLUDED_APPEND_FILENAME_ARG_H static bool append_filename_argument(std::string &cmd, const std::string &arg, bool leading_space=true)
Append filename argument arg to command cmd with suitable escaping.