aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-10-16 09:50:24 +0200
committerThomas White <taw@physics.org>2019-03-11 16:49:36 +0100
commit27869f1c27421cd11d61a13224253b6f0dece22c (patch)
tree3657d07aed2de52ba1d2ae61828c33f5b254edfa /src
parent1fdd992e4c05a198af907c5312f188374e13c57f (diff)
cell_tool: Check --tolerance has the right number of commas
Diffstat (limited to 'src')
-rw-r--r--src/cell_tool.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cell_tool.c b/src/cell_tool.c
index 3fd206e9..51e7ea01 100644
--- a/src/cell_tool.c
+++ b/src/cell_tool.c
@@ -509,6 +509,16 @@ int main(int argc, char *argv[])
free(cell_file);
if ( toler != NULL ) {
+ int i;
+ int ncomma = 0;
+ size_t l = strlen(toler);
+ for ( i=0; i<l; i++ ) if ( toler[i] == ',' ) ncomma++;
+ if ( ncomma != 1 ) {
+ ERROR("Invalid parameters for --tolerance. "
+ "Should be: --tolerance=lengthtol,angtol "
+ "(percent,degrees)\n");
+ return 1;
+ }
if ( sscanf(toler, "%f,%f", &ltl, &atl) != 2 ) {
ERROR("Invalid parameters for --tolerance\n");
return 1;