diff options
author | rsc <devnull@localhost> | 2005-12-26 03:58:20 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-12-26 03:58:20 +0000 |
commit | 821fff983b323113fafc0efbb205b2876985a145 (patch) | |
tree | f556408df3c7687e6c45455d614e8edbc348bab0 /src/libip | |
parent | a4bbf47b33cbb5492ad9f6d17c999bbcea4fefcd (diff) | |
download | plan9port-821fff983b323113fafc0efbb205b2876985a145.tar.gz plan9port-821fff983b323113fafc0efbb205b2876985a145.tar.bz2 plan9port-821fff983b323113fafc0efbb205b2876985a145.zip |
add alternate format
Diffstat (limited to 'src/libip')
-rw-r--r-- | src/libip/eipfmt.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libip/eipfmt.c b/src/libip/eipfmt.c index b3fc44c7..fca028ee 100644 --- a/src/libip/eipfmt.c +++ b/src/libip/eipfmt.c @@ -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; @@ -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); |