Re: [PATCH] ubi_tools: enhance -s option to allow size multiplier to match mtd-utils

2013-06-03 Thread Paul B. Henson
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

Re: [PATCH] ubi_tools: enhance -s option to allow size multiplier to match mtd-utils

2013-06-03 Thread Paul B. Henson
On 6/3/2013 12:24 PM, Tito wrote: opts = getopt32(argv, s:, size_str); The -s option is marked as requiring an argument: opts = getopt32(argv, md:n:N:s:a:t::, if (opts OPT_S) size_bytes = xstrtou_sfx(size_str, 10, size_suffixes); I'm not completely clear on what you're getting

Re: [PATCH] ubi_tools: enhance -s option to allow size multiplier to match mtd-utils

2013-06-02 Thread Mike Frysinger
On Friday 31 May 2013 22:28:03 Paul B. Henson wrote: On 5/31/2013 4:34 PM, Mike Frysinger wrote: +static int get_bytes(const char *str) [...] the style is wrong, but ignoring that, this seems like it'd be prime for adding to common libbb code if there isn't a func in there already I

[PATCH] ubi_tools: enhance -s option to allow size multiplier to match mtd-utils

2013-06-02 Thread Paul B. Henson
Signed-off-by: Paul B. Henson hen...@acm.org --- miscutils/ubi_tools.c | 33 - 1 files changed, 24 insertions(+), 9 deletions(-) diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c index f09be8c..6b5d384 100644 --- a/miscutils/ubi_tools.c +++

Re: [PATCH] ubi_tools: enhance -s option to allow size multiplier to match mtd-utils

2013-06-02 Thread Paul B. Henson
On Sun, Jun 02, 2013 at 03:23:18AM -0400, Mike Frysinger wrote: i think libbb has grown to the point where it needs to start providing its own API reference :/. it's been a while since i hacked seriously on busybox, so i've lost touch with much of its deeper layers. [...] inputs. it's

Re: [PATCH] ubi_tools: enhance -s option to allow size multiplier to match mtd-utils

2013-06-02 Thread Tito
On Monday 03 June 2013 03:11:10 Paul B. Henson wrote: Signed-off-by: Paul B. Henson hen...@acm.org --- miscutils/ubi_tools.c | 33 - 1 files changed, 24 insertions(+), 9 deletions(-) diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c index

[PATCH] ubi_tools: enhance -s option to allow size multiplier to match mtd-utils

2013-05-31 Thread Paul B. Henson
Signed-off-by: Paul B. Henson hen...@acm.org --- miscutils/ubi_tools.c | 57 +--- 1 files changed, 48 insertions(+), 9 deletions(-) diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c index 6cb7cd5..87dfab0 100644 --- a/miscutils/ubi_tools.c

Re: [PATCH] ubi_tools: enhance -s option to allow size multiplier to match mtd-utils

2013-05-31 Thread Mike Frysinger
On Tuesday 28 May 2013 21:17:42 Paul B. Henson wrote: +static int get_bytes(const char *str) +{ + int found; + int size = 0; + char multiplier[4]; + + found = sscanf(str, %d%3s, size, multiplier); + + if (found == 2) { + if (!strcmp(multiplier, KiB)) { +

Re: [PATCH] ubi_tools: enhance -s option to allow size multiplier to match mtd-utils

2013-05-31 Thread Paul B. Henson
On 5/31/2013 4:34 PM, Mike Frysinger wrote: +static int get_bytes(const char *str) [...] the style is wrong, but ignoring that, this seems like it'd be prime for adding to common libbb code if there isn't a func in there already I don't see one. Is there an existing libbb source file you

Re: [PATCH] ubi_tools: enhance -s option to allow size multiplier to match mtd-utils

2013-05-31 Thread Paul B. Henson
On May 31, 2013, at 4:34 PM, Mike Frysinger vap...@gentoo.org wrote: On Tuesday 28 May 2013 21:17:42 Paul B. Henson wrote: +static int get_bytes(const char *str) the style is wrong, but ignoring that, this seems like it'd be prime for adding to common libbb code if there isn't a func in