5
#include "configuration.h"
7
#define FLAG_IMPLEMENTATION
14
parse_args (int argc,str_t* argv);
16
int main(int argc, char **argv) {
17
parse_args (argc, argv);
24
fprintf (stdout, PROJECT_NAME " " PROJECT_VERSION "\n");
25
fprintf (stdout, "OPTIONS:\n");
26
flag_print_options (stdout);
29
parse_args (int argc, str_t* argv) {
30
bool *_help = flag_bool ("help", false, "Print the this help message.");
31
str_t* _in_path = flag_str ("i", "", "The path to the input file");
32
str_t* _out_path = flag_str ("o", "a.out", "The path to the output file");
34
if (!flag_parse(argc, argv)) {
36
flag_print_error(stderr);
44
if (!(strlen(*_in_path))) {
45
fprintf (stdout, "Missing input file.\n\n");
50
// check if file exists.
52
f = fopen (*_in_path, "r");
56
err_print ("File %s can not be found or is unreadable.\n", *_in_path);
59
f = fopen (*_out_path, "w");
63
err_print ("Could not write to file %s."
64
" Do you have accesse to the file?\n",
68
Configuration * cfg = configuration_get_default ();
70
cfg->in_file_path = *_in_path;
71
cfg->out_file_path = *_out_path;