1 #include <msp/core/getopt.h>
2 #include <msp/fs/utils.h>
3 #include <msp/strings/lexicalcast.h>
4 #include <msp/strings/regex.h>
10 Options::Options(int argc, char **argv):
21 getopt.add_option('r', "resolution", res, GetOpt::REQUIRED_ARG);
22 getopt.add_option('f', "fullscreen", fullscreen, GetOpt::NO_ARG);
23 getopt.add_option('g', "debug", debug, GetOpt::NO_ARG);
24 getopt.add_option('d', "driver", driver, GetOpt::REQUIRED_ARG);
25 getopt.add_option('s', "simulate", simulate, GetOpt::NO_ARG);
26 getopt.add_option('n', "network", network, GetOpt::NO_ARG);
27 getopt.add_option( "state", state_fn, GetOpt::REQUIRED_ARG);
32 if(RegMatch m=Regex("([1-9][0-9]*)x([1-9][0-9]*)").match(res))
34 screen_w = lexical_cast<unsigned>(m[1].str);
35 screen_h = lexical_cast<unsigned>(m[2].str);
38 throw usage_error("Invalid resolution");
41 const vector<string> &args = getopt.get_args();
43 throw usage_error("No layout given");
48 state_fn = FS::basepart(layout_fn)+".state";