Commit 9b8651e5 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

merge, mergetime: option -s doesn't work correctly (bug fix)

parent 738fead5
2016-06-25 Uwe Schulzweida
* using CDI library version 1.7.2
* Version 1.7.2 released
2016-03-05 Uwe Schulzweida
* merge, mergetime: option -s doesn't work correctly (bug fix)
2016-02-25 Uwe Schulzweida
* using CDI library version 1.7.1
......
......@@ -323,10 +323,8 @@ void *Collgrid(void *argument)
int nfiles = cdoStreamCnt() - 1;
const char *ofilename = cdoStreamName(nfiles)->args;
if ( !cdoSilentMode && !cdoOverwriteMode )
if ( fileExists(ofilename) )
if ( !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
if ( !cdoOverwriteMode && fileExists(ofilename) && !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
ens_file_t *ef = (ens_file_t*) Malloc(nfiles*sizeof(ens_file_t));
......
......@@ -97,10 +97,8 @@ void *Ensstat(void *argument)
const char *ofilename = cdoStreamName(nfiles)->args;
if ( !cdoSilentMode && !cdoOverwriteMode )
if ( fileExists(ofilename) )
if ( !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
if ( !cdoOverwriteMode && fileExists(ofilename) && !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
ens_file_t *ef = (ens_file_t *) Malloc(nfiles*sizeof(ens_file_t));
......
......@@ -111,10 +111,8 @@ void *Ensstat3(void *argument)
ofilename = cdoStreamName(nfiles)->args;
if ( !cdoSilentMode && !cdoOverwriteMode )
if ( fileExists(ofilename) )
if ( !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
if ( !cdoOverwriteMode && fileExists(ofilename) && !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
ef = (ens_file_t*) Malloc(nfiles*sizeof(ens_file_t));
......
......@@ -208,10 +208,8 @@ void *Ensval(void *argument)
sprintf(ofilename, "%s.%s%s", ofilebase, type_suffix, file_suffix);
// fprintf(stderr, "StreamID %i: %s\n", stream, ofilename);
if ( !cdoSilentMode && !cdoOverwriteMode )
if ( fileExists(ofilename) )
if ( !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
if ( !cdoOverwriteMode && fileExists(ofilename) && !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
argument_t *fileargument = file_argument_new(ofilename);
streamID2[stream] = streamOpenWrite(fileargument, cdoFiletype());
......
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# Makefile.in generated by automake 1.14 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
......
......@@ -165,10 +165,8 @@ void *Merge(void *argument)
const char *ofilename = cdoStreamName(streamCnt-1)->args;
if ( !cdoSilentMode && !cdoOverwriteMode )
if ( fileExists(ofilename) )
if ( !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
if ( !cdoOverwriteMode && fileExists(ofilename) && !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
int *streamIDs = (int*) Malloc(nmerge*sizeof(int));
int *vlistIDs = (int*) Malloc(nmerge*sizeof(int));
......
......@@ -116,10 +116,8 @@ void *Mergetime(void *argument)
const char *ofilename = cdoStreamName(nfiles)->args;
if ( !cdoSilentMode && !cdoOverwriteMode )
if ( fileExists(ofilename) )
if ( !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
if ( !cdoOverwriteMode && fileExists(ofilename) && !userFileOverwrite(ofilename) )
cdoAbort("Outputfile %s already exists!", ofilename);
int streamID2 = streamOpenWrite(cdoStreamName(nfiles), cdoFiletype());
......
......@@ -521,7 +521,7 @@ int userFileOverwrite(const char *restrict filename)
{
int status = 0;
if ( stdin_is_tty && stderr_is_tty )
if ( !cdoSilentMode && stdin_is_tty && stderr_is_tty )
{
fprintf(stderr, "File %s already exists, overwrite? (yes/no): ", filename);
char line[1024];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment