Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalter Lozano <walter.lozano@collabora.com>2022-01-21 17:00:27 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2022-01-23 22:24:32 +0300
commit6dd6a6c42d1465d8cca2539476f6bffd5e1353dd (patch)
treeb28d456c44d8d0db6438fc8db609bf2b413c9574 /editors
parentf12fb1e4092900f26f7f8c71cde44b1cd7d26439 (diff)
Add support for long options to cmp
In order to improve compatibility with GNU cmp add support for long options to busybox cmp. function old new delta static.cmp_longopts - 36 +36 cmp_main 589 594 +5 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 41/0) Total: 41 bytes Signed-off-by: Walter Lozano <walter.lozano@collabora.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors')
-rw-r--r--editors/cmp.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/editors/cmp.c b/editors/cmp.c
index 6d2b0c6c3..b89e519ad 100644
--- a/editors/cmp.c
+++ b/editors/cmp.c
@@ -54,6 +54,7 @@ int cmp_main(int argc UNUSED_PARAM, char **argv)
int retval = 0;
int max_count = -1;
+#if !ENABLE_LONG_OPTS
opt = getopt32(argv, "^"
OPT_STR
"\0" "-1"
@@ -62,6 +63,23 @@ int cmp_main(int argc UNUSED_PARAM, char **argv)
":l--s:s--l",
&max_count
);
+#else
+ static const char cmp_longopts[] ALIGN1 =
+ "bytes\0" Required_argument "n"
+ "quiet\0" No_argument "s"
+ "silent\0" No_argument "s"
+ "verbose\0" No_argument "l"
+ ;
+ opt = getopt32long(argv, "^"
+ OPT_STR
+ "\0" "-1"
+ IF_DESKTOP(":?4")
+ IF_NOT_DESKTOP(":?2")
+ ":l--s:s--l",
+ cmp_longopts,
+ &max_count
+ );
+#endif
argv += optind;
filename1 = *argv;