Home | History | Annotate | Download | only in utils

Lines Matching refs:txt

40 static const char * hwaddr_parse(const char *txt, u8 *addr)
47 a = hex2byte(txt);
50 txt += 2;
52 if (i < ETH_ALEN - 1 && *txt++ != ':')
55 return txt;
61 * @txt: MAC address as a string (e.g., "00:11:22:33:44:55")
65 int hwaddr_aton(const char *txt, u8 *addr)
67 return hwaddr_parse(txt, addr) ? 0 : -1;
73 * @txt: MAC address with optional mask as a string (e.g., "00:11:22:33:44:55/ff:ff:ff:ff:00:00")
79 int hwaddr_masked_aton(const char *txt, u8 *addr, u8 *mask, u8 maskable)
84 r = hwaddr_parse(txt, addr);
109 * @txt: MAC address as a string (e.g., "001122334455")
113 int hwaddr_compact_aton(const char *txt, u8 *addr)
120 a = hex2num(*txt++);
123 b = hex2num(*txt++);
134 * @txt: MAC address as a string (e.g., 00:11:22:33:44:55 or 0011.2233.4455)
138 int hwaddr_aton2(const char *txt, u8 *addr)
141 const char *pos = txt;
158 return pos - txt;
466 void printf_encode(char *txt, size_t maxlen, const u8 *data, size_t len)
468 char *end = txt + maxlen;
472 if (txt + 4 >= end)
477 *txt++ = '\\';
478 *txt++ = '\"';
481 *txt++ = '\\';
482 *txt++ = '\\';
485 *txt++ = '\\';
486 *txt++ = 'e';
489 *txt++ = '\\';
490 *txt++ = 'n';
493 *txt++ = '\\';
494 *txt++ = 'r';
497 *txt++ = '\\';
498 *txt++ = 't';
502 *txt++ = data[i];
504 txt += os_snprintf(txt, end - txt, "\\x%02x",
511 *txt = '\0';