Lines Matching defs:txt
41 static const char * hwaddr_parse(const char *txt, u8 *addr)
48 a = hex2byte(txt);
51 txt += 2;
53 if (i < ETH_ALEN - 1 && *txt++ != ':')
56 return txt;
62 * @txt: MAC address as a string (e.g., "00:11:22:33:44:55")
66 int hwaddr_aton(const char *txt, u8 *addr)
68 return hwaddr_parse(txt, addr) ? 0 : -1;
74 * @txt: MAC address with optional mask as a string (e.g., "00:11:22:33:44:55/ff:ff:ff:ff:00:00")
80 int hwaddr_masked_aton(const char *txt, u8 *addr, u8 *mask, u8 maskable)
85 r = hwaddr_parse(txt, addr);
110 * @txt: MAC address as a string (e.g., "001122334455")
114 int hwaddr_compact_aton(const char *txt, u8 *addr)
121 a = hex2num(*txt++);
124 b = hex2num(*txt++);
135 * @txt: MAC address as a string (e.g., 00:11:22:33:44:55 or 0011.2233.4455)
139 int hwaddr_aton2(const char *txt, u8 *addr)
142 const char *pos = txt;
159 return pos - txt;
477 void printf_encode(char *txt, size_t maxlen, const u8 *data, size_t len)
479 char *end = txt + maxlen;
483 if (txt + 4 >= end)
488 *txt++ = '\\';
489 *txt++ = '\"';
492 *txt++ = '\\';
493 *txt++ = '\\';
496 *txt++ = '\\';
497 *txt++ = 'e';
500 *txt++ = '\\';
501 *txt++ = 'n';
504 *txt++ = '\\';
505 *txt++ = 'r';
508 *txt++ = '\\';
509 *txt++ = 't';
513 *txt++ = data[i];
515 txt += os_snprintf(txt, end - txt, "\\x%02x",
522 *txt = '\0';