what is the bug in my code when I compile it with standard input "total 329
-rwx------  1 reid  staff    1734 Jun 22 14:52 prog
-rw-------  1 reid  staff   21510 Apr  6 12:10 tmp.txt
-rwxr-xr-x  1 reid  staff    8968 Feb  1 2013 xyz
-rw-r--r--  1 reid  staff      88 Feb 15 2013 xyz.c"?
#include <stdio.h>
#include <stdlib.h>


// TODO: Implement a helper named check_permissions that matches the prototype below.
int check_permissions(char* min_permissions, char* file_permissions) {
    // parameters: user-specified permissions, actual file permissions --> compare them and return 1 or 0 
    // check for the 9 char string s -rwxrwxrwx 
    // s[0], s[1], s[2] user permissions
    // s[3], s[4], s[5] group permissions
    // s[6], s[7], s[8] others permissions
    for (int i = 0; i < 9; i++) {
        if (min_permissions[i] != '-') { //only assess this file if it is a file and not a directory
            if (file_permissions[i] != min_permissions[i]) { 
                return 1; //return 1 if the permissions are not enough
            }
        }
    }
    return 0; //return 0 if the permissions are enough
}


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.
    int min_size = strtol(argv[1], NULL, 10); // min file size provided by the 1st mandatory command line arg

    int count = 0; //keep track of the number of files that match to return

    char permissions[10]; // store permissions
    int size; // store file size

    scanf("%*s %*d");

    while (scanf("%s %*s %*s %*s %d %*s %*s %*s %*s %*[^\n]", permissions, &size) != EOF) {
        // both command line args provided, check both file sizes and file permissions
        if (argc == 3) { 
            if ((size > min_size) && (check_permissions(argv[2], &(permissions[1])) == 0)) {
                count++; // add this file to counter
            }
        }
        // only 1 command line arg provided, check only the file sizes & compare to min file size
        else { 
            if (size > min_size) {
                count++; // add this file to counter
            }
        }
    }

    printf("%d", count);
    
    // TODO: Call check_permissions as part of your solution to count the files to
    // compute and print the correct value.

    return 0;
}
