svn commit: trunk/busybox/libbb

vodz at busybox.net vodz at busybox.net
Wed Oct 5 13:58:56 UTC 2005


Author: vodz
Date: 2005-10-05 06:58:40 -0700 (Wed, 05 Oct 2005)
New Revision: 11771

Log:
another more correction for getopt_ulflags() documentation (examples)

Modified:
   trunk/busybox/libbb/getopt_ulflags.c


Changeset:
Modified: trunk/busybox/libbb/getopt_ulflags.c
===================================================================
--- trunk/busybox/libbb/getopt_ulflags.c	2005-10-05 13:55:45 UTC (rev 11770)
+++ trunk/busybox/libbb/getopt_ulflags.c	2005-10-05 13:58:40 UTC (rev 11771)
@@ -134,9 +134,12 @@
 	llist_t *my_b = NULL;
 	int verbose_level = 0;
 	bb_opt_complementally = "vv:b*:b-c:c-b";
-	bb_getopt_ulflags(argc, argv, "vb:c", &my_b, &verbose_level);
-	while (my_b) { dosomething_with(my_b->data) ; my_b = my_b->link; }
-	if (verbose_level) bb_printf("verbose\n");
+	f = bb_getopt_ulflags(argc, argv, "vb:c", &my_b, &verbose_level);
+	if((f & 2))     // -c after -b unset this -b flag
+	  while (my_b) { dosomething_with(my_b->data) ; my_b = my_b->link; }
+	if(my_b)        // but llist stored always if -b found
+		free_llist(my_b);
+	if (verbose_level) bb_printf("verbose level is %d\n", verbose_level);
 
 Special characters:
 
@@ -174,8 +177,8 @@
 	bb_opt_complementally = "-:w-x:x-w";
 	bb_getopt_ulflags(argc, argv, "wx");
 
-	Allows option 'w' to be given without a dash (./program w x)
-	as well as with a dash (./program -x).
+	Allows any arguments to be given without a dash (./program w x)
+	as well as with a dash (./program -x). Why unset -w see above.
 
  "~"    A tilde between two options, or between an option and a group
 	of options, means that they are mutually exclusive.  Unlike




More information about the busybox-cvs mailing list