/* Copyright (C) 1999 E. H. Haley there's some irritating images in the big database, but there's no time to remove the files and rebuild the trex. So, write a thing to accept args trex infile, trex outfile, and prefixes to skip in a copy... from ~ebeth/proj/hc/pix/p40kflat/ we're losing these: ../../tedit flat.trex flatter.trex C03H C02H I01I B06C E02D E05C You could delete those at your leisure... */ #include #include #include //#include #include "lib/tile.h" int main(int aardc, char **aardv) { FILE *infile,*outfile; tfile curimg; res *tree; int i,j, flag; if (aardc<4) { printf("Usage: \"./tedit intilefile outtilefile matchstrings\n"); exit(0); } infile=fopen(*++aardv,"r"); outfile=fopen(*++aardv,"w"); while(1) { if (fread(&curimg,sizeof(tfile),1,infile)==0) { fclose(infile); fclose(outfile); exit(0); } tree=(res *)malloc(curimg.nnodes * sizeof(res)); fread(tree,curimg.nnodes*sizeof(res),1,infile); flag=1; for (i=1; i<=aardc-3; i++) flag &= (strncmp(curimg.fname, *(aardv+i),strlen(*(aardv+i)))==0?0:1); printf("\n%s",curimg.fname); if (flag==0) continue; printf("copying..."); fwrite(&curimg, sizeof(tfile),1,outfile); fwrite(tree, curimg.nnodes*sizeof(res),1,outfile); free(tree); } exit(0); }