Question for Vodz about getopt_ulflags ([PATCH] inside)

Denis Vlasenko vda at ilport.com.ua
Wed May 3 03:42:07 PDT 2006


On Wednesday 03 May 2006 13:13, Tito wrote:
> Hi Vodz,
> I am trying to use bb_getopt_ulflags in hdparm,
> but it seems to me that unsigned long opts
> returned by bb_getopt_ulflags is not big enough
> to hold the value for all the options.
> 
> For test:
> int hdparm_main(int argc, char **argv)
> {
> 	unsigned long opts;
> 
> 	opts = bb_getopt_ulflags(argc, argv, hdparm_options);
> 	printf("opts %ld\n", opts);
> 	return 0;
> }
> 
> ./busybox hdparm -Z
> opts 1073741824
> ./busybox hdparm -U
> opts -2147483648
> ./busybox hdparm -R
> BusyBox v1.2.0-pre0 (2006.04.28-12:28+0000) multi-call binary
> 
> Usage: hdparm [options] [device] ..
> 
> The opt strings is:
> 
> static const char hdparm_options[]= "VvgfqunprmckaBtThdSDPXKALWCyYzZURQwxb";
> 
> Is there a solution?

If you have more than 8*sizeof(ulong) options, split them:

opts1 = bb_getopt_ulflags(argc, argv, hdparm_options1);
opts2 = bb_getopt_ulflags(argc, argv, hdparm_options2);

BTW, see attached. I do want doc to be in English.
Please help me to push it through if you can :)
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getopt_ulflags_english.patch
Type: text/x-diff
Size: 9279 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20060503/a3a3f8c9/getopt_ulflags_english-0001.bin


More information about the busybox mailing list