summaryrefslogtreecommitdiff
path: root/src/options.c
blob: b3836a77ee0142e73a60e4d095364c263c46c315 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <unistd.h>

#include "options.h"

static void print_usage(const char *progname)
{
   printf("Usage: %s [-c config_file] [-o output_directory]\n",
	  progname);	  
}

int parse_options(struct argent_options *opts, int argc, char **argv)
{
   opts->conf_filename = "argent.lua";
   opts->output_dir = "build";
   
   int opt;
   while ((opt = getopt(argc, argv, "c:o:")) != -1) {
      switch (opt) {
      case 'c':
	 opts->conf_filename = optarg;
	 break;

      case 'o':
	 opts->output_dir = optarg;
	 break;

      default:
	 print_usage(argv[0]);
	 return 1;
      }
   }

   return 0;
}