On Monday 03 June 2013 20:35:06 Paul B. Henson wrote:
> On 6/2/2013 10:58 PM, Tito wrote:
> 
> > Will  xstrtou_sfx not die and print an error msg  if !size_str so
> > maybe  bb_error_msg_and_die is not needed. It should be a getopt32
> > job to check for missing options and error out and die.
> 
> The call to getopt32 is generic for all of the applets that this module 
> supports, and as such does not enforce specific options for specific 
> applets.
> 
> Again, that's the way I found it, I'm just adding a couple of minor 
> enhancements, not re-architecting the base design.
> 

What i wanted to say is:

opts = getopt32(argv, "s:", &size_str);

you cannot reach after this point if you passed -s without the mandatory 
argument,
so now you only need to

if (opts & OPT_S)
         size_bytes = xstrtou_sfx(size_str, 10, size_suffixes);

as size_str surely exists and xstr.... func will do the validation
and error out if something is wrong.


Ciao,
Tito


_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to