Gets arguments with getopt.
This link was helpful: http://www.gnu.org/software/libc/manual/html_node/Getopt.html