archive.c (324B)
1 #include <stdio.h> 2 #include <string.h> 3 4 #include <scc/ar.h> 5 #include <scc/mach.h> 6 #include "libmach.h" 7 8 int 9 archive(FILE *fp) 10 { 11 int n; 12 fpos_t pos; 13 char magic[SARMAG]; 14 15 fgetpos(fp, &pos); 16 17 n = fread(magic, SARMAG, 1, fp); 18 if (n == 1 && strncmp(magic, ARMAG, SARMAG) == 0) 19 return 1; 20 21 fsetpos(fp, &pos); 22 23 return 0; 24 }