~mdw
/
tripe
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
server/admin.c (a_format): Introduce `?ERR' for explicitly named errors.
[tripe]
/
server
/
admin.c
diff --git
a/server/admin.c
b/server/admin.c
index
6ff1418
..
6ff0dbf
100644
(file)
--- a/
server/admin.c
+++ b/
server/admin.c
@@
-260,7
+260,9
@@
static void a_flush(int fd, unsigned mode, void *v)
*
* * "?PEER" PEER -- peer's name
*
*
* * "?PEER" PEER -- peer's name
*
- * * "?ERRNO" ERRNO -- system error code
+ * * "?ERR" CODE -- system error code
+ *
+ * * "?ERRNO" -- system error code from @errno@
*
* * "[!]..." ... -- @dstr_putf@-like string as single token
*/
*
* * "[!]..." ... -- @dstr_putf@-like string as single token
*/
@@
-303,7
+305,11
@@
void a_vformat(dstr *d, const char *fmt, va_list *ap)
while (*av) u_quotify(d, *av++);
} else if (strcmp(fmt, "?PEER") == 0)
u_quotify(d, p_name(va_arg(*ap, peer *)));
while (*av) u_quotify(d, *av++);
} else if (strcmp(fmt, "?PEER") == 0)
u_quotify(d, p_name(va_arg(*ap, peer *)));
- else if (strcmp(fmt, "?ERRNO") == 0) {
+ else if (strcmp(fmt, "?ERR") == 0) {
+ int e = va_arg(*ap, int);
+ dstr_putf(d, " E%d", e);
+ u_quotify(d, strerror(e));
+ } else if (strcmp(fmt, "?ERRNO") == 0) {
dstr_putf(d, " E%d", errno);
u_quotify(d, strerror(errno));
} else
dstr_putf(d, " E%d", errno);
u_quotify(d, strerror(errno));
} else