Skip to content

Commit

Permalink
Add owl_argv_quote convenience function
Browse files Browse the repository at this point in the history
Did we really never write this thing?
  • Loading branch information
davidben committed Oct 1, 2011
1 parent d953ede commit 7b89e8c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion util.c
Expand Up @@ -261,11 +261,25 @@ CALLER_OWN char *owl_string_build_quoted(const char *tmpl, ...)
* command-line. Result should be freed with g_free. */
CALLER_OWN char *owl_arg_quote(const char *arg)
{
GString *buf = g_string_new("");;
GString *buf = g_string_new("");
owl_string_append_quoted_arg(buf, arg);
return g_string_free(buf, false);
}

/* Returns a quoted version of argv. owl_parseline on the result should give
* back the input. */
CALLER_OWN char *owl_argv_quote(int argc, const char *const *argv)
{
int i;
GString *buf = g_string_new("");
for (i = 0; i < argc; i++) {
if (i > 0)
g_string_append_c(buf, ' ');
owl_string_append_quoted_arg(buf, argv[i]);
}
return g_string_free(buf, false);
}

/* caller must free the return */
CALLER_OWN char *owl_util_format_minutes(int in)
{
Expand Down

0 comments on commit 7b89e8c

Please sign in to comment.