mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-11-29 03:31:01 +01:00
53482: zparseopts -G: always add options with optional args to array with =
This commit is contained in:
parent
bacc78ec3f
commit
494fcd1799
3 changed files with 11 additions and 5 deletions
|
|
@ -1662,15 +1662,15 @@ add_opt_val(Zoptdesc d, char *arg)
|
|||
v->str = NULL;
|
||||
if (d->arr)
|
||||
d->arr->num += (arg ? 2 : 1);
|
||||
} else if (arg) {
|
||||
} else if (arg || d->flags & ZOF_GNUL) {
|
||||
/* 3 here is '-' + '=' + NUL */
|
||||
char *s = (char *) zhalloc(strlen(d->name) + strlen(arg) + 3);
|
||||
char *s = (char *) zhalloc(strlen(d->name) + strlen(arg ? arg : "") + 3);
|
||||
|
||||
*s = '-';
|
||||
strcpy(s + 1, d->name);
|
||||
if (d->flags & ZOF_GNUL)
|
||||
strcat(s, "=");
|
||||
strcat(s, arg);
|
||||
strcat(s, arg ? arg : "");
|
||||
v->str = s;
|
||||
if (d->arr)
|
||||
d->arr->num += 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue