Hello, list!

The most borring thing when dealing with applet options is to parse them.
Although getopt32() does the most of dirty work for us still there exist
numeric options which require additional processing.

Typical usage is:

-------
enum { OPT_n = 1 };
char *opt_n;
unsigned value_n = <default>;
opts = getopt32("n:", &opt_n);
if (opts & OPT_n)
        value_n = xatoi_u(opt_n);
-------

I propose to upgrade getopt32() so we do not bother with intermediate
string values (which is bloat) of numeric options:

-------
enum { OPT_n = 1 };
unsigned value_n = <default>;
opt_complementary = "n+:"; // mark -n as numeric
opts = getopt32("n:", &value_n); // set the real value of n
-------

Attached is the patch to getopt32.c

I think it would save significant space.

Please, do comment.

--
Vladimir

Attachment: getopt32.patch
Description: Binary data

_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to