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

int check_permissions(char *perms, char *reqs){
        char *a = perms + 1;
        if (strcmp(a, reqs) == 0)  { //has required permissions
                return 0
        }
        else {
                return 1
        }
}


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.



    FILE *ls = popen("ls -l", "r"); //suggested using popen by Code Inquiry Assistant
    int min = argv[1];
    char reqs = argv[2];
    int size;
    char perms;
    int total = 0;

    while (fscanf(ls, "%s %*d %*s %*s %d %*s %*d %*s %*s", perms, &size) == 2) {
            if (size > min) {
                    if (if argc == 2) {
                            total += 1;
                    } else {
                            if (check_permissions(perms, reqs)) {
                                    total += 1;
                            }
                    }
            }



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

    return 0;
}
when called from the command line with a number and an optional string of permissions, return how many files have a size larger than the specified input