projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dc: fix "dc does_not_exist" SEGVing
[oweals/busybox.git]
/
miscutils
/
nandwrite.c
diff --git
a/miscutils/nandwrite.c
b/miscutils/nandwrite.c
index 8659b491f5611cbd1a247a61021ac6732acd1fad..29c800612467057dd6fd603fa4336e82c2b07517 100644
(file)
--- a/
miscutils/nandwrite.c
+++ b/
miscutils/nandwrite.c
@@
-7,20
+7,19
@@
*
* TODO: add support for large (>4GB) MTD devices
*/
*
* TODO: add support for large (>4GB) MTD devices
*/
-
//config:config NANDWRITE
//config: bool "nandwrite (5.9 kb)"
//config: default y
//config: select PLATFORM_LINUX
//config: help
//config:config NANDWRITE
//config: bool "nandwrite (5.9 kb)"
//config: default y
//config: select PLATFORM_LINUX
//config: help
-//config:
Write to the specified MTD device, with bad blocks awareness
+//config: Write to the specified MTD device, with bad blocks awareness
//config:
//config:config NANDDUMP
//config: bool "nanddump (6.3 kb)"
//config: default y
//config: select PLATFORM_LINUX
//config: help
//config:
//config:config NANDDUMP
//config: bool "nanddump (6.3 kb)"
//config: default y
//config: select PLATFORM_LINUX
//config: help
-//config:
Dump the content of raw NAND chip
+//config: Dump the content of raw NAND chip
//applet:IF_NANDWRITE(APPLET(nandwrite, BB_DIR_USR_SBIN, BB_SUID_DROP))
//applet:IF_NANDDUMP(APPLET_ODDNAME(nanddump, nandwrite, BB_DIR_USR_SBIN, BB_SUID_DROP, nanddump))
//applet:IF_NANDWRITE(APPLET(nandwrite, BB_DIR_USR_SBIN, BB_SUID_DROP))
//applet:IF_NANDDUMP(APPLET_ODDNAME(nanddump, nandwrite, BB_DIR_USR_SBIN, BB_SUID_DROP, nanddump))
@@
-54,6
+53,15
@@
#include "libbb.h"
#include <mtd/mtd-user.h>
#include "libbb.h"
#include <mtd/mtd-user.h>
+/* Old headers call it MTD_MODE_RAW.
+ * FIXME: In kernel headers, MTD_FILE_MODE_RAW is not a define,
+ * it's an enum. How I can test for existence of an enum?
+ */
+#if !defined(MTD_FILE_MODE_RAW)
+# define MTD_FILE_MODE_RAW 3
+#endif
+
+
#define IS_NANDDUMP (ENABLE_NANDDUMP && (!ENABLE_NANDWRITE || (applet_name[4] == 'd')))
#define IS_NANDWRITE (ENABLE_NANDWRITE && (!ENABLE_NANDDUMP || (applet_name[4] != 'd')))
#define IS_NANDDUMP (ENABLE_NANDDUMP && (!ENABLE_NANDWRITE || (applet_name[4] == 'd')))
#define IS_NANDWRITE (ENABLE_NANDWRITE && (!ENABLE_NANDDUMP || (applet_name[4] != 'd')))
@@
-123,15
+131,12
@@
int nandwrite_main(int argc UNUSED_PARAM, char **argv)
const char *opt_s = "0", *opt_f = "-", *opt_l, *opt_bb;
if (IS_NANDDUMP) {
const char *opt_s = "0", *opt_f = "-", *opt_l, *opt_bb;
if (IS_NANDDUMP) {
- opt_complementary = "=1";
-#if ENABLE_LONG_OPTS
- applet_long_options =
- "bb\0" Required_argument "\xff"; /* no short equivalent */
-#endif
- opts = getopt32(argv, "ons:f:l:", &opt_s, &opt_f, &opt_l, &opt_bb);
+ opts = getopt32long(argv, "^" "ons:f:l:" "\0" "=1",
+ "bb\0" Required_argument "\xff", /* no short equivalent */
+ &opt_s, &opt_f, &opt_l, &opt_bb
+ );
} else { /* nandwrite */
} else { /* nandwrite */
- opt_complementary = "-1:?2";
- opts = getopt32(argv, "pns:", &opt_s);
+ opts = getopt32(argv, "^" "pns:" "\0" "-1:?2", &opt_s);
}
argv += optind;
}
argv += optind;