]> mj.ucw.cz Git - libucw.git/blobdiff - lib/stkstring.c
Merge with git+ssh://cvs.ucw.cz/projects/sherlock/GIT/sherlock.git
[libucw.git] / lib / stkstring.c
index ccc689da64ba04e10f656631a1895f457520ba32..eaeacf00f7c950aaf27de5aefa570bf58d395f6d 100644 (file)
@@ -13,7 +13,7 @@ stk_array_len(char **s, uns cnt)
 }
 
 void
-stk_array_copy(char *x, char **s, uns cnt)
+stk_array_join(char *x, char **s, uns cnt, uns sep)
 {
   while (cnt--)
     {
@@ -21,6 +21,8 @@ stk_array_copy(char *x, char **s, uns cnt)
       memcpy(x, *s, l);
       x += l;
       s++;
+      if (sep && cnt)
+       *x++ = sep;
     }
   *x = 0;
 }
@@ -80,6 +82,8 @@ int main(void)
   a = stk_printf("Bew%s!", a);
   puts(a);
   puts(stk_hexdump(a, 3));
+  char *ary[] = { "The", "jaws", "that", "bite" };
+  puts(stk_strjoin(ary, 4, ' '));
   return 0;
 }