summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-04-05 19:42:54 +0200
committerEike Rathke <erack@redhat.com>2014-04-05 19:46:15 +0200
commit6564b87c2f6dac2482e530bc43b038a3e93a0e07 (patch)
tree4bf0f6010a8b02fdc629d20d1cba51cbb74fead0 /data
parent79297af6671ab5dd78c904b610abf234e7ab0006 (diff)
resolves #6, include last record in language-subtag-registry.xml
The '%%' in language-subtag-registry is a record delimiter, not record end marker, it is not present on the last record at file end. (cherry picked from commit 4fff73a834f94a7ca256c086d99ea0a654a6c287)
Diffstat (limited to 'data')
-rw-r--r--data/reg2xml.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/data/reg2xml.c b/data/reg2xml.c
index aba0940..95c493f 100644
--- a/data/reg2xml.c
+++ b/data/reg2xml.c
@@ -48,6 +48,7 @@ _parse(const char *filename,
FILE *fp;
char buffer[1024], *range = NULL, *begin = NULL, *end = NULL;
lt_bool_t in_entry = FALSE;
+ lt_bool_t file_end = FALSE;
xmlNodePtr ent = NULL;
if ((fp = fopen(filename, "rb")) == NULL) {
@@ -56,10 +57,13 @@ _parse(const char *filename,
}
while (1) {
fgets(buffer, 1024, fp);
- if (feof(fp))
- break;
+ if (feof(fp)) {
+ if (!in_entry)
+ break;
+ file_end = TRUE;
+ }
_drop_crlf(buffer);
- if (lt_strcmp0(buffer, "%%") == 0) {
+ if (lt_strcmp0(buffer, "%%") == 0 || file_end) {
if (in_entry) {
if (ent) {
if (range) {
@@ -102,7 +106,7 @@ _parse(const char *filename,
ent = NULL;
range = NULL;
}
- in_entry = TRUE;
+ in_entry = !file_end;
} else {
if (!in_entry) {
/* ignore it */