MCPcopy Create free account
hub / github.com/ElementsProject/elements / ShellQuoteIfNeeded

Function ShellQuoteIfNeeded

src/rpc/util.cpp:158–167  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

156 * @note This is intended for help, not for security-sensitive purposes.
157 */
158std::string ShellQuoteIfNeeded(const std::string& s)
159{
160 for (const char ch: s) {
161 if (ch == ' ' || ch == '\'' || ch == '"') {
162 return ShellQuote(s);
163 }
164 }
165
166 return s;
167}
168
169}
170

Callers 1

HelpExampleCliNamedFunction · 0.85

Calls 1

ShellQuoteFunction · 0.85

Tested by

no test coverage detected