diff options
Diffstat (limited to 'glib/src/shell.ccg')
-rw-r--r-- | glib/src/shell.ccg | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/glib/src/shell.ccg b/glib/src/shell.ccg index 84b9a512..aaa34379 100644 --- a/glib/src/shell.ccg +++ b/glib/src/shell.ccg @@ -17,42 +17,43 @@ #include <glibmm/utility.h> - namespace Glib { /**** shell utility functions **********************************************/ -Glib::ArrayHandle<std::string> shell_parse_argv(const std::string& command_line) +Glib::ArrayHandle<std::string> +shell_parse_argv(const std::string& command_line) { - char** argv = nullptr; - int argc = 0; + char** argv = nullptr; + int argc = 0; GError* error = nullptr; g_shell_parse_argv(command_line.c_str(), &argc, &argv, &error); - if(error) + if (error) Glib::Error::throw_exception(error); return Glib::ArrayHandle<std::string>(argv, argc, Glib::OWNERSHIP_DEEP); } -std::string shell_quote(const std::string& unquoted_string) +std::string +shell_quote(const std::string& unquoted_string) { const auto buf = make_unique_ptr_gfree(g_shell_quote(unquoted_string.c_str())); return std::string(buf.get()); } -std::string shell_unquote(const std::string& quoted_string) +std::string +shell_unquote(const std::string& quoted_string) { GError* error = nullptr; - char *const buf = g_shell_unquote(quoted_string.c_str(), &error); + char* const buf = g_shell_unquote(quoted_string.c_str(), &error); - if(error) + if (error) Glib::Error::throw_exception(error); return std::string(make_unique_ptr_gfree(buf).get()); } } // namespace Glib - |