scc

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

findsec.c (277B)


      1 #include <stdio.h>
      2 #include <string.h>
      3 
      4 #include <scc/mach.h>
      5 
      6 #include "libmach.h"
      7 
      8 int
      9 findsec(Map *map, char *name)
     10 {
     11 	int i;
     12 	struct mapsec *sec;
     13 
     14 	for (i = 0; i < map->n; i++) {
     15 		char *s = map->sec[i].name;
     16 		if (s && strcmp(s, name) == 0)
     17 			return i;
     18 	}
     19 
     20 	return -1;
     21 }