
char line[MAXLINE];
while (fgets(line, sizeof(line) - 1, fp)) {
    line[strlen(line) - 1] = '\0';
    if (strcmp(userid, line) == 0) {
        fclose(fp);
        exit(0);
    } else if (strncmp(userid, line, user_length) == 0) {
        fclose(fp);
        exit(2);
    }
}