Hi Rodrigo, Rodrigo Arias <rodarima@gmail.com> wrote:
I don't have a machine with OpenBSD at hand, can you test if the build succeeds using the current master code in OpenBSD with these CFLAGS? It does on Linux:
% git clone https://git.dillo-browser.org/plugins/gopher && cd gopher % make CC=clang CFLAGS= "-Wall -std=c99 -D_POSIX_C_SOURCE=200112L"
$ make CC=clang CFLAGS="-Wall -std=c99 -D_POSIX_C_SOURCE=200112L" clang -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -I/usr/local/include -I/usr/X11R6/include -c io.c io.c:84:20: error: use of undeclared identifier 'AF_UNSPEC' 84 | hints.ai_family = AF_UNSPEC; | ^ io.c:95:8: warning: call to undeclared function 'socket'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 95 | fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); | ^ io.c:97:7: warning: call to undeclared function 'connect'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 97 | if (connect(fd, rp->ai_addr, rp->ai_addrlen) == 0) break; | ^ 2 warnings and 1 error generated.
There are many warnings that should be fixed (as below), but the current includes should work otherwise. If not, does adding the extra
+ #include <sys/socket.h>
line solves it?
Looks better, now we get this: $ make CC=clang CFLAGS="-Wall -std=c99 -D_POSIX_C_SOURCE=200112L" clang -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -I/usr/local/include -I/usr/X11R6/include -c io.c clang -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -I/usr/local/include -I/usr/X11R6/include -c dpi.c dpi.c:19:47: warning: format specifies type 'unsigned int *' but the argument has type 'char *' [-Wformat] 19 | rc = sscanf(buf, "<cmd='auth' msg='%4x' '>", key); | ~~~ ^~~ | %3s dpi.c:26:35: warning: format specifies type 'unsigned int *' but the argument has type 'char *' [-Wformat] 26 | rc = sscanf(keys, "%*d %4x' '>", local_key); | ~~~ ^~~~~~~~~ | %3s dpi.c:27:34: warning: field precision should have type 'int', but argument has type 'ssize_t' (aka 'long') [-Wformat] 27 | if (rc < 0) err(1, "comm key: %.*s", sz, keys); | ~~^~ ~~ dpi.c:28:35: warning: field precision should have type 'int', but argument has type 'ssize_t' (aka 'long') [-Wformat] 28 | if (rc < 1) errx(1, "comm key: %.*s", sz, keys); | ~~^~ ~~ dpi.c:18:2: warning: array index 30 is past the end of the array (that has type 'char[30]') [-Warray-bounds] 18 | buf[30] = '\0'; | ^ ~~ dpi.c:10:2: note: array 'buf' declared here 10 | char buf[30]; | ^ dpi.c:41:31: warning: field precision should have type 'int', but argument has type 'unsigned long' [-Wformat] 41 | err(1, "bad open_url cmd: %.*s", sizeof(buf), buf); | ~~^~ ~~~~~~~~~~~ dpi.c:51:26: warning: field precision should have type 'int', but argument has type 'size_t' (aka 'unsigned long') [-Wformat] 51 | err(1, "bad url end: %.*s", len, url_buf); | ~~^~ ~~~ 7 warnings generated. Regards, Alex