HomeFreeBSD

ping: Fix the spacing between the time stamp and cp/dp

Description

ping: Fix the spacing between the time stamp and cp/dp

When an echo reply packet is received, the data is compared with the
sent data. When a wrong byte is detected the command displays a report
with the differences.

The first row (the first 8-bytes of data after the ICMP header) should
include the time stamp (if data is at least 8-bytes), this value is not
taken into consideration for the comparison. The remaining rows
represent the data (padded pattern) received/sent, with each byte being
compared for differences.

Print the space before (not after), to add an extra space after cp:/dp:
for better readability when the first time stamp octet is not
zero-padded, and to remove trailing spaces in the output.

Before:

cp:99  0  0  c  1  5  c  0␣
	ab cd ab cd ab cd ab cd ab cd ab cd ab cd ab cd␣
	...

After:

cp: 99  0  0  c  1  5  c  0
	 ab cd ab cd ab cd ab cd ab cd ab cd ab cd ab cd
	 ...

Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/863
Differential Revision: https://reviews.freebsd.org/D39492

(cherry picked from commit 8db2c5802abe14543504e17ab5ed6325088a63f3)

Details

Provenance
jlduran_gmail.comAuthored on Apr 10 2023, 4:58 PM
markjCommitted on Nov 6 2023, 4:45 PM
Reviewer
markj
Differential Revision
D39492: ping: Fix the spacing between the time stamp and cp/dp
Parents
rGe2c9158f1a99: ping: Unify ping/ping6 statistics section
Branches
Unknown
Tags
Unknown