busybox: update to 1.28.2
[openwrt/staging/mkresin.git] / package / utils / busybox / patches / 230-add_nslookup_lede.patch
index 976960cf1a69f67c2ed6f6313c8056905a2f5124..f0ac4b51c15ab5270abd81a68d36f60a984fbb78 100644 (file)
@@ -17,8 +17,6 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
  2 files changed, 921 insertions(+)
  create mode 100644 networking/nslookup_lede.c
 
-diff --git a/Makefile.flags b/Makefile.flags
-index 65021de25..096ab7756 100644
 --- a/Makefile.flags
 +++ b/Makefile.flags
 @@ -134,6 +134,12 @@ else
@@ -34,12 +32,9 @@ index 65021de25..096ab7756 100644
  # libpam may use libpthread, libdl and/or libaudit.
  # On some platforms that requires an explicit -lpthread, -ldl, -laudit.
  # However, on *other platforms* it fails when some of those flags
-diff --git a/networking/nslookup_lede.c b/networking/nslookup_lede.c
-new file mode 100644
-index 000000000..c6c90ddf3
 --- /dev/null
 +++ b/networking/nslookup_lede.c
-@@ -0,0 +1,915 @@
+@@ -0,0 +1,914 @@
 +/*
 + * nslookup_lede - musl compatible replacement for busybox nslookup
 + *
@@ -58,23 +53,23 @@ index 000000000..c6c90ddf3
 + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 + */
 +
-+//config:config NSLOOKUP_LEDE
-+//config:     bool "nslookup_lede"
++//config:config NSLOOKUP_OPENWRT
++//config:     bool "nslookup_openwrt"
 +//config:     depends on !NSLOOKUP
 +//config:     default y
 +//config:     help
 +//config:       nslookup is a tool to query Internet name servers (LEDE flavor).
 +//config:
-+//config:config FEATURE_NSLOOKUP_LEDE_LONG_OPTIONS
++//config:config FEATURE_NSLOOKUP_OPENWRT_LONG_OPTIONS
 +//config:       bool "Enable long options"
 +//config:       default y
-+//config:       depends on NSLOOKUP_LEDE && LONG_OPTS
++//config:       depends on NSLOOKUP_OPENWRT && LONG_OPTS
 +//config:       help
 +//config:         Support long options for the nslookup applet.
 +
-+//applet:IF_NSLOOKUP_LEDE(APPLET(nslookup, BB_DIR_USR_BIN, BB_SUID_DROP))
++//applet:IF_NSLOOKUP_OPENWRT(APPLET(nslookup, BB_DIR_USR_BIN, BB_SUID_DROP))
 +
-+//kbuild:lib-$(CONFIG_NSLOOKUP_LEDE) += nslookup_lede.o
++//kbuild:lib-$(CONFIG_NSLOOKUP_OPENWRT) += nslookup_lede.o
 +
 +//usage:#define nslookup_lede_trivial_usage
 +//usage:       "[HOST] [SERVER]"
@@ -757,18 +752,6 @@ index 000000000..c6c90ddf3
 +      return buf;
 +}
 +
-+
-+#if ENABLE_FEATURE_NSLOOKUP_LEDE_LONG_OPTIONS
-+static const char nslookup_longopts[] ALIGN1 =
-+              "type\0"                Required_argument       "q"
-+              "querytype\0"   Required_argument       "q"
-+              "port\0"                Required_argument       "p"
-+              "retry\0"               Required_argument       "r"
-+              "timeout\0"             Required_argument       "t"
-+              "stats\0"               Required_argument       "s"
-+    ;
-+#endif
-+
 +int nslookup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 +int nslookup_main(int argc, char **argv)
 +{
@@ -783,14 +766,25 @@ index 000000000..c6c90ddf3
 +      unsigned int types = 0;
 +      HEADER *header;
 +
-+#if ENABLE_FEATURE_NSLOOKUP_LEDE_LONG_OPTIONS
-+      applet_long_options = nslookup_longopts;
-+#endif
++#if ENABLE_FEATURE_NSLOOKUP_OPENWRT_LONG_OPTIONS
++      static const char nslookup_longopts[] ALIGN1 =
++              "type\0"                Required_argument       "q"
++              "querytype\0"           Required_argument       "q"
++              "port\0"                Required_argument       "p"
++              "retry\0"               Required_argument       "r"
++              "timeout\0"             Required_argument       "t"
++              "stats\0"               No_argument             "s"
++      ;
 +
-+      opt_complementary = "q::";
-+      opts = getopt32(argv, "+q:*p:+r:+t:+s",
++      opts = getopt32long(argv, "^" "+q:*p:+r:+t:+s" "\0" "q::",
++                      nslookup_longopts,
 +                      &type_strings, &default_port,
 +                      &default_retry, &default_timeout);
++#else
++      opts = getopt32(argv, "^" "+q:*p:+r:+t:+s" "\0" "q::",
++                      &type_strings, &default_port,
++                      &default_retry, &default_timeout);
++#endif
 +
 +      while (type_strings) {
 +              ptr = llist_pop(&type_strings);
@@ -955,6 +949,3 @@ index 000000000..c6c90ddf3
 +
 +      return rc;
 +}
--- 
-2.11.0
-