Sadly, this is what existing scripts seem to do. --- toys/net/ping.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
From 994b448d09927adf948e48241a4904773ebb6810 Mon Sep 17 00:00:00 2001 From: Elliott Hughes <e...@google.com> Date: Wed, 13 Jun 2018 15:01:17 -0700 Subject: [PATCH] ping: support ping6 as a synonym for `ping -6`.
Sadly, this is what existing scripts seem to do. --- toys/net/ping.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/toys/net/ping.c b/toys/net/ping.c index f7c6ca1..c329949 100644 --- a/toys/net/ping.c +++ b/toys/net/ping.c @@ -12,6 +12,7 @@ // -s > 4088 = sizeof(toybuf)-sizeof(struct icmphdr), then kernel adds 20 bytes USE_PING(NEWTOY(ping, "<1>1m#t#<0>255=64c#<0=3s#<0>4088=56I:i:W#<0=10w#<0qf46[-46]", TOYFLAG_USR|TOYFLAG_BIN)) +USE_PING(OLDTOY(ping6, ping, TOYFLAG_USR|TOYFLAG_BIN)) config PING bool "ping" @@ -125,7 +126,7 @@ void ping_main(void) if ((toys.optflags&(FLAG_f|FLAG_c)) == FLAG_f) TT.c = 15; // ipv4 or ipv6? (0 = autodetect if -I or arg have only one address type.) - if (toys.optflags&FLAG_6) family = AF_INET6; + if (toys.optflags&FLAG_6 || toys.which->name[4] == '6') family = AF_INET6; else if (toys.optflags&FLAG_4) family = AF_INET; else family = 0; -- 2.18.0.rc1.242.g61856ae69a-goog
_______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net