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