#include <stdio.h>
#include <stdlib.h>


// TODO: Implement a helper named check_permissions that matches the prototype below.
int check_permissions(char *file, char *permissions){
    for (int i = 0; i < 9;i++){
        // if the permission is blank then continue
        if(strcmp(permissions[i], "-") == 0){
            continue;
        }
        // else if the permission matches, continue
        else if (strcmp(permissions[i], file[i]) == 0){
            continue;
        }
        // otherwise the permission does not match and we can end the loop and set is_good to 1 and return
        else{
            return 1;
            break;
        }
        return 0;
    }
}




int main(int argc, char** argv) {
    if (!(argc == 2 || argc == 3)) {
        fprintf(stderr, "USAGE: count_large size [permissions]\n");
        return 1;
    }

    // TODO: Process command line arguments.
        printf("Hello, World!\n");

    int inputted_size;
        printf("Hello, inputted_size added!\n");

    char inputted_perms[10];
    scanf("%d %s", &inputted_size, inputted_perms)
    int num_files_valid = 0;
    FILE *file_output;
    char line[1024];
    int size;
    char perms[11];
    if ((file_output = popen("ls -lS", "r")) == NULL) {
        perror("popen");
        exit(EXIT_FAILURE);
    }

    // TODO: Call check_permissions as part of your solution to count the files to
    // compute and print the correct value.

    while(fgets(line, 1024, file_output) != NULL){
            sscanf(line, "%s %*d %*s %*s %d", perms, &size);

    if (size <= inputted_size){
        break;
    }
    else{
        if(check_permissions(perms, inputted_perms) == 0){
            num_files_valid ++;
        }
        else{
            continue;
        }
    }


}

  printf("%d\n", num_files_valid);
    return 0;
}

the code should input the number of files larger than specified size
