mirror of
https://github.com/ipxe/ipxe
synced 2025-12-15 17:12:54 +03:00
[ping] Allow "ping" command output to be inhibited
Originally-implemented-by: Cedric Levasseur <cyr-ius@ipocus.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -59,22 +59,24 @@ static void ping_callback ( struct sockaddr *peer, unsigned int sequence,
|
||||
* @v timeout Timeout between pings, in ticks
|
||||
* @v len Payload length
|
||||
* @v count Number of packets to send (or zero for no limit)
|
||||
* @v quiet Inhibit output
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int ping ( const char *hostname, unsigned long timeout, size_t len,
|
||||
unsigned int count ) {
|
||||
unsigned int count, int quiet ) {
|
||||
int rc;
|
||||
|
||||
/* Create pinger */
|
||||
if ( ( rc = create_pinger ( &monojob, hostname, timeout, len,
|
||||
count, ping_callback ) ) != 0 ) {
|
||||
if ( ( rc = create_pinger ( &monojob, hostname, timeout, len, count,
|
||||
( quiet ? NULL : ping_callback ) ) ) != 0 ){
|
||||
printf ( "Could not start ping: %s\n", strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Wait for ping to complete */
|
||||
if ( ( rc = monojob_wait ( NULL, 0 ) ) != 0 ) {
|
||||
printf ( "Finished: %s\n", strerror ( rc ) );
|
||||
if ( ! quiet )
|
||||
printf ( "Finished: %s\n", strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user