tadd alternate format - plan9port - [fork] Plan 9 from user space (HTM) git clone git://src.adamsgaard.dk/plan9port (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 821fff983b323113fafc0efbb205b2876985a145 (DIR) parent a4bbf47b33cbb5492ad9f6d17c999bbcea4fefcd (HTM) Author: rsc <devnull@localhost> Date: Mon, 26 Dec 2005 03:58:20 +0000 add alternate format Diffstat: M src/libip/eipfmt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- (DIR) diff --git a/src/libip/eipfmt.c b/src/libip/eipfmt.c t@@ -28,8 +28,10 @@ int eipfmt(Fmt *f) { char buf[5*8]; - static char *efmt = "%.2lux%.2lux%.2lux%.2lux%.2lux%.2lux"; + static char *efmt = "%.2ux%.2ux%.2ux%.2ux%.2ux%.2ux"; + static char *altefmt = "%.2ux:%.2ux:%.2ux:%.2ux:%.2ux:%.2ux"; static char *ifmt = "%d.%d.%d.%d"; + char *fmt; uchar *p, ip[16]; ulong *lp; ushort s; t@@ -54,6 +56,9 @@ eipfmt(Fmt *f) switch(f->r) { case 'E': /* Ethernet address */ p = va_arg(f->args, uchar*); + fmt = efmt; + if(f->flags&FmtSharp) + fmt = altefmt; snprint(buf, sizeof buf, efmt, p[0], p[1], p[2], p[3], p[4], p[5]); return fmtstrcpy(f, buf);