Hi, @misc!

Here is a very simply hack to ping. It isn't pretend to something, hope
it will be useful for anybody as endless host checking in scripts.

% ping -Q example.com && echo 'abc' > /dev/speaker  # etc..

Index: ping.8
===================================================================
RCS file: /cvs/src/sbin/ping/ping.8,v
retrieving revision 1.31
diff -r1.31 ping.8
44c44
< .Op Fl DdfLnqRrv
---
> .Op Fl DdfLnQqRrv
141a142,144
> .It Fl Q
> Immediately exit program returning 0 exit status when at least ONE
> ICMP ECHO_REPLY packet has been received.
Index: ping.c
===================================================================
RCS file: /cvs/src/sbin/ping/ping.c,v
retrieving revision 1.77
diff -r1.77 ping.c
122a123
> #define F_REPLYQUIT   0x2000
214c215
<           "DI:LRS:c:dfi:jl:np:qrs:T:t:vw:")) != -1)
---
>           "DI:LRS:c:dfi:jl:np:qrs:T:t:vw:xQ")) != -1)
319a321,323
>               case 'Q':
>                       options |= F_REPLYQUIT;
>                       break;
496c500
<
---
>
506a511,517
>               /*
>                * Quickly exit program with exit code 0 if -Q is used
>                * and we've received at least one ECHO_REPLY packet.
>                */
>               if (options & F_REPLYQUIT && nreceived > 0)
>                       finish(0);
>
1345c1356
<           "usage: ping [-DdfjLnqRrv] [-c count] [-I ifaddr] [-i wait]
\n" ---
>           "usage: ping [-DdfjLnqRrvQ] [-c count] [-I ifaddr] [-i wait]
> \n"


-- 
    "God is real, unless declared integer."

Reply via email to