can i delete the code that deals with the remaining data
// Read user input and handle partial reads
int inbuf = 0;           // Number of bytes in buf
int room = sizeof(buf);  // How many bytes left in the buf
char *after = buf;       // Pointer to the position after the data

int nbytes;

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

    if ((where = find_network_newline(buf, inbuf)) > 0) {  // When full line is read
        buf[where - 2] = '\0';                             // NULL terminate buff

        // Handle remaining data in buffer
        int remaining = inbuf - where;
        char *rest = malloc(sizeof(char) * (remaining + 1));
        if (rest == NULL) {
            perror("malloc");
            exit(1);
        }

        memcpy(rest, buf + where, remaining);
        rest[remaining] = '\0';

        // Return the input
        char *input = malloc(sizeof(char) * (strlen(buf) + 1));
        if (input == NULL) {
            perror("malloc");
            exit(1);
        }
        strcpy(input, buf);
        input[strlen(buf)] = '\0';

        // Free the rest and return
        free(rest);
        return input;
    }
