scc

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

findsec.c (259B)


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