/* from Repair fossil .exe from "Enzyme21" ;*/ /*#include ; #include ; #include ;*/ /*#include ;*/ /*Outside Function, is 4 kinds, 1)discover1st(); 2)discoverend(); 3)closeend(); 4)between2linekw1st(); 5)repairfossil(); 6)refossil2(); ;*/ //========================================================================== int discover1st(char buf[258],char keyword[258]) { /*char buf[258], keyword[258];*/ /*strcpy(buf,str1); strcpy(keyword,str2);*/ static int bufferlength,keywordlength,keychar1st,i,j; /*printf("%d\n",keywordlength); printf("%s%s\n",buf,keyword); exit(1);*/ keychar1st=-1; for(i=0;buf[i]!='\0';i++)//'+1+1'is '\n+\0' character No.; { if (buf[i]==keyword[0]) { for (j=0 ;j<=strlen(keyword)-1;j++) { //For example, 'abcde', //keyword[0]='a' and keyword[4]='e'; if (buf[i+j]!=keyword[j] ) {keychar1st=-1; goto nomatchranaway; } } /*printf("atta!\n"); exit(1);*/ keychar1st=i; goto oncediscover; } nomatchranaway:; } oncediscover:; /*first keyword's keyword[0] 's location sberch,*/ /*ignore after second keywords of one lines.;*/ /*printf("%d\n",keychar1st); exit(1);*/ /*for(i=0;*(buf+i)!='\0';i++) { if (*(buf+i)==*(keyword+0)){ for(j=0;*(keyword+j)!='\0';j++){ if(*(buf+i+j)!=*(keyword+j)){ keychar1st=-1; goto nomatchranaway; } } keychar1st=i; goto oncediscover; } nomatchranaway:; } oncediscover:;*/ return(keychar1st); } //========================================================================== int discoverend(char *buf,char *keyword) { int keywordlength; keywordlength=strlen(keyword); /*;*/ return(discover1st(buf,keyword)+keywordlength-1); } //========================================================================== void closeend(void) { /*;*/ exit(1); } /*=======================================================================;*/ int between2line(char chbuf[258],char keyword[258]) { char newkeyword[258],oldkeyword[258]; strcpy(oldkeyword,keyword); /*printf("%s\n",oldkeyword);*/ int alpha,chno,kl,check; kl=strlen(keyword); check=-1; for(alpha=0;alpha<=kl-1-1;alpha++)/*alpha,new keyword kinds No.;*/ { for(chno=0;chno<=kl-1+2+1;chno++) { if(chno