why is this not working
int find_network_newline(const char *buf, int n) {
    if (buf == NULL) {
        return -1;
    }
    
    int index = 0;
    for (int i = 0; i < n; i++) {
        while (buf[i] != '\n') {   
            index++;
        }
    }

    return index + 1;
}