15 while ((
string = *argv)) {
16 if (
string[0] ==
'-') {
17 if (
string[1] ==
'-' &&
string[2] ==
'\0') {
21 if (
string[0] == opt) {
38 if (!cur || cur[0] !=
'-' || !cur[1]) {
41 if (cur[1] ==
'-' && cur[2] ==
'\0') {
68 *len_ret = strlen((
const char *)s);
69 t = (
char *)
zalloc(*len_ret + 1);
70 memcpy(t, s, *len_ret);
80 unsigned meta_length = 0;
87 *new_len = my_new_len;
89 to_return = (
char *)
zalloc((my_new_len + 1) *
sizeof(char));
91 zfree(work, meta_length);
94 memcpy(to_return, work,
sizeof(
char) * my_new_len);
95 to_return[my_new_len] =
'\0';
96 zfree(work, meta_length);
int zp_take_opt_with_arg(char ***argvp, char opt, char **out_arg)
Consume a short option with required argument from argv.
char * my_ztrdup_glen(const char *s, unsigned *len_ret)
zalloc-backed strdup with length out parameter.
char * zp_unmetafy_zalloc(const char *to_copy, int *new_len)
Duplicate and unmetafy a zsh string with zalloc; see header for details.
int zp_has_option(char **argv, char opt)
Lightweight argv short-option scanner (stops at "--").
Module declaration header (mdh) for zpmod.
Prototype stub for zpmod when building out-of-tree.
char * unmetafy(char *s, int *len)
void * zalloc(size_t size)
void zfree(void *ptr, size_t size)
Utility helpers shared across module components.
Local, non-invasive shims to suppress benign vendor header warnings.