diff --git a/src/svi.cc b/src/svi.cc index 3557e47..421ff3c 100644 --- a/src/svi.cc +++ b/src/svi.cc @@ -1,18 +1,30 @@ #include #include "SvnRunner.h" +#include using namespace std; +enum +{ + OPT_VERSION = 256, +}; + int main(int argc, char * argv[]) { - cout << "Hello there." << endl; - SvnRunner runner({"ls"}); - for(;;) + static char const optstring[] = "+"; + static struct option const longopts[] = { + {"version", no_argument, NULL, OPT_VERSION}, + {NULL, 0, NULL, 0}, + }; + for (int o; (o = getopt_long(argc, argv, optstring, longopts, NULL)) != -1; ) { - const char * line = runner.get_line(); - if (line == NULL) + switch (o) + { + case OPT_VERSION: + printf("version 0.0.0alpha0\n"); break; - fprintf(stdout, ">> %s", line); + } } - fprintf(stdout, "Exit status: %d\n", runner.status()); + + return 0; } diff --git a/wscript b/wscript index 101a94d..c9be4f3 100644 --- a/wscript +++ b/wscript @@ -1,8 +1,9 @@ def options(opt): opt.load("compiler_cxx") -def configure(cnf): - cnf.load("compiler_cxx") +def configure(conf): + conf.load("compiler_cxx") + conf.check(header_name = "getopt.h") def build(bld): bld(features = "cxx cxxprogram",