Displaying 1 result from an estimated 1 matches for "parse_quad".
2019 Apr 18
0
[PATCH] efi/pxe.c: Allow ipv4 host names
...@@ int reset_pxe(void)
#define DNS_MAX_SERVERS 4 /* Max no of DNS servers */
uint32_t dns_server[DNS_MAX_SERVERS] = {0, };
+
+/*
+ * parse the ip_str and return the ip address with *res.
+ * return true if the whole string was consumed and the result
+ * was valid.
+ *
+ */
+static bool parse_quad(const char *ip_str, uint32_t *res)
+{
+ const char *p = ip_str;
+ uint8_t part = 0;
+ uint32_t ip = 0;
+ int i;
+
+ for (i = 0; i < 4; i++) {
+ while (is_digit(*p)) {
+ part = part * 10 + *p - '0';
+ p++;
+ }
+ if (i != 3 &&am...