aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatheus Izvekov <mizvekov@gmail.com>2010-01-18 18:40:02 -0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-01-20 02:45:23 +0100
commitb32aa0c274ee7fec286b5355c6c9a9d084e657f8 (patch)
tree87c495853d64e673e362771456fe9457d7e2ded2
parentfe1ce2e43e612d7b07118cf139a8b61d76bea893 (diff)
downloadbusybox-w32-b32aa0c274ee7fec286b5355c6c9a9d084e657f8.tar.gz
busybox-w32-b32aa0c274ee7fec286b5355c6c9a9d084e657f8.tar.bz2
busybox-w32-b32aa0c274ee7fec286b5355c6c9a9d084e657f8.zip
diff: support long options
>>From 7b74284ebe6222cb714c37cdbb94633965f29e9b Mon Sep 17 00:00:00 2001 From: Matheus Izvekov <mizvekov@gmail.com> Date: Mon, 18 Jan 2010 18:36:52 -0200 Subject: [PATCH] diff: support long options Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/Config.in7
-rw-r--r--editors/diff.c25
2 files changed, 32 insertions, 0 deletions
diff --git a/editors/Config.in b/editors/Config.in
index e1285f4ea..e4fdd0f38 100644
--- a/editors/Config.in
+++ b/editors/Config.in
@@ -35,6 +35,13 @@ config DIFF
35 differences between them in a form that can be given to 35 differences between them in a form that can be given to
36 the patch command. 36 the patch command.
37 37
38config FEATURE_DIFF_LONG_OPTIONS
39 bool "Enable long options"
40 default n
41 depends on DIFF && LONG_OPTS
42 help
43 Enable use of long options.
44
38config FEATURE_DIFF_DIR 45config FEATURE_DIFF_DIR
39 bool "Enable directory support" 46 bool "Enable directory support"
40 default y 47 default y
diff --git a/editors/diff.c b/editors/diff.c
index 772610477..9d0373f93 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -876,6 +876,28 @@ static void diffdir(char *p[2], const char *s_start)
876} 876}
877#endif 877#endif
878 878
879#if ENABLE_FEATURE_DIFF_LONG_OPTIONS
880static const char diff_longopts[] ALIGN1 =
881 "ignore-case\0" No_argument "i"
882 "ignore-tab-expansion\0" No_argument "E"
883 "ignore-space-change\0" No_argument "b"
884 "ignore-all-space\0" No_argument "w"
885 "ignore-blank-lines\0" No_argument "B"
886 "text\0" No_argument "a"
887 "unified\0" Required_argument "U"
888 "label\0" Required_argument "L"
889 "show-c-function\0" No_argument "p"
890 "brief\0" No_argument "q"
891 "expand-tabs\0" No_argument "t"
892 "initial-tab\0" No_argument "T"
893 "recursive\0" No_argument "r"
894 "new-file\0" No_argument "N"
895 "report-identical-files\0" No_argument "s"
896 "starting-file\0" Required_argument "S"
897 "minimal\0" No_argument "d"
898 ;
899#endif
900
879int diff_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 901int diff_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
880int diff_main(int argc UNUSED_PARAM, char **argv) 902int diff_main(int argc UNUSED_PARAM, char **argv)
881{ 903{
@@ -887,6 +909,9 @@ int diff_main(int argc UNUSED_PARAM, char **argv)
887 909
888 /* exactly 2 params; collect multiple -L <label>; -U N */ 910 /* exactly 2 params; collect multiple -L <label>; -U N */
889 opt_complementary = "=2:L::U+"; 911 opt_complementary = "=2:L::U+";
912#if ENABLE_FEATURE_DIFF_LONG_OPTIONS
913 applet_long_options = diff_longopts;
914#endif
890 getopt32(argv, "abdiL:NqrsS:tTU:wupBE", 915 getopt32(argv, "abdiL:NqrsS:tTU:wupBE",
891 &L_arg, &s_start, &opt_U_context); 916 &L_arg, &s_start, &opt_U_context);
892 argv += optind; 917 argv += optind;