* Licensed under GPLv2, see file LICENSE in this source tree.
*/
//config:config XXD
-//config: bool "xxd"
+//config: bool "xxd (8.9 kb)"
//config: default y
//config: help
-//config: The xxd utility is used to display binary data in a readable
-//config: way that is comparable to the output from most hex editors.
+//config: The xxd utility is used to display binary data in a readable
+//config: way that is comparable to the output from most hex editors.
//applet:IF_XXD(APPLET_NOEXEC(xxd, xxd, BB_DIR_USR_BIN, BB_SUID_DROP, xxd))
#define OPT_s (1 << 1)
#define OPT_a (1 << 2)
#define OPT_p (1 << 3)
- opt_complementary = "?1"; /* 1 argument max */
- opt = getopt32(argv, "l:s:apg:+c:+", &opt_l, &opt_s, &bytes, &cols);
+ opt = getopt32(argv, "^" "l:s:apg:+c:+" "\0" "?1" /* 1 argument max */,
+ &opt_l, &opt_s, &bytes, &cols
+ );
argv += optind;
dumper->dump_vflag = ALL;
}
// for -g3, this results in B B BS B B BS... B = "xxxxxx xxxxxx .....xx"
// todo: can be more clever and use
- // one "cols-1/B" format instead of many "B B B..." formats
+ // one 'bytes-1/1 "%02x"' format instead of many "B B B..." formats
//bb_error_msg("ADDED:'%s'", bigbuf);
bb_dump_add(dumper, bigbuf);
free(bigbuf);
if (!(opt & OPT_p)) {
sprintf(buf, "\" \"%u/1 \"%%_p\"\"\n\"", cols); // " ASCII\n"
bb_dump_add(dumper, buf);
+ } else {
+ bb_dump_add(dumper, "\"\n\"");
}
return bb_dump_dump(dumper, argv);