/* Licensed under GPLv3+ - see LICENSE file for details */
#include <ccan/opt/opt.h>
#include <sys/ioctl.h>
+#include <sys/termios.h> /* Required on Solaris for struct winsize */
+#include <sys/unistd.h> /* Required on Solaris for ioctl */
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
const char *str, size_t slen)
{
if (slen >= *max - *len)
- base = realloc(base, *max = (*max * 2 + slen + 1));
+ base = opt_alloc.realloc(base, *max = (*max * 2 + slen + 1));
memcpy(base + *len, str, slen);
*len += slen;
return base;
static char *add_indent(char *base, size_t *len, size_t *max, size_t indent)
{
if (indent >= *max - *len)
- base = realloc(base, *max = (*max * 2 + indent + 1));
+ base = opt_alloc.realloc(base, *max = (*max * 2 + indent + 1));
memset(base + *len, ' ', indent);
*len += indent;
return base;