URI: 
       objtype.c - scc - simple c99 compiler
  HTML git clone git://git.simple-cc.org/scc
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
       objtype.c (360B)
       ---
            1 #include <stdio.h>
            2 
            3 #include <scc/mach.h>
            4 
            5 #include "libmach.h"
            6 
            7 #include "elf/fun.h"
            8 #include "coff32/fun.h"
            9 
           10 static int (*ops[NFORMATS])(char *) = {
           11         [COFF32] = coff32type,
           12         [ELF] = elftype,
           13 };
           14 
           15 int
           16 objtype(char *name)
           17 {
           18         int t;
           19         int (**bp)(char *);
           20 
           21         for (bp = ops; bp < &ops[NFORMATS]; ++bp) {
           22                 if ((t = (**bp)(name)) >= 0)
           23                         return t;
           24         }
           25 
           26         return -1;
           27 }