Your first task is to write a C program called count_large. The program will inspect the output from the ls -l command and print the number of files larger than a specified size.

Your program prints to standard output the number of regular files in the input listing that are larger than the cutoff size supplied by the user in the first command-line argument. Directories are not considered to be regular files. Do not print any extra text, just the number followed by a newline character \n.

Your program optionally accepts a second command-line argument which is a string of 9 characters that represent the required file permissions. Each position is either r,w,x or - as would be appropriate in that location in the file-permission field of the long format of ls output. If called with this option, your program will only count the files that have at least the permissions specified by this argument.

For example, given the output of ls -l:

    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
Running

$ count_large 1000 rwx------

will print 2 (followed by a single newline \n character) because prog and xyz are both larger than 1000 bytes and have at least the permissions specified.

Running

$ count_large 1000

will print 3 (followed by a single newline \n character) because there are three files larger than 1000 bytes.
Notice that the first line of output from running ls -l is the total line. Your program should expect this line and handle it appropriately. That is, you should read and then ignore it.

You are required to write (and use) a helper function named check_permissions that takes two 9-element character arrays as arguments and returns an integer. (The prototype for this function is in the starter code.) The first array will represent the permission field of a file and the second will represent the permissions that are required. The function will return 0 if the file has all the required permissions and 1 otherwise. The arrays do not have to be identical for a 0 to be returned. For example, if the first array holds the characters rwxr-x--- and the second array holds the characters r-x------, the function should return 0. Often when we pass arrays as parameters to functions, we also pass a size so that the function can work on arrays of varying lengths. In this case we don't need to pass a size because both arrays will always have nine elements.

you may assume the following:

The user will provide at most two command-line arguments. If they are provided, arguments will be the correct type and in the correct order. In other words, if only one command-line argument is present, it is an integer. If two are provided, the first is an integer and the second is the required permissions string.
The input listing contains only regular files and directories. (There are no links or other unusual file types.)
Names of things (filenames, usernames, group names, ...) will be at most 31 characters.
An integer is large enough to hold any file sizes for this assignment.
Filenames do not have spaces in them.

You should use scanf to read the input.