diff options
author | 2004-01-21 00:46:38 +0000 | |
---|---|---|
committer | 2004-01-21 00:46:38 +0000 | |
commit | eb5f22fdd8ee1855ee9f54d484b829687c023b92 (patch) | |
tree | 32c6dac1d036ac28168265a5673f69c8e466780c | |
parent | Replace some strncpy() calls with strlcpy() (diff) | |
download | wireguard-openbsd-eb5f22fdd8ee1855ee9f54d484b829687c023b92.tar.xz wireguard-openbsd-eb5f22fdd8ee1855ee9f54d484b829687c023b92.zip |
support format `%p' to print pointers in eformat()
-rw-r--r-- | usr.bin/mg/echo.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/mg/echo.c b/usr.bin/mg/echo.c index 7244f394ecc..6bd94fe1b10 100644 --- a/usr.bin/mg/echo.c +++ b/usr.bin/mg/echo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: echo.c,v 1.26 2003/04/16 17:30:49 millert Exp $ */ +/* $OpenBSD: echo.c,v 1.27 2004/01/21 00:46:38 vincent Exp $ */ /* * Echo line reading and writing. @@ -609,7 +609,7 @@ ewprintf(const char *fmt, ...) static void eformat(const char *fp, va_list ap) { - char kname[NKNAME], *cp; + char kname[NKNAME], tmp[100], *cp; int c; while ((c = *fp++) != '\0') { @@ -641,6 +641,12 @@ eformat(const char *fp, va_list ap) eputi(va_arg(ap, int), 8); break; + case 'p': + snprintf(tmp, sizeof tmp, "%p", + va_arg(ap, void *)); + eputs(tmp); + break; + case 's': eputs(va_arg(ap, char *)); break; |