diff options
author | Thomas White <taw@bitwiz.org.uk> | 2012-09-04 11:48:27 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2012-09-04 11:48:53 +0200 |
commit | fbe8b2e1cd1111b440b769eb62ffcd4711b24839 (patch) | |
tree | 7d313e6e199a6653c3d4c025c0c943e5cc0587f9 | |
parent | 9745feca8bc787f3441e961de9b140200242f2f0 (diff) |
Fix widespread bug-hiding problem with command line argument handling
-rw-r--r-- | src/check_hkl.c | 3 | ||||
-rw-r--r-- | src/compare_hkl.c | 4 | ||||
-rw-r--r-- | src/get_hkl.c | 3 | ||||
-rw-r--r-- | src/hdfsee.c | 3 | ||||
-rw-r--r-- | src/indexamajig.c | 3 | ||||
-rw-r--r-- | src/partial_sim.c | 3 | ||||
-rw-r--r-- | src/partialator.c | 3 | ||||
-rw-r--r-- | src/pattern_sim.c | 3 | ||||
-rw-r--r-- | src/powder_plot.c | 3 | ||||
-rw-r--r-- | src/process_hkl.c | 25 | ||||
-rw-r--r-- | src/render_hkl.c | 3 |
11 files changed, 34 insertions, 22 deletions
diff --git a/src/check_hkl.c b/src/check_hkl.c index a1688ad2..1dfe91a0 100644 --- a/src/check_hkl.c +++ b/src/check_hkl.c @@ -377,7 +377,8 @@ int main(int argc, char *argv[]) break; default : - return 1; + ERROR("Unhandled option '%c'\n", c); + break; } } diff --git a/src/compare_hkl.c b/src/compare_hkl.c index fb1ac117..b6a525fc 100644 --- a/src/compare_hkl.c +++ b/src/compare_hkl.c @@ -378,9 +378,9 @@ int main(int argc, char *argv[]) } break; - default : - return 1; + ERROR("Unhandled option '%c'\n", c); + break; } diff --git a/src/get_hkl.c b/src/get_hkl.c index 498fb613..623e0027 100644 --- a/src/get_hkl.c +++ b/src/get_hkl.c @@ -427,7 +427,8 @@ int main(int argc, char *argv[]) break; default : - return 1; + ERROR("Unhandled option '%c'\n", c); + break; } diff --git a/src/hdfsee.c b/src/hdfsee.c index 613572a2..e5d90456 100644 --- a/src/hdfsee.c +++ b/src/hdfsee.c @@ -224,7 +224,8 @@ int main(int argc, char *argv[]) break; default : - return 1; + ERROR("Unhandled option '%c'\n", c); + break; } } diff --git a/src/indexamajig.c b/src/indexamajig.c index 294bce1d..074be20a 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -397,7 +397,8 @@ int main(int argc, char *argv[]) break; default : - return 1; + ERROR("Unhandled option '%c'\n", c); + break; } diff --git a/src/partial_sim.c b/src/partial_sim.c index cdddf6a3..62c72ceb 100644 --- a/src/partial_sim.c +++ b/src/partial_sim.c @@ -404,7 +404,8 @@ int main(int argc, char *argv[]) break; default : - return 1; + ERROR("Unhandled option '%c'\n", c); + break; } } diff --git a/src/partialator.c b/src/partialator.c index ec8a7410..5d373f83 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -371,7 +371,8 @@ int main(int argc, char *argv[]) break; default : - return 1; + ERROR("Unhandled option '%c'\n", c); + break; } diff --git a/src/pattern_sim.c b/src/pattern_sim.c index e05dcdec..f9831e79 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -369,7 +369,8 @@ int main(int argc, char *argv[]) break; default : - return 1; + ERROR("Unhandled option '%c'\n", c); + break; } diff --git a/src/powder_plot.c b/src/powder_plot.c index 9c946cac..dd7f3f29 100644 --- a/src/powder_plot.c +++ b/src/powder_plot.c @@ -840,7 +840,8 @@ int main(int argc, char *argv[]) break; default : - return 1; + ERROR("Unhandled option '%c'\n", c); + break; } } diff --git a/src/process_hkl.c b/src/process_hkl.c index 28d54360..8048cf45 100644 --- a/src/process_hkl.c +++ b/src/process_hkl.c @@ -390,43 +390,46 @@ int main(int argc, char *argv[]) longopts, NULL)) != -1) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'i' : + case 'i' : filename = strdup(optarg); break; - case 'o' : + case 'o' : output = strdup(optarg); break; - case 's' : + case 's' : config_stopafter = atoi(optarg); break; - case 'f' : + case 'f' : config_startafter = atoi(optarg); break; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 'g' : + case 'g' : histo = strdup(optarg); break; - case 'z' : + case 'z' : histo_params = strdup(optarg); break; - case 0 : + case 0 : + break; + + default : + ERROR("Unhandled option '%c'\n", c); break; - default : - return 1; } } diff --git a/src/render_hkl.c b/src/render_hkl.c index a01e7609..11dba4a9 100644 --- a/src/render_hkl.c +++ b/src/render_hkl.c @@ -689,7 +689,8 @@ int main(int argc, char *argv[]) break; default : - return 1; + ERROR("Unhandled option '%c'\n", c); + break; } |