aboutsummaryrefslogtreecommitdiff
path: root/lib/args.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2008-06-16 19:27:35 -0500
committerRob Landley <rob@landley.net>2008-06-16 19:27:35 -0500
commit4ac6656b5798edf61b05500dbc525b8740d5ad6a (patch)
tree12c2991115c993bb569ec10fb9d254b4f6bbb6cf /lib/args.c
parentfe0f3d5fa93b85a43854953b5997ad802fbad4a2 (diff)
downloadtoybox-4ac6656b5798edf61b05500dbc525b8740d5ad6a.tar.gz
Assemble '*' repeated argument list in order. Also implement '@' counter.
Diffstat (limited to 'lib/args.c')
-rw-r--r--lib/args.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/args.c b/lib/args.c
index 6103bb0c..ee915b46 100644
--- a/lib/args.c
+++ b/lib/args.c
@@ -121,15 +121,14 @@ static int gotflag(struct getoptflagstate *gof)
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 = "";
}