Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Oleksii Turkot
CrystFEL
Commits
94584e66
Commit
94584e66
authored
Nov 29, 2010
by
Thomas White
Browse files
pattern_sim: Check validity of numbers passed on command line
parent
38a944a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/pattern_sim.c
View file @
94584e66
...
...
@@ -199,6 +199,7 @@ int main(int argc, char *argv[])
double
*
powder
;
char
*
intfile
=
NULL
;
double
*
intensities
;
char
*
rval
;
double
*
phases
;
int
config_simdetails
=
0
;
int
config_nearbragg
=
0
;
...
...
@@ -266,7 +267,11 @@ int main(int argc, char *argv[])
break
;
case
'n'
:
n_images
=
atoi
(
optarg
);
n_images
=
strtol
(
optarg
,
&
rval
,
10
);
if
(
*
rval
!=
'\0'
)
{
ERROR
(
"Invalid number of images.
\n
"
);
return
1
;
}
break
;
case
'i'
:
...
...
@@ -302,12 +307,20 @@ int main(int argc, char *argv[])
break
;
case
3
:
min_size
=
atof
(
optarg
);
min_size
=
strtod
(
optarg
,
&
rval
);
if
(
*
rval
!=
'\0'
)
{
ERROR
(
"Invalid minimum size.
\n
"
);
return
1
;
}
random_size
++
;
break
;
case
4
:
max_size
=
atof
(
optarg
);
max_size
=
strtod
(
optarg
,
&
rval
);
if
(
*
rval
!=
'\0'
)
{
ERROR
(
"Invalid maximum size.
\n
"
);
return
1
;
}
random_size
++
;
break
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment