~donmcc/ood

Add `ood_alloc_indent_lines_by()` function.

Improve printing of incoming requests to stdout by indenting subsequent
lines of the request.

Created the `log.h/.c` files in `libood` and added
`ood_alloc_indent_lines_by()`.

Updated the `connection_on_read()` function to indent the request buffer
when printing it out.
Better names for "select set" functions.

Rename `ood_select_sets_add_errorable()` to
`ood_select_sets_check_for_error()`.

Rename `ood_select_sets_add_reader()` to
`ood_select_sets_check_for_read()`.

Rename `ood_select_sets_add_writer()` to
`ood_select_sets_check_for_write()`.
Add `ood_halt()` function.

Unify points where we print an error and exit before it gets messy by
introducting the `ood_halt()` and `ood_halt_on_error()` functions.  The
former prints a caller-provided message and halts; the latter prints the
system error message for the current value of `errno` and exits, using
`errno` as the process exit status value.
Rename `server_add_connection()` function.

Change the `server_add_connection()` and `server_close_connection()`
functions to `server_add_socket()` and `server_close_socket()` since
these are used for both listeners and connnection sockets.

Also, in `ood_inet_socket_accept()`, make sure to close the file
descriptor if `alloc_connection()` fails.
Added a "todo" item.
Correctly initialize new memory in `ood_ptr_array_add_realloc()`.

Since `realloc()` doesn't zero-out new capacity when growing a memory
block, explicitly calculate the uninitialized memory area and zero it
out, since `ptr_array` uses NULL as an empty item placeholder.
Add `ood_ptr_array_add_realloc()` function.

Enable a ptr array to grow dynamically by adding the "add realloc"
function.

If the current capacity is less than 16, grow the capacity to 16 when
adding to a full ptr array; otherwise grow the capacity by a factor of 1.5.

See https://github.com/facebook/folly/blob/main/folly/docs/FBVector.md#memory-handling
for reasoning behind the growth factor.
Changed signature of `ood_ptr_array_next()` function.

Dropped the out-param `item_out` and instead return the next item
directly, or NULL when there are no more items.  The previous
`ood_result` value only returned `ood_error` when there was no next
item, and a NULL value does that more idiomatically.

Also added `ood_ptr_array_previous()` to iterate through the items in
the ptr array in reverse order.

Refactored `ood_ptr_array_first()` and `ood_ptr_array_last()` to call
`ood_ptr_array_next()` and `ood_ptr_array_previous()` once respectively
to locate the first/last item.

Extracted static helper functions `is_valid_index()`,
`skip_empty_indices()` and `skip_empty_indices_reverse()`.
Add "first" and "last" functions for `ood_ptr_array`.

The functions `ood_ptr_array_first()` and `ood_ptr_array_last()` return
the first and last pointers stored in an `ood_ptr_array` struct,
respectively.
In `ood_ptr_array`, remove `const` from the `items` field.

Items in an `ood_ptr_array` are normally non-const.  Declaraing the
`items` type as `void const **` required that items be cast to `const`
in typical usage.

Drop the `const` on `items` and remove it from related functions
`ood_ptr_array_add()`, `ood_ptr_array_clear()` and
`ood_ptr_array_next()`.
Added OpenBSD build to Sourcehut CI.
Add `WALL=ON` to the FreeBSD build.

Fix a couple of format string warnings, using `%z` instead of `%l` for `ssize_t` values.
Include `sys/socket.h` where needed for FreeBSD.

Fix the FreeBSD build by making sure the definitions of `sockaddr` and `AF_INET`are visible.
Add FreeBSD build for SourceHut CI.
Move select sets management into server functions.

Extract functions `server_add_sockets_to_select_sets()` and
`server_handle_events_in_select_sets()` from `main()`.

Add function `ood_select_sets_add_errorable()` for adding a socket to
the select error set and no longer automatically add a socket to the
error set when calling `ood_select_sets_add_reader()` and
`ood_select_sets_add_writer()`.

Add missing #include to `ood.h`.
Store listener socket in the server's `sockets` ptr array.

Drop the `listener` field from struct `server` and change
`server_add_listener()` to store the listener socket in the `sockets`
ptr array.

Add a `flags` field to `ood_inet_socket` and define flag
`OOD_INET_SOCKET_FLAGS_LISTENING` to set on listener sockets.  This is
necessary since macOS doesn't support the `SO_ACCEPTCONN` option for
`getsockopt()` as defined in POSIX:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_10_16
https://stackoverflow.com/questions/10260600/check-if-socket-is-listening-in-c#comment90534614_10261617

Update `server_close_all_listeners()` to make use of the
`OOD_INET_SOCKET_FLAGS_LISTENING` flag.
Use `ood_ptr_array` to track server connections.

Replace the ad hoc `connections` array embedded in the `server` struct
with an instance of struct `ood_ptr_array` named `sockets`.

Update the `server_add_connection()` and `server_close_connection()`
functions to use the `sockets` ptr array, and update
`server_is_running()` to check the count of the ptr array.

Add helper function `server_can_accept_connections()` to encapsulate the
while loop condition in `listener_on_read()` that drains the listener
socket.  Add function `ood_ptr_array_has_capacity()` for checking if
there's room remaining in a ptr array.  Make `ood_ptr_array_next()`
const-correct.
Add `ptr_array` struct and related functions.

A `ptr_array` is a dynamic array of const void pointers.  A void pointer
item can be added to the first available slot and can be cleared.  The
`ood_ptr_array_next()` function allows for easy skipping of cleared
slots.
More correctly detect and handle SIGINT.

Modify `ood_inet_socket_accept()` to return success when it receives
EINTR when calling `accept()`.

Change `connection_on_read()` and `connection_on_write()` so they do
**not** close the connection when they receive EINTR or EWOULDBLOCK.

Modify the select loop in `main()` so that it always checks if we've
received SIGINT at the end of the loop, after processing all the
readable and writable sockets.

Added function `server_close_all_listeners()` for closing all the
listening sockets when SIGINT is received.
Remove `server_state` enum and related field on `server`.

Change the `server_is_running()` function to count the number of
listeners and connections to determine if the server is running.
Next