aboutsummaryrefslogtreecommitdiffstats
path: root/filters.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-02-03 06:10:11 +0000
committerGuy Harris <guy@alum.mit.edu>2001-02-03 06:10:11 +0000
commitcacd37893aa40a5c59dc0c72eb09d1ed833516e4 (patch)
treed0d07e4b8e7da5e8db3d56b0709053c5ec3c02fa /filters.c
parent0910e8317f03af2c4917bfc843ddfd86051b6155 (diff)
Increment the line number for every line seen.
Fix the handling of one error case. svn path=/trunk/; revision=2981
Diffstat (limited to 'filters.c')
-rw-r--r--filters.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/filters.c b/filters.c
index b605236267..398e29a038 100644
--- a/filters.c
+++ b/filters.c
@@ -1,7 +1,7 @@
/* filters.c
* Code for reading and writing the filters file.
*
- * $Id: filters.c,v 1.5 2001/02/03 06:03:42 guy Exp $
+ * $Id: filters.c,v 1.6 2001/02/03 06:10:11 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -181,7 +181,7 @@ read_filter_list(filter_list_type_t list, char **pref_path_return,
filt_expr_len = INIT_BUF_SIZE;
filt_expr = g_malloc(filt_expr_len + 1);
- for (;;) {
+ for (line = 1; ; line++) {
/* Lines in a filter file are of the form
"name" expression
@@ -195,7 +195,6 @@ read_filter_list(filter_list_type_t list, char **pref_path_return,
while ((c = getc(ff)) != EOF && isspace(c)) {
if (c == '\n') {
/* Blank line. */
- line++; /* next line */
continue;
}
}
@@ -210,7 +209,6 @@ read_filter_list(filter_list_type_t list, char **pref_path_return,
line);
while (c != '\n')
c = getc(ff); /* skip to the end of the line */
- line++; /* next line */
continue;
}
@@ -259,19 +257,13 @@ read_filter_list(filter_list_type_t list, char **pref_path_return,
/* No newline seen before end-of-line */
g_warning("'%s' line %d doesn't have a closing quote.", ff_path,
line);
- line++; /* next line */
continue;
}
/* Skip over separating white space, if any. */
while ((c = getc(ff)) != EOF && isspace(c)) {
- if (c == '\n') {
- /* No filter expression */
- g_warning("'%s' line %d doesn't have a filter expression.", ff_path,
- line);
- line++; /* next line */
- continue;
- }
+ if (c == '\n')
+ break;
}
if (c == EOF) {
@@ -283,6 +275,13 @@ read_filter_list(filter_list_type_t list, char **pref_path_return,
break; /* nothing more to read */
}
+ if (c == '\n') {
+ /* No filter expression */
+ g_warning("'%s' line %d doesn't have a filter expression.", ff_path,
+ line);
+ continue;
+ }
+
/* "c" is the first non-white-space character; it's the first
character of the filter expression. */
filt_expr_index = 0;