changeset 1054:0d8a664f9941 draft

Make [-abc] exclude logic clear argument slots when disabling options.
author Rob Landley <rob@landley.net>
date Fri, 06 Sep 2013 12:18:46 -0500
parents 501fd74c028e
children f8824260d057
files lib/args.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/args.c	Fri Sep 06 04:45:36 2013 -0500
+++ b/lib/args.c	Fri Sep 06 12:18:46 2013 -0500
@@ -124,7 +124,14 @@
   }
 
   // Set flags
-  toys.optflags &= ~opt->dex[0];
+  if (toys.optflags & opt->dex[0]) {
+    struct opts *clr;
+    unsigned i = 1;
+
+    for (clr=gof->opts, i=1; ; clr = clr->next, i<<=1)
+      if (clr->arg && (i & toys.optflags)) clr->arg = 0;
+    toys.optflags &= ~opt->dex[0];
+  }
   toys.optflags |= opt->dex[1];
   gof->excludes |= opt->dex[2];
   if (opt->flags&2) gof->stopearly=2;