shithub: riscv

Download patch

ref: d904a57e1763ac884a749b04f19f3e490a4cec88
parent: 396844787c65f42dc77f65c259dcff39eb63578b
author: Alex Musolino <[email protected]>
date: Tue Jun 11 11:19:18 EDT 2019

snoopy(8): avoid extra spaces in dhcp filter output

--- a/sys/src/cmd/ip/snoopy/dhcp.c
+++ b/sys/src/cmd/ip/snoopy/dhcp.c
@@ -65,9 +65,14 @@
 static char*
 pserver(char *p, char *e, char *tag, uchar *o, int n)
 {
+	int i;
+
 	p = seprint(p, e, "%s=(", tag);
+	i = 0;
 	while(n >= 4){
-		p = seprint(p, e, " %V", o);
+		if(i++ > 0)
+			p = seprint(p, e, " ");
+		p = seprint(p, e, "%V", o);
 		n -= 4;
 		o += 4;
 	}
@@ -345,7 +350,7 @@
 		case OBend:
 			goto out;
 		default:
-			snprint(msg, sizeof msg, " T%ud", code);
+			snprint(msg, sizeof msg, "T%ud", code);
 			p = phex(p, e, msg, o, n);
 			break;
 		}