diff options
| author | rsc <devnull@localhost> | 2004-04-19 19:29:25 +0000 |
|---|---|---|
| committer | rsc <devnull@localhost> | 2004-04-19 19:29:25 +0000 |
| commit | a84cbb2a17c9d0b88c561d5b7cb50d79a19e7c46 (patch) | |
| tree | 59a0e921597e5aa53e83d487c16727a7bf01547a /src/libmach/hexify.c | |
| parent | 0e3cc9f456ea49919459bf1164d0c8309a6134fa (diff) | |
| download | plan9port-a84cbb2a17c9d0b88c561d5b7cb50d79a19e7c46.tar.gz plan9port-a84cbb2a17c9d0b88c561d5b7cb50d79a19e7c46.zip | |
libmach
Diffstat (limited to 'src/libmach/hexify.c')
| -rw-r--r-- | src/libmach/hexify.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libmach/hexify.c b/src/libmach/hexify.c new file mode 100644 index 00000000..5f3ed50e --- /dev/null +++ b/src/libmach/hexify.c @@ -0,0 +1,20 @@ +#include <u.h> +#include <libc.h> +#include <bio.h> +#include <mach.h> + +char * +_hexify(char *buf, ulong p, int zeros) +{ + ulong d; + + d = p/16; + if(d) + buf = _hexify(buf, d, zeros-1); + else + while(zeros--) + *buf++ = '0'; + *buf++ = "0123456789abcdef"[p&0x0f]; + return buf; +} + |
