am i updating inbuf and removing the full line from the buffer right?
#define BUFSIZE 30

int find_network_newline(const char *buf, int n);
int main() {
    setbuf(stdout, NULL);

    struct sockaddr_in *self = init_server_addr(PORT);
    int listenfd = set_up_server_socket(self, 5);

    while (1) {
        int fd = accept_connection(listenfd);
        if (fd < 0) {
            continue;
        }

        // Receive messages
        char buf[BUFSIZE] = {'\0'};
        int inbuf = 0;           // How many bytes currently in buffer?
        int room = sizeof(buf);  // How many bytes remaining in buffer?
        char *after = buf;       // Pointer to position after the data in buf

        int nbytes;
        while ((nbytes = read(fd, after, room)) > 0) {
            inbuf += nbytes;

            int where;

            while ((where = find_network_newline(buf, inbuf)) > 0) {
                buf[where - 1] = '\0';

                printf("Next message: %s\n", buf);

                // Step 4: update inbuf and remove the full line from the buffer
                // There might be stuff after the line, so don't just do inbuf = 0.

                // You want to move the stuff after the full line to the beginning
                // of the buffer.  A loop can do it, or you can use memmove.
                // memmove(destination, source, number_of_bytes)

                int number_of_bytes = strlen(buf) - inbuf;

                char move_this[number_of_bytes];

                int move_this_index = 0;

                int new_after_index = 0;

                int after_after = -1;

                for (int i = (where + 1); i < strlen(buf); i++) {
                    if (buf[i] == &after) {
                        after_after = 0;
                    }
                    if (after_after == -1) {
                        new_after_index += 1;
                    }
                    move_this[move_this_index] = buf[i];
                    move_this_index += 1;
                }

                memmove(buf, move_this, number_of_bytes);

                inbuf = strlen(buf) - new_after_index;
            }
        }
        close(fd);
        printf("The connection is now closed ...\n");
    }

    free(self);
    close(listenfd);
    return 0;
}
