Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
0db0b305
Commit
0db0b305
authored
Mar 03, 2016
by
Mathis Rosenhauer
Browse files
cmor: History handling
parent
28106f66
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/CMOR.c
View file @
0db0b305
...
...
@@ -210,25 +210,43 @@ static void dump_global_attributes(int streamID)
static
void
dump_special_attributes
(
int
streamID
)
{
int
fileID
;
size_t
historysize
;
size_t
historysize
,
old_
historysize
;
char
*
history
,
*
new_history
;
const
char
*
value
;
int
vlistID
=
streamInqVlist
(
streamID
);
/* Any new history will be appended to the existing history. */
fileID
=
pstreamFileID
(
streamID
);
historysize
=
(
size_t
)
streamInqHistorySize
(
fileID
);
old_historysize
=
(
size_t
)
streamInqHistorySize
(
fileID
);
new_history
=
get_val
(
"history"
,
""
);
if
(
old_historysize
)
{
historysize
=
old_historysize
;
if
(
new_history
)
historysize
+=
strlen
(
new_history
)
+
1
;
}
else
{
historysize
=
strlen
(
new_history
);
}
if
(
historysize
)
{
new_history
=
get_val
(
"history"
,
NULL
);
if
(
new_history
)
historysize
+=
strlen
(
new_history
)
+
1
;
history
=
Malloc
(
historysize
+
1
);
memset
(
history
,
0
,
historysize
+
1
);
streamInqHistoryString
(
fileID
,
history
);
if
(
new_history
)
if
(
old_historysize
)
{
streamInqHistoryString
(
fileID
,
history
);
if
(
new_history
)
{
strcat
(
history
,
" "
);
strcat
(
history
,
new_history
);
}
}
else
{
strcat
(
history
,
" "
);
strcat
(
history
,
new_history
);
strcpy
(
history
,
new_history
);
}
hreplace
(
"history"
,
history
);
Free
(
history
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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