/* imgbm_kill_60S.c * * quick program to read from stdin an imgbm file, and write to stdout * only those points that are N of 60S. * * Used to remove GMT coastline and put in SCAR coastline * * whfs 10 jun 1997 */ #include #include struct IMGPAIR { int index; int value; }; main (argc, argv) int argc; char **argv; { struct IMGPAIR p; int nin = 0, nout = 0; int maxindex = 58665600; /* 60S index value. */ if (argc != 1) { fprintf(stderr,"imgbm_kill_60S pass from stdin to stdout imgbm points N of 60S.\n"); fprintf(stderr,"usage: imgbm_kill_60S < input.imgbm > output.imgbm\n"); exit(-1); } while ( (fread( (char *)&p, 8, 1, stdin)) == 1) { nin++; if (p.index < maxindex) { nout++; if ( (fwrite( (char *)&p, 8, 1, stdout)) != 1) { fprintf(stderr, "imgbm_kill_60S: Error writing out at %d %d\n", nin, nout); exit(-1); } } } fprintf(stderr,"imgbm_kill_60S: Read %d and wrote %d points.\n", nin, nout); exit(0); }