aboutsummaryrefslogtreecommitdiff
path: root/sway/stringop.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/stringop.c')
-rw-r--r--sway/stringop.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sway/stringop.c b/sway/stringop.c
index 4b05e657..bbc0bcdf 100644
--- a/sway/stringop.c
+++ b/sway/stringop.c
@@ -148,3 +148,19 @@ int unescape_string(char *string) {
}
return len;
}
+
+char *join_args(char **argv, int argc) {
+ int len = 0, i;
+ for (i = 0; i < argc; ++i) {
+ len += strlen(argv[i]) + 1;
+ }
+ char *res = malloc(len);
+ len = 0;
+ for (i = 0; i < argc; ++i) {
+ strcpy(res + len, argv[i]);
+ len += strlen(argv[i]);
+ res[len++] = ' ';
+ }
+ res[len - 1] = '\0';
+ return res;
+}