Remove %I and %A

This commit is contained in:
Sergio R. Caprile
2023-02-02 16:28:24 -03:00
parent b2a76dba98
commit 5d7a080e39
3 changed files with 124 additions and 80 deletions
-20
View File
@@ -310,26 +310,6 @@ size_t mg_vxprintf(void (*out)(char, void *), void *param, const char *fmt,
n += scpy(out, param, (char *) &hex[p[j] & 15], 1);
}
n += scpy(out, param, (char *) &dquote, 1);
} else if (c == 'I') {
// Print IPv4 or IPv6 address
size_t len = (size_t) va_arg(*ap, int); // Length 16 means IPv6 address
uint8_t *buf = va_arg(*ap, uint8_t *); // Pointer to the IP address
if (len == 6) {
uint16_t *p = (uint16_t *) buf;
n += mg_xprintf(out, param, "%x:%x:%x:%x:%x:%x:%x:%x", mg_htons(p[0]),
mg_htons(p[1]), mg_htons(p[2]), mg_htons(p[3]),
mg_htons(p[4]), mg_htons(p[5]), mg_htons(p[6]),
mg_htons(p[7]));
} else {
n += mg_xprintf(out, param, "%d.%d.%d.%d", (int) buf[0], (int) buf[1],
(int) buf[2], (int) buf[3]);
}
} else if (c == 'A') {
// Print hardware addresses (currently Ethernet MAC)
uint8_t *buf = va_arg(*ap, uint8_t *); // Pointer to the hw address
n += mg_xprintf(out, param, "%02x:%02x:%02x:%02x:%02x:%02x",
(int) buf[0], (int) buf[1], (int) buf[2], (int) buf[3],
(int) buf[4], (int) buf[5]);
} else if (c == 'V') {
// Print base64-encoded double-quoted string
size_t len = (size_t) va_arg(*ap, int);