Mercurial > hg > toybox
changeset 298:1bb9f53a7101
Assemble '*' repeated argument list in order. Also implement '@' counter.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 16 Jun 2008 19:27:35 -0500 |
parents | 6e65eefc37e9 |
children | b142219d828f |
files | lib/args.c |
diffstat | 1 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/args.c Mon May 26 16:07:16 2008 -0500 +++ b/lib/args.c Mon Jun 16 19:27:35 2008 -0500 @@ -121,15 +121,14 @@ error_exit("Missing argument"); if (type == ':') *(opt->arg) = (long)gof->arg; else if (type == '*') { - struct arg_list *temp, **list; + struct arg_list **list; + list = (struct arg_list **)opt->arg; - temp = xmalloc(sizeof(struct arg_list)); - temp->arg = gof->arg; - temp->next = *list; - *list = temp; + while (*list) list=&((*list)->next); + *list = xzalloc(sizeof(struct arg_list)); + (*list)->arg = gof->arg; } else if (type == '#') *(opt->arg) = atolx((char *)gof->arg); - else if (type == '@') { - } + else if (type == '@') ++*(opt->arg); gof->arg = ""; }