new "@k" parameter transformation; minor completion fix for uncommon case

This commit is contained in:
Chet Ramey
2021-08-23 15:54:49 -04:00
parent 2adf06d9f8
commit ea32b611f7
19 changed files with 221 additions and 9 deletions
+21
View File
@@ -793,6 +793,27 @@ ARRAY *a;
return (REVERSE_LIST(list, WORD_LIST *));
}
WORD_LIST *
array_to_kvpair_list(a)
ARRAY *a;
{
WORD_LIST *list;
ARRAY_ELEMENT *ae;
char *k, *v;
if (a == 0 || array_empty(a))
return((WORD_LIST *)NULL);
list = (WORD_LIST *)NULL;
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae)) {
k = itos(element_index(ae));
v = element_value(ae);
list = make_word_list (make_bare_word(k), list);
list = make_word_list (make_bare_word(v), list);
free(k);
}
return (REVERSE_LIST(list, WORD_LIST *));
}
ARRAY *
array_assign_list (array, list)
ARRAY *array;