@@ -301,21 +301,21 @@ int main(int argc, char *argv[])
301
301
else if (!strcmp (argv [a ],"-64" ))
302
302
format = (NC_NOCLOBBER | NC_64BIT_OFFSET );
303
303
else if (!strcmp (argv [a ], "-n4" ))
304
- format = (NC_NOCLOBBER | NC_NETCDF4 | NC_CLASSIC_MODEL );
304
+ format = (NC_NOCLOBBER | NC_NETCDF4 | NC_CLASSIC_MODEL );
305
305
else if (!strcmp (argv [a ],"-m" )) missing = 1 ;
306
306
else if (!strcmp (argv [a ], "-d" ))
307
- {
308
- a ++ ;
309
- if ( a < argc )
310
- {
311
- deflate = 1 ;
312
- deflation = atoi (argv [a ]);
313
- }
314
- else
315
- {
316
- usage (); return (1 );
317
- }
318
- }
307
+ {
308
+ a ++ ;
309
+ if ( a < argc )
310
+ {
311
+ deflate = 1 ;
312
+ deflation = atoi (argv [a ]);
313
+ }
314
+ else
315
+ {
316
+ usage (); return (1 );
317
+ }
318
+ }
319
319
else if (!strcmp (argv [a ],"-s" )) shuffle = 1 ;
320
320
else
321
321
{
@@ -346,35 +346,35 @@ int main(int argc, char *argv[])
346
346
ncopts = 0 ;
347
347
348
348
if (!mem_dry_run ) {
349
- /* Create a new netCDF output file */
350
- if ((ncoutfile = (struct fileinfo * )malloc (sizeof (struct fileinfo )))== NULL )
351
- {
352
- fprintf (stderr ,"Error: cannot allocate enough memory!\n" ); return (1 );
353
- }
354
- if (!appendnc )
355
- {
356
- if (stat (outfilename ,& statbuf )== 0 )
357
- {
358
- fprintf (stderr ,"Error: output file seems to exist already!\n" );
359
- free (ncoutfile ); return (1 );
360
- }
361
- status = nc__create (outfilename , format , 0 , & blksz , & ncoutfile -> ncfid );
362
- if (status == (-1 ))
363
- {
364
- fprintf (stderr ,"Error: cannot create the output netCDF file!\n" );
365
- free (ncoutfile ); return (1 );
366
- }
367
- ncsetfill (ncoutfile -> ncfid ,NC_NOFILL );
368
- }
369
- /* Open an existing netCDF file for appending */
370
- else
371
- {
372
- if ((ncoutfile -> ncfid = ncopen (outfilename ,NC_WRITE ))== (-1 ))
373
- {
374
- fprintf (stderr ,"Error: cannot open the output netCDF file for appending!\n" );
375
- free (ncoutfile ); return (1 );
376
- }
377
- }
349
+ /* Create a new netCDF output file */
350
+ if ((ncoutfile = (struct fileinfo * )malloc (sizeof (struct fileinfo )))== NULL )
351
+ {
352
+ fprintf (stderr ,"Error: cannot allocate enough memory!\n" ); return (1 );
353
+ }
354
+ if (!appendnc )
355
+ {
356
+ if (stat (outfilename ,& statbuf )== 0 )
357
+ {
358
+ fprintf (stderr ,"Error: output file seems to exist already!\n" );
359
+ free (ncoutfile ); return (1 );
360
+ }
361
+ status = nc__create (outfilename , format , 0 , & blksz , & ncoutfile -> ncfid );
362
+ if (status == (-1 ))
363
+ {
364
+ fprintf (stderr ,"Error: cannot create the output netCDF file!\n" );
365
+ free (ncoutfile ); return (1 );
366
+ }
367
+ ncsetfill (ncoutfile -> ncfid ,NC_NOFILL );
368
+ }
369
+ /* Open an existing netCDF file for appending */
370
+ else
371
+ {
372
+ if ((ncoutfile -> ncfid = ncopen (outfilename ,NC_WRITE ))== (-1 ))
373
+ {
374
+ fprintf (stderr ,"Error: cannot open the output netCDF file for appending!\n" );
375
+ free (ncoutfile ); return (1 );
376
+ }
377
+ }
378
378
}
379
379
380
380
/* No input files are specified on the command-line */
@@ -388,27 +388,27 @@ int main(int argc, char *argv[])
388
388
f = 0 ;
389
389
for (a = nstart ; a <= nend ; a ++ )
390
390
{
391
- if (peWidth < 0 )
392
- {
393
- sprintf (infilename ,"%s.%04d" ,outfilename ,a );
394
- if (stat (infilename ,& statbuf )== 0 )
395
- {
396
- peWidth = 4 ;
397
- }
398
- else
399
- {
400
- sprintf (infilename ,"%s.%06d" ,outfilename ,a );
401
- if (stat (infilename ,& statbuf )== 0 )
402
- {
403
- peWidth = 6 ;
404
- }
405
- else
406
- {
407
- continue ;
408
- }
409
- }
410
- }
411
- sprintf (infilename ,"%s.%0*d" ,outfilename ,peWidth ,a );
391
+ if (peWidth < 0 )
392
+ {
393
+ sprintf (infilename ,"%s.%04d" ,outfilename ,a );
394
+ if (stat (infilename ,& statbuf )== 0 )
395
+ {
396
+ peWidth = 4 ;
397
+ }
398
+ else
399
+ {
400
+ sprintf (infilename ,"%s.%06d" ,outfilename ,a );
401
+ if (stat (infilename ,& statbuf )== 0 )
402
+ {
403
+ peWidth = 6 ;
404
+ }
405
+ else
406
+ {
407
+ continue ;
408
+ }
409
+ }
410
+ }
411
+ sprintf (infilename ,"%s.%0*d" ,outfilename ,peWidth ,a );
412
412
if (stat (infilename ,& statbuf )!= 0 ){
413
413
if (force == 0 ) {
414
414
printf ("ERROR: missing at least %s from the input fileset. Exiting.\n" , infilename );
@@ -467,27 +467,27 @@ int main(int argc, char *argv[])
467
467
f = 0 ;
468
468
for (a = nstart ; a < nend ; a ++ )
469
469
{
470
- if (peWidth < 0 )
471
- {
472
- sprintf (infilename ,"%s.%04d" ,outfilename ,a );
473
- if (stat (infilename ,& statbuf )== 0 )
474
- {
475
- peWidth = 4 ;
476
- }
477
- else
478
- {
479
- sprintf (infilename ,"%s.%06d" ,outfilename ,a );
480
- if (stat (infilename ,& statbuf )== 0 )
481
- {
482
- peWidth = 6 ;
483
- }
484
- else
485
- {
486
- continue ;
487
- }
488
- }
489
- }
490
- sprintf (infilename ,"%s.%0*d" ,outfilename ,peWidth ,a );
470
+ if (peWidth < 0 )
471
+ {
472
+ sprintf (infilename ,"%s.%04d" ,outfilename ,a );
473
+ if (stat (infilename ,& statbuf )== 0 )
474
+ {
475
+ peWidth = 4 ;
476
+ }
477
+ else
478
+ {
479
+ sprintf (infilename ,"%s.%06d" ,outfilename ,a );
480
+ if (stat (infilename ,& statbuf )== 0 )
481
+ {
482
+ peWidth = 6 ;
483
+ }
484
+ else
485
+ {
486
+ continue ;
487
+ }
488
+ }
489
+ }
490
+ sprintf (infilename ,"%s.%0*d" ,outfilename ,peWidth ,a );
491
491
if (stat (infilename ,& statbuf )!= 0 ){
492
492
if (force == 0 ) {
493
493
printf ("ERROR: missing at least %s from the input fileset. Exiting.\n" , infilename );
@@ -599,27 +599,27 @@ int main(int argc, char *argv[])
599
599
// occasionally nfiles may be wrongly set to zero,
600
600
// and yet the user wants to remove the input files in a range.
601
601
//if (++f > nfiles) break;
602
- if (peWidth < 0 )
603
- {
604
- sprintf (infilename ,"%s.%04d" ,outfilename ,a );
605
- if (stat (infilename ,& statbuf )== 0 )
606
- {
607
- peWidth = 4 ;
608
- }
609
- else
610
- {
611
- sprintf (infilename ,"%s.%06d" ,outfilename ,a );
612
- if (stat (infilename ,& statbuf )== 0 )
613
- {
614
- peWidth = 6 ;
615
- }
616
- else
617
- {
618
- continue ;
619
- }
620
- }
621
- }
622
- sprintf (infilename ,"%s.%0*d" ,outfilename ,peWidth ,a );
602
+ if (peWidth < 0 )
603
+ {
604
+ sprintf (infilename ,"%s.%04d" ,outfilename ,a );
605
+ if (stat (infilename ,& statbuf )== 0 )
606
+ {
607
+ peWidth = 4 ;
608
+ }
609
+ else
610
+ {
611
+ sprintf (infilename ,"%s.%06d" ,outfilename ,a );
612
+ if (stat (infilename ,& statbuf )== 0 )
613
+ {
614
+ peWidth = 6 ;
615
+ }
616
+ else
617
+ {
618
+ continue ;
619
+ }
620
+ }
621
+ }
622
+ sprintf (infilename ,"%s.%0*d" ,outfilename ,peWidth ,a );
623
623
if (stat (infilename ,& statbuf )!= 0 ) continue ;
624
624
if (verbose ) printf ("Removing \"%s\"\n" ,infilename );
625
625
unlink (infilename );
@@ -911,16 +911,16 @@ int process_file(char *ncname, unsigned char appendnc,
911
911
}
912
912
913
913
if (deflate == 1 && deflation > 0 )
914
- {
915
- for (v = 0 ; v < ncinfile -> nvars ; v ++ )
916
- {
917
- if ( nc_def_var_deflate (ncoutfile -> ncfid ,v ,shuffle ,deflate ,deflation ) != NC_NOERR )
918
- {
919
- fprintf (stderr ,"Error: nc_def_var_deflate failed! Are you setting NETCDF4?\n" );
920
- usage ();
921
- }
922
- }
923
- }
914
+ {
915
+ for (v = 0 ; v < ncinfile -> nvars ; v ++ )
916
+ {
917
+ if ( nc_def_var_deflate (ncoutfile -> ncfid ,v ,shuffle ,deflate ,deflation ) != NC_NOERR )
918
+ {
919
+ fprintf (stderr ,"Error: nc_def_var_deflate failed! Are you setting NETCDF4?\n" );
920
+ usage ();
921
+ }
922
+ }
923
+ }
924
924
925
925
926
926
/* Definitions done */
0 commit comments