diff: support long options
authorMatheus Izvekov <mizvekov@gmail.com>
Mon, 18 Jan 2010 20:40:02 +0000 (18:40 -0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 20 Jan 2010 01:45:23 +0000 (02:45 +0100)
>>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>
editors/Config.in
editors/diff.c

index e1285f4eaf7ca173642aa6f7a87796b3f641842e..e4fdd0f384fd00ac5202983e9f127f923ec48417 100644 (file)
@@ -35,6 +35,13 @@ config DIFF
          differences between them in a form that can be given to
          the patch command.
 
+config FEATURE_DIFF_LONG_OPTIONS
+       bool "Enable long options"
+       default n
+       depends on DIFF && LONG_OPTS
+       help
+         Enable use of long options.
+
 config FEATURE_DIFF_DIR
        bool "Enable directory support"
        default y
index 772610477ea66c880f89e37b09769c1a5ec4296e..9d0373f9350777f6c018195e10ab0d25613bd4f9 100644 (file)
@@ -876,6 +876,28 @@ static void diffdir(char *p[2], const char *s_start)
 }
 #endif
 
+#if ENABLE_FEATURE_DIFF_LONG_OPTIONS
+static const char diff_longopts[] ALIGN1 =
+       "ignore-case\0"              No_argument       "i"
+       "ignore-tab-expansion\0"     No_argument       "E"
+       "ignore-space-change\0"      No_argument       "b"
+       "ignore-all-space\0"         No_argument       "w"
+       "ignore-blank-lines\0"       No_argument       "B"
+       "text\0"                     No_argument       "a"
+       "unified\0"                  Required_argument "U"
+       "label\0"                    Required_argument "L"
+       "show-c-function\0"          No_argument       "p"
+       "brief\0"                    No_argument       "q"
+       "expand-tabs\0"              No_argument       "t"
+       "initial-tab\0"              No_argument       "T"
+       "recursive\0"                No_argument       "r"
+       "new-file\0"                 No_argument       "N"
+       "report-identical-files\0"   No_argument       "s"
+       "starting-file\0"            Required_argument "S"
+       "minimal\0"                  No_argument       "d"
+       ;
+#endif
+
 int diff_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int diff_main(int argc UNUSED_PARAM, char **argv)
 {
@@ -887,6 +909,9 @@ int diff_main(int argc UNUSED_PARAM, char **argv)
 
        /* exactly 2 params; collect multiple -L <label>; -U N */
        opt_complementary = "=2:L::U+";
+#if ENABLE_FEATURE_DIFF_LONG_OPTIONS
+       applet_long_options = diff_longopts;
+#endif
        getopt32(argv, "abdiL:NqrsS:tTU:wupBE",
                        &L_arg, &s_start, &opt_U_context);
        argv += optind;