joshhartigan/iu-coreutils — pull request #3 by DSMan195276 (2014-12-21 18:00:11+00:00)
Title: Project changes and new argument parser

This pull request spans a few different things, so I'd be happy to split it up if you only want to take part of it.

The biggest change is that it adds 'common' and 'include' directories. The 'include' directories contain the headers for the stuff in the 'common' directory, and the stuff in the 'common' directory gets compiled into every executable in the utils. There are mostly just Makefile changes to make this work. This Makefile change also includes a change that the executables are compiled into the "./bin" directory. I then added a '.gitignore' file to ignore all of the compiled files.

Then, I added an argument parser that I've written to the common directory. This parser is very similar to getopt (It matches all of getopt's functionality) but I wrote it with the intent of making writing code to do argument parsing much cleaner (You can put all the information for the arguments into one list, and the shortopt list isn't nessisary). It also prints out a nice list of arguments and descriptions for a help dialog.

The file comment then implements this argument parser into 'ls' as an example. Basically all usages of it look identcial to what is in 'ls'. The switch() in the while() is where you handle the arguments.