diff options
author | Thomas White <taw@physics.org> | 2023-05-10 10:33:31 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2023-07-28 13:22:04 +0200 |
commit | 26ba4671d07e05101ff18b9669ecf2e97ee8255f (patch) | |
tree | c00343e4794d053878f19098693ef4544b18eff3 /src/align_detector.c | |
parent | 36e89c8ceea5d1acd9440b5bbacccc154a5ed98b (diff) |
align_detector: Add --level
Diffstat (limited to 'src/align_detector.c')
-rw-r--r-- | src/align_detector.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/align_detector.c b/src/align_detector.c index 1bc9b5e3..8a1af962 100644 --- a/src/align_detector.c +++ b/src/align_detector.c @@ -55,6 +55,7 @@ static void show_help(const char *s) "\n" " -g, --geometry=file Input geometry file\n" " -o, --output=file Output geometry file\n" + " -l, --level=n Alignment hierarchy level\n" "\n" " -h, --help Display this help message\n" " --version Print version number and exit\n"); @@ -66,6 +67,8 @@ int main(int argc, char *argv[]) int c; char *in_geom = NULL; char *out_geom = NULL; + int level = 0; + char *rval; /* Long options */ const struct option longopts[] = { @@ -76,12 +79,13 @@ int main(int argc, char *argv[]) {"version", 0, NULL, 'V'}, {"input", 1, NULL, 'g'}, {"output", 1, NULL, 'o'}, + {"level", 1, NULL, 'l'}, {0, 0, NULL, 0} }; /* Short options */ - while ((c = getopt_long(argc, argv, "hVo:g:i:", + while ((c = getopt_long(argc, argv, "hVo:g:i:l:", longopts, NULL)) != -1) { @@ -105,6 +109,14 @@ int main(int argc, char *argv[]) out_geom = strdup(optarg); break; + case 'l' : + errno = 0; + level = strtol(optarg, &rval, 10); + if ( *rval != '\0' ) { + ERROR("Invalid value for --level.\n"); + return 1; + } + case 0 : break; |