search for: append_output

Displaying 1 result from an estimated 1 matches for "append_output".

2007 Apr 10
1
[PATCH] Add support for DHCP-Options
...ize_t len) +{ + char *out = NULL; + const char test[] = "UNKNOWN"; + + if (len >= 5 && memcmp(str, "dhcp/", 5) == 0) { + out = getvar_dhcp(str+5, len-5); + } + + if (out == NULL) { + out = malloc(sizeof(test)); + strcpy(out, test); + } + + return out; +} + +void append_output(char **out, size_t *outlen, const char *str, size_t len) +{ + size_t used; + + used = (*out != NULL) ? strlen(*out) : 0; + if (used + len + 1 > *outlen) { + *outlen += 256 + (len & ~255); + *out = realloc(*out, *outlen); + } + memcpy(*out + used, str, len); + (*out)[used+len] = '\0...