From 787cafd0d3b8ef2154dcafb37e2331381f4c4c8b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 4 Dec 2009 17:30:56 +0100 Subject: Specify output filename on command line --- src/process_hkl.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/process_hkl.c b/src/process_hkl.c index 15ba62f3..3961046e 100644 --- a/src/process_hkl.c +++ b/src/process_hkl.c @@ -39,6 +39,8 @@ static void show_help(const char *s) "\n" " -h, --help Display this help message.\n" " -i, --input= Specify input filename (\"-\" for stdin).\n" +" -o, --output= Specify output filename for merged intensities\n" +" (don't specify for no output).\n" "\n" " --max-only Take the integrated intensity to be equal to the\n" " maximum intensity measured for that reflection.\n" @@ -168,6 +170,7 @@ int main(int argc, char *argv[]) { int c; char *filename = NULL; + char *output = NULL; FILE *fh; unsigned int n_patterns; double *ref, *trueref; @@ -184,6 +187,7 @@ int main(int argc, char *argv[]) const struct option longopts[] = { {"help", 0, NULL, 'h'}, {"input", 1, NULL, 'i'}, + {"output", 1, NULL, 'o'}, {"max-only", 0, &config_maxonly, 1}, {"output-every", 1, NULL, 'e'}, {"rvsq", 0, NULL, 'r'}, @@ -193,7 +197,7 @@ int main(int argc, char *argv[]) }; /* Short options */ - while ((c = getopt_long(argc, argv, "hi:e:r", longopts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "hi:e:ro:", longopts, NULL)) != -1) { switch (c) { case 'h' : { @@ -206,6 +210,11 @@ int main(int argc, char *argv[]) break; } + case 'o' : { + output = strdup(optarg); + break; + } + case 'r' : { config_rvsq = 1; break; @@ -304,7 +313,9 @@ int main(int argc, char *argv[]) process_reflections(ref, trueref, counts, n_patterns, mol->cell, config_rvsq, config_zoneaxis); - write_reflections("results/reflections.hkl", counts, ref, 0, NULL); + if ( output != NULL ) { + write_reflections(output, counts, ref, 0, NULL); + } STATUS("There were %u patterns.\n", n_patterns); -- cgit v1.2.3