# include # include # define LINLEN 80 # define Zlen 9 /* crude hardwired teardown of gaussian 92 output files, looks for key words Distance Z-Mat ZERO-POINT and GINC */ int main(argc,argv) int argc; char **argv; { char CurentLine[LINLEN],*ptr; FILE *File1,*File2; char Outfile[LINLEN],InFile[LINLEN], *logptr,*srt; int i,j; Outfile[0]='b';Outfile[1]='a';Outfile[2]='d'; Outfile[3]='i';Outfile[4]='n';Outfile[5]='p'; Outfile[6]='u';Outfile[7]='t';Outfile[8]='.'; Outfile[9]='l';Outfile[10]='o';Outfile[11]='g'; Outfile[12]= '\n'; if(argc<1) return(1); printf("\n argv1 was\n"); printf(argv[1]); printf("XXXXX"); if (logptr = strstr(argv[1],".log")) { *(logptr+4) = 0; strcpy(InFile,argv[1]); } printf("XXXEndfilenamemarker "); if ((File1=fopen(InFile,"rt"))==NULL) { printf("\n got a dud argv[1]\n"); return(1); } if (logptr = strstr(argv[1],".log")) strcpy(Outfile,argv[1]); if (logptr = strstr(Outfile,".log")) { *(logptr +1) = 'o'; *(logptr +2) = 'u'; *(logptr +3) = 't'; } if ((File2=fopen(Outfile,"wt"))==NULL) return(1); for(;;) { if(fgets(CurentLine,LINLEN,File1)==NULL) return(0); ptr=strstr(CurentLine,"Z-MAT"); if (ptr) { /* found a Z-Mat section */ if(File2!=NULL) /* rewrite from head of file*/ fclose(File2); if ((File2=fopen(Outfile,"wt"))==NULL) return(1); fputs(CurentLine,File2); for(j=1;j