39#define EC_STRVEC(args...) \
41 const char *_arr[] = {args}; \
42 ec_strvec_from_array(_arr, EC_COUNT_OF(_arr)); \
80#define EC_STRVEC_ATTR_START "start"
82#define EC_STRVEC_ATTR_END "end"
struct ec_dict * ec_dict(void)
Create a hash table.
int ec_strvec_set(struct ec_strvec *strvec, size_t idx, const char *s)
Set a string in the vector at specified index.
int ec_strvec_cmp(const struct ec_strvec *strvec1, const struct ec_strvec *strvec2)
Compare two string vectors.
struct ec_strvec * ec_strvec_from_array(const char *const *strarr, size_t n)
Allocate a new string vector.
struct ec_strvec * ec_strvec_sh_lex_str(const char *str, ec_strvec_flag_t flags, char *unclosed_quote)
Split a string into multiple tokens following basic shell lexing rules.
struct ec_strvec * ec_strvec_ndup(const struct ec_strvec *strvec, size_t off, size_t len)
Duplicate a part of a string vector.
void ec_strvec_free(struct ec_strvec *strvec)
Free a string vector.
int ec_strvec_set_attrs(struct ec_strvec *strvec, size_t idx, struct ec_dict *attrs)
Set the attributes of a vector element.
const char * ec_strvec_val(const struct ec_strvec *strvec, size_t idx)
Get a string element from a vector.
void ec_strvec_sort(struct ec_strvec *strvec, int(*str_cmp)(const char *s1, const char *s2))
Sort the string vector.
int ec_strvec_del_last(struct ec_strvec *strvec)
Delete the last entry in the string vector.
void ec_strvec_dump(FILE *out, const struct ec_strvec *strvec)
Dump a string vector.
ec_strvec_flag_t
Options for ec_strvec_sh_lex_str().
struct ec_strvec * ec_strvec(void)
Allocate a new empty string vector.
int ec_strvec_add(struct ec_strvec *strvec, const char *s)
Add a string in a vector.
const struct ec_dict * ec_strvec_get_attrs(const struct ec_strvec *strvec, size_t idx)
Get the attributes of a vector element.
struct ec_strvec * ec_strvec_dup(const struct ec_strvec *strvec)
Duplicate a string vector.
size_t ec_strvec_len(const struct ec_strvec *strvec)
Get the length of a string vector.
@ EC_STRVEC_STRICT
Fail if a quote is not closed properly or if the provided string ends with an unterminated escape seq...
@ EC_STRVEC_TRAILSP
If there is trailing white space, add an empty element to the output string vector.