Changeset 7b89e8c for util.c


Ignore:
Timestamp:
Sep 30, 2011, 9:32:12 PM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.9
Children:
6329cd5, d6c2e03
Parents:
d953ede
git-author:
David Benjamin <davidben@mit.edu> (09/30/11 20:48:13)
git-committer:
David Benjamin <davidben@mit.edu> (09/30/11 21:32:12)
Message:
Add owl_argv_quote convenience function

Did we really never write this thing?
File:
1 edited

Legend:

Unmodified
Added
Removed
  • util.c

    r6646fdb r7b89e8c  
    262262CALLER_OWN char *owl_arg_quote(const char *arg)
    263263{
    264   GString *buf = g_string_new("");;
     264  GString *buf = g_string_new("");
    265265  owl_string_append_quoted_arg(buf, arg);
     266  return g_string_free(buf, false);
     267}
     268
     269/* Returns a quoted version of argv. owl_parseline on the result should give
     270 * back the input. */
     271CALLER_OWN char *owl_argv_quote(int argc, const char *const *argv)
     272{
     273  int i;
     274  GString *buf = g_string_new("");
     275  for (i = 0; i < argc; i++) {
     276    if (i > 0)
     277      g_string_append_c(buf, ' ');
     278    owl_string_append_quoted_arg(buf, argv[i]);
     279  }
    266280  return g_string_free(buf, false);
    267281}
Note: See TracChangeset for help on using the changeset viewer.