2 * Copyright (C) 2006 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 * $Id: load_file.c,v 1.1.2.1 2006/08/25 21:13:04 darrenr Exp $
12 load_file(char *filename)
14 alist_t *a, *rtop, *rbot;
15 char *s, line[1024], *t;
19 fp = fopen(filename + 7, "r");
21 fprintf(stderr, "load_file cannot open '%s'\n", filename);
30 while (fgets(line, sizeof(line) - 1, fp)) {
31 line[sizeof(line) - 1] = '\0';
34 * Hunt for CR/LF. If no LF, stop processing.
36 s = strchr(line, '\n');
38 fprintf(stderr, "%d:%s: line too long\n", linenum, filename);
45 s = strchr(line, '\r');
48 for (t = line; isspace(*t); t++)
57 * Remove comment markers
59 for (s = t; *s; s++) {
66 * Trim off tailing white spaces
68 s = strlen(t) + t - 1;
81 fprintf(stderr, "%s: unrecognised content line %d\n",