1 /* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
3 * Permission to use, copy, modify, and distribute this software
4 * is freely granted, provided that this notice is preserved.
14 argz_create_sep (const char *string
,
24 char *old_running
= 0;
30 if (!string
|| string
[0] == '\0')
39 running
= strdup(string
);
40 old_running
= running
;
42 while ((token
= strsep(&running
, delim
)))
45 *argz_len
+= (len
+ 1);
49 if(!(*argz
= (char *)malloc(*argz_len
)))
54 running
= strdup(string
);
55 old_running
= running
;
58 for (i
= 0; i
< num_strings
; i
++)
60 token
= strsep(&running
, delim
);
61 len
= strlen(token
) + 1;
62 memcpy(iter
, token
, len
);