* Shell-quotes the argument if it needs quoting, else returns it literally, to * save typing. * * @note This is intended for help, not for security-sensitive purposes. */
| 149 | * @note This is intended for help, not for security-sensitive purposes. |
| 150 | */ |
| 151 | std::string ShellQuoteIfNeeded(const std::string &s) { |
| 152 | for (const char ch : s) { |
| 153 | if (ch == ' ' || ch == '\'' || ch == '"') { |
| 154 | return ShellQuote(s); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | return s; |
| 159 | } |
| 160 | |
| 161 | } // namespace |
| 162 |
no test coverage detected