Linux C programming
Budget: $10 – $30 USD
Modifying the processInput function as follows:
Just below the call to splitstr check to see if myargv[0] is the string "dir_count".
If it is do:
Check to see if numStrings (which works like argc) is equal to 2. If it is not, print an error message and return to the calling function. Otherwise, use lstat on the name specified in myargv[1] to get the struct that will allow you to access the mode. Once you get the mode, determine if the name refers to a directory. If it does not refer to a directory, print the fact that the name (display the name) is not a directory and return to the calling function. Else, count the number of entries in the directory and display the count with a nice message.
Just below the call to splitstr check to see if myargv[0] is the string "dir_count".
If it is do:
Check to see if numStrings (which works like argc) is equal to 2. If it is not, print an error message and return to the calling function. Otherwise, use lstat on the name specified in myargv[1] to get the struct that will allow you to access the mode. Once you get the mode, determine if the name refers to a directory. If it does not refer to a directory, print the fact that the name (display the name) is not a directory and return to the calling function. Else, count the number of entries in the directory and display the count with a nice message.