Patch (context patch) follows: -- For more explanation netCDF-group Date: Tue, 17 Mar 1998 -- -- or email oheudeck@awi-bremerhaven.de ---- patch follows: apply with patch ffio.c < patchfile ------------ start of patchfile ----------- *** ffio.c.save Wed Apr 15 11:49:54 1998 --- ffio.c Wed Apr 15 11:49:54 1998 *************** *** 3,8 **** --- 3,10 ---- * See netcdf/COPYRIGHT file for copying and redistribution conditions. */ /* $Id: ffio.c,v 1.48 1998/03/07 06:46:06 davis Exp $ */ + /* addition by O. Heudecker, AWI-Bremerhaven, 12.3.1998 */ + /* added correction by John Sheldon and Hans Vahlenkamp 15.4.1998*/ #include "ncconfig.h" #include *************** *** 16,21 **** --- 18,25 ---- #include #include #include + /* Insertion by O. R. Heudecker, AWI-Bremerhaven 12.3.98 (1 line)*/ + #include #include "ncio.h" #include "fbits.h" *************** *** 477,487 **** { ControlString="bufa:336:2"; } ! if(fIsSet(ioflags, NC_NOCLOBBER)) fSet(oflags, O_EXCL); ! fd = ffopens(path, oflags, 0666, 0, &stat, ControlString); if(fd < 0) { status = errno; --- 481,515 ---- { ControlString="bufa:336:2"; } ! /* Insertion by Olaf Heudecker, AWI-Bremerhaven, 12.8.1998 ! to allow more versatile FFIO-assigns */ ! /* begin new */ ! { ! char assignstr[128]; ! char emptystr='\0'; ! char *xtra_assign; ! xtra_assign = getenv("NETCDF_XFFIOSPEC"); ! if(xtra_assign == NULL) ! { ! xtra_assign=&emptystr; ! } ! if (strlen(ControlString)+strlen(xtra_assign)+21 > 127) { ! /* Error: AssignCommand too long */ ! status=E2BIG; ! goto unwind_new; ! } ! sprintf(assignstr,"assign -F %s %s f:%s",ControlString, ! xtra_assign,path); ! /* printf("1 assignstr=>%s<\n",assignstr); */ ! /* Aufruf der Fortran-Routine assign von C aus */ ! ASSIGN(_cptofcd(assignstr,strlen(assignstr))); ! } ! /* end new */ if(fIsSet(ioflags, NC_NOCLOBBER)) fSet(oflags, O_EXCL); ! /* Orig: fd = ffopens(path, oflags, 0666, 0, &stat, ControlString); */ ! fd = ffopen(path, oflags, 0666, 0, &stat); if(fd < 0) { status = errno; *************** *** 559,566 **** { ControlString="bufa:336:2"; } ! fd = ffopens(path, oflags, 0, 0, &stat, ControlString); if(fd < 0) { status = errno; --- 587,620 ---- { ControlString="bufa:336:2"; } + /* Insertion by Olaf Heudecker, AWI-Bremerhaven, 12.8.1998 + to allow more versatile FFIO-assigns */ + /* begin new */ + { + char assignstr[128]; + char emptystr='\0'; + char *xtra_assign; + xtra_assign = getenv("NETCDF_XFFIOSPEC"); + if(xtra_assign == NULL) + { + xtra_assign=&emptystr; + } + if (strlen(ControlString)+strlen(xtra_assign)+21 > 127) { + /* Error: AssignCommand too long */ + status=E2BIG; + goto unwind_new; + } + sprintf(assignstr,"assign -F %s %s f:%s",ControlString, + xtra_assign,path); + /* printf("2 assignstr=>%s<\n",assignstr); */ + /* Aufruf der Fortran-Routine assign von C aus */ + ASSIGN(_cptofcd(assignstr,strlen(assignstr))); + } + /* end new */ ! /* Orig: fd = ffopens(path, oflags, 0, 0, &stat, ControlString); */ ! fd = ffopen(path, oflags, 0, 0, &stat); ! if(fd < 0) { status = errno; ----------end