home *** CD-ROM | disk | FTP | other *** search
- /*
- ** MCPP.trans: Konvertiert Maxon C Fehlerdateien für MegaEd
- ** von M-J, 100% PD
- */
-
- #include <exec/memory.h>
- #include <dos/dos.h>
- #include <dos/dostags.h>
- #include <string.h>
-
- void main(void)
- {
- const char *file1="T:MegaEdMake-ErrFile";
- const char *file2="T:MegaEdMake-Errors";
- const char lc[]="Linker complete";
- BPTR con;
- BPTR fileh;
- char *old=NULL,*new=NULL;
- char *off, *off2, *dest, *warn, *last;
- LONG len;
- short i;
- BOOL meldung=FALSE;
- //MCPP Datei lesen
- if(!(fileh=Open(file1,MODE_OLDFILE))) return;
- Seek(fileh,0,OFFSET_END);
- len=Seek(fileh,0,OFFSET_BEGINNING);
- if(len)
- {
- if(!(old=(char*)AllocVec(len+1,MEMF_PUBLIC)))
- {Close(fileh); return;}
- if(Read(fileh,old,len)!=len)
- {FreeVec(old); Close(fileh); return;}
- }
- Close(fileh);
- if(!len) return;
- old[len]=0;
- // Konvertierung
- if(!(new=(char*)AllocVec(len+1,MEMF_PUBLIC))) return;
-
- off=old;
- dest=new;
- if(!(off=strchr(off,10))) goto esc;
- off++;
-
- for(;;)
- {
- if(!(off2=strchr(off,10))) break;
- *off2=0;
- // Text
- if(!(off2=strchr(off,10)))
- off2=strchr(off,0);
- *off2=0;
- if(!strncmp(off,lc,strlen(lc)))
- {
- for(;*off;off++)
- if(isdigit(*off)) break;
- if(!*off) break;
- *dest='S'; dest++;
- strcpy(dest,off);
- dest+=strlen(dest);
- *dest=10;
- last=dest+1;
- meldung=TRUE;
- break;
- }
-
- off+=strlen(off)+1;
- if(!(off2=strchr(off,10)))
- off2=strchr(off,0);
- *off2=0;
-
- meldung=TRUE;
- strcpy(dest,off);
- off+=strlen(off)+1;
- dest+=strlen(dest);
- *dest=10;
- dest++;
- last=dest;
-
- if(!*off) break;
- }
- esc:
- if(meldung)
- {
- if(fileh=Open(file2,MODE_NEWFILE))
- {
- len=(LONG)last-(LONG)new;
- Write(fileh,new,len);
- Close(fileh);
- }
- }
- else DeleteFile(file2);
- if(old) FreeVec(old);
- if(new) FreeVec(new);
- }
-
-