From e835afadfe84a820b698f715a01e777f8b7bf833 Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Wed, 17 Dec 2014 17:02:37 +0100 Subject: nandwrite: fix build when long options are disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Required_argument macro is only defined when long options are enabled. Fixes the following build error: miscutils/nandwrite.c: In function 'nandwrite_main': miscutils/nandwrite.c:120:10: error: expected ',' or ';' before 'Required_argument' Reported-by: Christian Kästner Signed-off-by: Baruch Siach Signed-off-by: Denys Vlasenko --- miscutils/nandwrite.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'miscutils') diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c index 29ff351a3..c825fc315 100644 --- a/miscutils/nandwrite.c +++ b/miscutils/nandwrite.c @@ -116,12 +116,13 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv) struct mtd_oob_buf oob; unsigned char *filebuf; const char *opt_s = "0", *opt_f = "-", *opt_l, *opt_bb; - static const char nanddump_longopts[] ALIGN1 = - "bb\0" Required_argument "\xff"; /* no short equivalent */ if (IS_NANDDUMP) { opt_complementary = "=1"; - applet_long_options = nanddump_longopts; +#if ENABLE_LONG_OPTS + applet_long_options = + "bb\0" Required_argument "\xff"; /* no short equivalent */ +#endif opts = getopt32(argv, "os:f:l:", &opt_s, &opt_f, &opt_l, &opt_bb); } else { /* nandwrite */ opt_complementary = "-1:?2"; -- cgit v1.2.3-55-g6feb From ad0d009e0c1968a14f17189264d3aa8008ea2e3b Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Thu, 18 Dec 2014 00:27:26 +0200 Subject: nanddump: don't show --bb in usage when disabled The --bb options now depends on LONG_OPTS. Omit mentions of --bb from usage text when LONG_OPTS is disabled. Signed-off-by: Baruch Siach Signed-off-by: Denys Vlasenko --- miscutils/nandwrite.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'miscutils') diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c index c825fc315..247fc72f4 100644 --- a/miscutils/nandwrite.c +++ b/miscutils/nandwrite.c @@ -36,16 +36,18 @@ //usage: "\n -s ADDR Start address" //usage:#define nanddump_trivial_usage -//usage: "[-o] [--bb=padbad|skipbad] [-s ADDR] [-l LEN] [-f FILE] MTD_DEVICE" +//usage: "[-o]" IF_LONG_OPTS(" [--bb=padbad|skipbad]") " [-s ADDR] [-l LEN] [-f FILE] MTD_DEVICE" //usage:#define nanddump_full_usage "\n\n" //usage: "Dump MTD_DEVICE\n" //usage: "\n -o Dump oob data" //usage: "\n -s ADDR Start address" //usage: "\n -l LEN Length" //usage: "\n -f FILE Dump to file ('-' for stdout)" +//usage: IF_LONG_OPTS( //usage: "\n --bb=METHOD:" //usage: "\n skipbad: skip bad blocks" //usage: "\n padbad: substitute bad blocks by 0xff (default)" +//usage: ) #include "libbb.h" #include -- cgit v1.2.3-55-g6feb