rem: if(make_sparcboot) { writesparcbootblock(fd, nextpage+1); }
add: if (make_sparcboot) writesparcbootblock(fd, nextpage + 1);
context: void makeboot(section *s, char *outfile){    int fd;    void *rawdata[64];    int rawsize[64];    char fill[4096];    boot_dir bdir;    int i,c;    int nextpage = 1; /* page rel offset of next loaded object */    memset(fill,0,4096);        memset(&bdir, 0, 4096);    for(i=0;i<64;i++){        rawdata[i] = NULL;        rawsize[i] = 0;    }    c = 1;    bdir.bd_entry[0].be_type = fix(BE_TYPE_DIRECTORY);    bdir.bd_entry[0].be_size = fix(1);    bdir.bd_entry[0].be_vsize = fix(1);    rawdata[0] = (void *) &bdir;    rawsize[0] = 4096;        strcpy(bdir.bd_entry[0].be_name,"SBBB/Directory");    while(s){        char *type = getvaldef(s,"type","NONE");        char *file = getval(s,"file");        int vsize;        int size;        struct stat statbuf;                if(!type) die("section %s has no type",s->name);        strncpy(centry.be_name,s->name, BOOTDIR_NAMELEN);        centry.be_name[BOOTDIR_NAMELEN - 1] = 0;        if(!file) die("section %s has no file",s->name);        rawdata[c]= ((strcmp(type, "elf32")==0)?loadstripfile:loadfile)(file,&rawsize[c]);        if(!rawdata[c])           die("cannot load \"%s\"",file);        if(stat(file,&statbuf))            die("cannot stat \"%s\"",file);        vsize = statbuf.st_size;                centry.be_size = rawsize[c] / 4096 + (rawsize[c] % 4096 ? 1 : 0);        centry.be_vsize =             (vsize < centry.be_size) ? centry.be_size : vsize;        centry.be_offset = nextpage;        nextpage += centry.be_size;        centry.be_size = fix(centry.be_size);        centry.be_vsize = fix(centry.be_vsize);        centry.be_offset = fix(centry.be_offset);                if(!strcmp(type,"boot")){            centry.be_type = fix(BE_TYPE_BOOTSTRAP);            centry.be_code_vaddr = fix(atoi(getvaldef(s,"vaddr","0")));            centry.be_code_ventr = fix(atoi(getvaldef(s,"ventry","0")));                    }        if(!strcmp(type,"code")){            centry.be_type = fix(BE_TYPE_CODE);            centry.be_code_vaddr = fix(atoi(getvaldef(s,"vaddr","0")));            centry.be_code_ventr = fix(atoi(getvaldef(s,"ventry","0")));         }        if(!strcmp(type,"data")){            centry.be_type = fix(BE_TYPE_DATA);        }        if(!strcmp(type,"elf32")){            centry.be_type = fix(BE_TYPE_ELF32);            centry.be_code_vaddr = 0;            centry.be_code_ventr = fix(elf_find_entry(rawdata[c], rawsize[c]));        }        if(centry.be_type == BE_TYPE_NONE){            die("unrecognized section type \"%s\"",type);        }        c++;        s = s->next;                if(c == BOOTDIR_MAX_ENTRIES) die("too many sections (>63)",NULL);    }    if((fd = open(outfile, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) {        die("cannot write to \"%s\"",outfile);    }/* XXX - Hope this isn't needed :(    if(make_sparcboot) {        writesparcbootblock(fd, nextpage+1);    }*/    for(i=0;i<c;i++){        write(fd, rawdata[i], rawsize[i]);        if(rawsize[i]%4096)             write(fd, fill, 4096 - (rawsize[i]%4096));    }    close(fd);}