aboutsummaryrefslogtreecommitdiffstats
path: root/ui/text_import.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-03-20 09:06:13 -0700
committerGuy Harris <guy@alum.mit.edu>2019-03-20 16:06:57 +0000
commit38f348bbb0bc829a5f5cdda5f374f7b73809a160 (patch)
treef6efea88a8654eb014a2665c9981a257f1cd1f1d /ui/text_import.c
parent8b8fc662d8e82634bcf5f5d610e5a88419a5a500 (diff)
Put back EOF rule, but without exporting write_current_packet().
Instead, add a new T_EOF token type, call parse_token() with it when we get an EOF, and, in parse_token(), write the current packet if we get a T_EOF token. That's a bit simpler, and would let us treat EOFs in different places differently, if, for example, we want to report warnings for half-finished packets. Change-Id: Ie41a8a1dedf91c34300468e073f18bf806e01892 Reviewed-on: https://code.wireshark.org/review/32489 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/text_import.c')
-rw-r--r--ui/text_import.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/ui/text_import.c b/ui/text_import.c
index da67324423..ac679a6423 100644
--- a/ui/text_import.c
+++ b/ui/text_import.c
@@ -863,6 +863,9 @@ parse_token (token_t token, char *str)
state = READ_BYTE;
}
break;
+ case T_EOF:
+ write_current_packet();
+ break;
default:
break;
}
@@ -914,6 +917,9 @@ parse_token (token_t token, char *str)
state = READ_BYTE;
}
break;
+ case T_EOF:
+ write_current_packet();
+ break;
default:
break;
}
@@ -935,6 +941,9 @@ parse_token (token_t token, char *str)
case T_EOL:
state = START_OF_LINE;
break;
+ case T_EOF:
+ write_current_packet();
+ break;
default:
break;
}
@@ -955,6 +964,9 @@ parse_token (token_t token, char *str)
case T_EOL:
state = START_OF_LINE;
break;
+ case T_EOF:
+ write_current_packet();
+ break;
default:
break;
}
@@ -966,6 +978,9 @@ parse_token (token_t token, char *str)
case T_EOL:
state = START_OF_LINE;
break;
+ case T_EOF:
+ write_current_packet();
+ break;
default:
break;
}
@@ -1117,9 +1132,6 @@ text_import(text_import_info_t *info)
max_offset = info->max_frame_length;
ret = text_import_scan(info->import_text_file);
- if (ret == 0) {
- write_current_packet();
- }
g_free(packet_buf);
return ret;
}