summaryrefslogtreecommitdiff
path: root/str.c
diff options
context:
space:
mode:
Diffstat (limited to 'str.c')
-rw-r--r--str.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/str.c b/str.c
index f4cb099..e4d8722 100644
--- a/str.c
+++ b/str.c
@@ -109,3 +109,23 @@ char *argv2str(int startind, int argc, char **argv)
return str;
}
+
+char **argv_insert(char **argv, size_t *count, const char *str)
+{
+ argv = xrealloc(argv, (*count + 2) * sizeof(char *));
+ argv[*count] = str ? xstrdup(str) : xstrdup("");
+ argv[*count + 1] = NULL;
+
+ *count += 1;
+ return argv;
+}
+
+void argv_free(char **argv)
+{
+ char **tmp = argv;
+
+ for (; argv && *argv; argv++)
+ free(*argv);
+
+ free(tmp);
+}