]> git.ozlabs.org Git - ccan/blobdiff - ccan/opt/usage.c
Merge branch 'io'
[ccan] / ccan / opt / usage.c
index d9b2ee59cc3e4ba9a10df5a5eb358a74b5b4fb89..1142fb85c9c91ca091172d8971fe58101d0beca6 100644 (file)
@@ -1,6 +1,8 @@
 /* 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>
@@ -58,7 +60,7 @@ static char *add_str_len(char *base, size_t *len, size_t *max,
                         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;
@@ -72,7 +74,7 @@ static char *add_str(char *base, size_t *len, size_t *max, const char *str)
 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;