unrealircd

- supernets unrealircd source & configuration
git clone git://git.acid.vegas/unrealircd.git
Log | Files | Refs | Archive | README | LICENSE

def-clean.c (600B)

      1 /* A small utility to clean a def file */
      2 
      3 #include <stdio.h>
      4 #include <stdlib.h>
      5 #include <string.h>
      6 
      7 int main(int argc, char *argv[]) {
      8 	FILE *fd, *fdout;
      9 	char buf[1024];
     10 
     11 	if (argc < 3)
     12 		exit(1);
     13 
     14 	if (!(fd = fopen(argv[1], "r")))
     15 		exit(2);
     16 	
     17 	if (!(fdout = fopen(argv[2], "w")))
     18 		exit(3);
     19 
     20 	while (fgets(buf, 1023, fd))
     21 	{
     22 		if (*buf == '\t') 
     23 		{
     24 			char *symbol = strtok(buf, " ");
     25 
     26 			if (!strncmp(symbol, "\t_real@", 7))
     27 				continue;
     28 			if (!strncmp(symbol, "\t_xmm@", 6))
     29 				continue;
     30 
     31 			fprintf(fdout, "%s\r\n", symbol);	
     32 		
     33 		}
     34 		else
     35 			fprintf(fdout, "%s", buf);
     36 
     37 	}
     38 	return 0;
     39 }