changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: snoopy(8): avoid extra spaces in dhcp filter output

changeset 7265: ff77c8e6d1a0
parent 7264: 2a3c4f34c585
child 7266: 9c6308ab12e0
author: Alex Musolino <alex@musolino.id.au>
date: Tue, 11 Jun 2019 15:19:18 +0930
files: sys/src/cmd/ip/snoopy/dhcp.c
description: snoopy(8): avoid extra spaces in dhcp filter output
     1.1--- a/sys/src/cmd/ip/snoopy/dhcp.c
     1.2+++ b/sys/src/cmd/ip/snoopy/dhcp.c
     1.3@@ -65,9 +65,14 @@ puint(char *p, char *e, char *tag, uchar
     1.4 static char*
     1.5 pserver(char *p, char *e, char *tag, uchar *o, int n)
     1.6 {
     1.7+	int i;
     1.8+
     1.9 	p = seprint(p, e, "%s=(", tag);
    1.10+	i = 0;
    1.11 	while(n >= 4){
    1.12-		p = seprint(p, e, " %V", o);
    1.13+		if(i++ > 0)
    1.14+			p = seprint(p, e, " ");
    1.15+		p = seprint(p, e, "%V", o);
    1.16 		n -= 4;
    1.17 		o += 4;
    1.18 	}
    1.19@@ -345,7 +350,7 @@ p_seprint(Msg *m)
    1.20 		case OBend:
    1.21 			goto out;
    1.22 		default:
    1.23-			snprint(msg, sizeof msg, " T%ud", code);
    1.24+			snprint(msg, sizeof msg, "T%ud", code);
    1.25 			p = phex(p, e, msg, o, n);
    1.26 			break;
    1.27 		}