diff --git a/system/ping/ping.c b/system/ping/ping.c index 9c063b711..e969603de 100644 --- a/system/ping/ping.c +++ b/system/ping/ping.c @@ -64,28 +64,36 @@ * Name: show_usage ****************************************************************************/ -static void show_usage(FAR const char *progname, int exitcode) noreturn_function; +static void show_usage(FAR const char *progname, int exitcode) + noreturn_function; static void show_usage(FAR const char *progname, int exitcode) { #if defined(CONFIG_LIBC_NETDB) && defined(CONFIG_NETDB_DNSCLIENT) - printf("\nUsage: %s [-c ] [-i ] [-W ] [-s ] \n", progname); + printf("\nUsage: %s [-c ] [-i ] [-W ] " + "[-s ] \n", progname); printf(" %s -h\n", progname); printf("\nWhere:\n"); - printf(" is either an IPv4 address or the name of the remote host\n"); + printf(" is either an IPv4 address or the name of " + "the remote host\n"); printf(" that is requested the ICMPv4 ECHO reply.\n"); #else - printf("\nUsage: %s [-c ] [-i ] [-W ] [-s ] \n", progname); + printf("\nUsage: %s [-c ] [-i ] [-W ] " + "[-s ] \n", progname); printf(" %s -h\n", progname); printf("\nWhere:\n"); - printf(" is the IPv4 address request the ICMP ECHO reply.\n"); + printf(" is the IPv4 address request the ICMP " + "ECHO reply.\n"); #endif printf(" -c determines the number of pings. Default %u.\n", ICMP_NPINGS); - printf(" -i is the default delay between pings (milliseconds).\n"); + printf(" -i is the default delay between pings " + "(milliseconds).\n"); printf(" Default %d.\n", ICMP_POLL_DELAY); - printf(" -W is the timeout for wait response (milliseconds).\n"); + printf(" -W is the timeout for wait response " + "(milliseconds).\n"); printf(" Default %d.\n", ICMP_POLL_DELAY); - printf(" -s specifies the number of data bytes to be sent. Default %u.\n", + printf(" -s specifies the number of data bytes to be sent. " + "Default %u.\n", ICMP_PING_DATALEN); printf(" -h shows this text and exits.\n"); exit(exitcode); @@ -114,8 +122,8 @@ static void ping_result(FAR const struct ping_result_s *result) case ICMP_I_BEGIN: printf("PING %u.%u.%u.%u %u bytes of data\n", - (result->dest.s_addr ) & 0xff, - (result->dest.s_addr >> 8 ) & 0xff, + (result->dest.s_addr) & 0xff, + (result->dest.s_addr >> 8) & 0xff, (result->dest.s_addr >> 16) & 0xff, (result->dest.s_addr >> 24) & 0xff, result->info->datalen); @@ -137,8 +145,8 @@ static void ping_result(FAR const struct ping_result_s *result) case ICMP_W_TIMEOUT: printf("No response from %u.%u.%u.%u: icmp_seq=%u time=%d ms\n", - (result->dest.s_addr ) & 0xff, - (result->dest.s_addr >> 8 ) & 0xff, + (result->dest.s_addr) & 0xff, + (result->dest.s_addr >> 8) & 0xff, (result->dest.s_addr >> 16) & 0xff, (result->dest.s_addr >> 24) & 0xff, result->seqno, result->extra); @@ -173,8 +181,8 @@ static void ping_result(FAR const struct ping_result_s *result) case ICMP_I_ROUNDTRIP: printf("%u bytes from %u.%u.%u.%u: icmp_seq=%u time=%d ms\n", result->info->datalen, - (result->dest.s_addr ) & 0xff, - (result->dest.s_addr >> 8 ) & 0xff, + (result->dest.s_addr) & 0xff, + (result->dest.s_addr >> 8) & 0xff, (result->dest.s_addr >> 16) & 0xff, (result->dest.s_addr >> 24) & 0xff, result->seqno, result->extra); @@ -207,7 +215,8 @@ static void ping_result(FAR const struct ping_result_s *result) (result->nrequests >> 1)) / result->nrequests; - printf("%u packets transmitted, %u received, %u%% packet loss, time %d ms\n", + printf("%u packets transmitted, %u received, %u%% packet loss, " + "time %d ms\n", result->nrequests, result->nreplies, tmp, result->extra); } break; @@ -244,7 +253,8 @@ int main(int argc, FAR char *argv[]) long count = strtol(optarg, &endptr, 10); if (count < 1 || count > UINT16_MAX) { - fprintf(stderr, "ERROR: out of range: %ld\n", count); + fprintf(stderr, "ERROR: out of range: %ld\n", + count); goto errout_with_usage; } @@ -257,7 +267,8 @@ int main(int argc, FAR char *argv[]) long delay = strtol(optarg, &endptr, 10); if (delay < 1 || delay > UINT16_MAX) { - fprintf(stderr, "ERROR: out of range: %ld\n", delay); + fprintf(stderr, "ERROR: out of range: %ld\n", + delay); goto errout_with_usage; } @@ -270,7 +281,8 @@ int main(int argc, FAR char *argv[]) long timeout = strtol(optarg, &endptr, 10); if (timeout < 1 || timeout > UINT16_MAX) { - fprintf(stderr, "ERROR: out of range: %ld\n", timeout); + fprintf(stderr, "ERROR: out of range: %ld\n", + timeout); goto errout_with_usage; } @@ -283,7 +295,8 @@ int main(int argc, FAR char *argv[]) long datalen = strtol(optarg, &endptr, 10); if (datalen < 1 || datalen > UINT16_MAX) { - fprintf(stderr, "ERROR: out of range: %ld\n", datalen); + fprintf(stderr, "ERROR: out of range: %ld\n", + datalen); goto errout_with_usage; }