diff --git a/external/RSL_LITE/c_code.c b/external/RSL_LITE/c_code.c index 27549bdf9c9aa86bb91b9bd3a3f54aef5edd1970..f719c8c3d740602cda1a99b7ad3b7d21656c1e6f 100755 --- a/external/RSL_LITE/c_code.c +++ b/external/RSL_LITE/c_code.c @@ -14,6 +14,8 @@ #ifdef _WIN32 #include <Winsock2.h> +#else +#include <unistd.h> #endif #ifdef NCEP_DEBUG_MULTIDIR // # include <errno.h> @@ -38,6 +40,7 @@ void RSL_LITE_ERROR_DUP1 ( int *me , int *size ) char filename[256] ; char dirname[256] ; char hostname[256] ; + char output_dir[256] = "/jetfs/scratch/mfritz/data/LES_simulations/output/"; // Set the desired directory path /* redirect standard out and standard error based on compile options*/ @@ -48,21 +51,21 @@ void RSL_LITE_ERROR_DUP1 ( int *me , int *size ) # ifndef RSL0_ONLY if ( *size < ORIG_RSL_CUTOFF ) { - sprintf(filename,"rsl.out.%04d",*me) ; + sprintf(filename,"%s/rsl.out.%04d", output_dir, *me) ; } else { - sprintf(filename,"rsl.out.%08d",*me) ; + sprintf(filename,"%s/rsl.out.%08d", output_dir, *me) ; } # else if (*me == 0) { if ( *size < ORIG_RSL_CUTOFF ) { - sprintf(filename,"rsl.out.%04d",*me) ; + sprintf(filename,"%s/rsl.out.%04d", output_dir, *me) ; } else { - sprintf(filename,"rsl.out.%08d",*me) ; + sprintf(filename,"%s/rsl.out.%08d", output_dir, *me) ; } } else @@ -91,21 +94,21 @@ void RSL_LITE_ERROR_DUP1 ( int *me , int *size ) # ifndef RSL0_ONLY if ( *size < ORIG_RSL_CUTOFF ) { - sprintf(filename,"rsl.error.%04d",*me) ; + sprintf(filename,"%s/rsl.error.%04d", output_dir, *me) ; } else { - sprintf(filename,"rsl.error.%08d",*me) ; + sprintf(filename,"%s/rsl.error.%08d", output_dir, *me) ; } # else if (*me == 0) { if ( *size < ORIG_RSL_CUTOFF ) { - sprintf(filename,"rsl.error.%04d",*me) ; + sprintf(filename,"%s/rsl.error.%04d", output_dir, *me) ; } else { - sprintf(filename,"rsl.error.%08d",*me) ; + sprintf(filename,"%s/rsl.error.%08d", output_dir, *me) ; } } else @@ -195,7 +198,7 @@ void RSL_LITE_ERROR_DUP1 ( int *me , int *size ) ; return ; } - if( dup2( newfd, STANDARD_OUTPUT ) < 0 ) + if( dup2(newfd, STANDARD_OUTPUT) < 0 ) { perror("error_dup: dup2 fails to change output descriptor") ; fprintf(stderr,"...sending output to standard output and continuing.\n"); @@ -217,7 +220,7 @@ void RSL_LITE_ERROR_DUP1 ( int *me , int *size ) fprintf(stderr,"...sending error to standard error and continuing.\n") ; return ; } - if( dup2( newfd, STANDARD_ERROR ) < 0 ) + if( dup2(newfd, STANDARD_ERROR) < 0 ) { perror("error_dup: dup2 fails to change error descriptor") ; fprintf(stderr,"...sending error to standard error and continuing.\n") ;