/* return 1 if get extra field */ int parseextra(heads * hdr,char * p,int len) { int code; int slen; while(len>4) { code=*p++; code+=(*p++)<<8; slen=*p++; slen+=(*p++)<<8; if(code==0x4341) /* a hit */ { if(!memcmp(p,"ARC0",4)) { // DP 1/11/2007 hdr->load=makelong((byte*)(p+4)); hdr->exec=makelong((byte*)(p+8)); hdr->acc=makelong((byte*)(p+12)); if(len==20 || len==24) return(2); // DP 1/11/2007 it is a SparkFS header and contains nothing else return(1); } // DP 1/11/2007 } p+=slen; len-=slen+4; } return(0); } static int writeextra(heads * hdr,char * p) { int len; len=4+16; /* was +4; */ *p++=0x41; *p++=0x43; *p++=len; *p++=len>>8; *p++='A'; *p++='R'; *p++='C'; *p++='0'; unmakelong((byte*)p,hdr->load); p+=4; unmakelong((byte*)p,hdr->exec); p+=4; unmakelong((byte*)p,hdr->acc); p+=4; unmakelong((byte*)p,0); p+=4; return(len+4); /* was len */ }