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
CodeVault
hpc-kernels
structured_grids
Commits
dd9335be
Commit
dd9335be
authored
Oct 12, 2016
by
Thomas Ponweiser
Browse files
This will make Thomas happy! :D
parent
c0da02c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
cellular_automaton/wireworld_c/configuration.c
View file @
dd9335be
...
...
@@ -29,6 +29,8 @@ long parse_long(const char *str);
int
log_enabled
(
const
conf_t
*
c
,
int
lvl
);
void
chop_wi_extension
(
char
*
filename
);
// ==========================================================================
void
conf_init_default
(
conf_t
*
c
)
...
...
@@ -103,6 +105,7 @@ void conf_init_from_args(conf_t *c, int argc, char* argv[])
}
strncpy
(
c
->
file_basename
,
argv
[
optind
],
sizeof
(
c
->
file_basename
));
chop_wi_extension
(
c
->
file_basename
);
conf_set_or_validate_nprocs
(
c
);
}
...
...
@@ -180,3 +183,18 @@ long parse_long(const char *str)
return
result
;
}
void
chop_wi_extension
(
char
*
filename
)
{
char
*
extension
=
strrchr
(
filename
,
'.'
);
if
(
extension
!=
NULL
)
{
if
(
strcmp
(
extension
,
FILE_EXT
)
==
0
)
{
*
extension
=
'\0'
;
}
else
{
fprintf
(
stderr
,
"Input file '%s' does not have expected file extension '%s'.
\n
"
,
filename
,
FILE_EXT
);
MPI_Abort
(
MPI_COMM_WORLD
,
EXIT_FAILURE
);
}
}
}
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