This set of patches adds opt.c and opt.h, which implement an argument parsing system. It's extremely similar to getopt_long in that it can parse short and long arguments, but it's not GNU specific and has some extra simple features to make it easy for creddit to use. The bulk of what it does is explained in opt.h, but it basically loops over argv with a list of flags to check for. Flags can either be single character with "-" or strings with "--".
The second patch implements the use of opt.h in main.c. This doesn't break the old system, you can keep using it like this:
./creddit [subreddit] [username] [password]
But it adds a few flags (With more to be added as new features are added):
--help : display help
--subreddit : subreddit to load-up
--username : Username to lgoin as
--password : Password for Username.
This set of patches adds opt.c and opt.h, which implement an argument parsing system. It's extremely similar to getopt_long in that it can parse short and long arguments, but it's not GNU specific and has some extra simple features to make it easy for creddit to use. The bulk of what it does is explained in opt.h, but it basically loops over argv with a list of flags to check for. Flags can either be single character with "-" or strings with "--".
The second patch implements the use of opt.h in main.c. This doesn't break the old system, you can keep using it like this:
./creddit [subreddit] [username] [password]
But it adds a few flags (With more to be added as new features are added): --help : display help --subreddit : subreddit to load-up --username : Username to lgoin as --password : Password for Username.