scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

copysec.c (283B)


      1 #include <stdio.h>
      2 
      3 #include <scc/mach.h>
      4 
      5 #include "libmach.h"
      6 
      7 int
      8 copysec(Mapsec *msec, FILE *fp)
      9 {
     10 	long n;
     11 	Section *sec = &msec->sec;
     12 
     13 	fseek(msec->fp, sec->offset, SEEK_SET);
     14 	for (n = msec->fsiz; n != 0; n--)
     15 		putc(getc(msec->fp), fp);
     16 
     17 	return ferror(msec->fp) ? -1 : 0;
     18 }