summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-10-31 16:46:13 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-10-31 16:46:13 +0000
commitccc8c1dae7f1da2a0443f8553a8146c54a4324fd (patch)
treee3e8e89fc89d63959780d27432691ab8c6adf50e /libs
parent760b917114778a0441f235743a9dc6de353c27f8 (diff)
libs/lmo: fix po2lmo to cope with new po format
Diffstat (limited to 'libs')
-rw-r--r--libs/lmo/src/lmo_po2lmo.c46
1 files changed, 31 insertions, 15 deletions
diff --git a/libs/lmo/src/lmo_po2lmo.c b/libs/lmo/src/lmo_po2lmo.c
index 9f78ff2ad..9b7b09792 100644
--- a/libs/lmo/src/lmo_po2lmo.c
+++ b/libs/lmo/src/lmo_po2lmo.c
@@ -99,7 +99,7 @@ int main(int argc, char *argv[])
memset(key, 0, sizeof(val));
memset(val, 0, sizeof(val));
- while( (NULL != fgets(line, sizeof(line), in)) || (state >= 2 && feof(in)) )
+ while( (NULL != fgets(line, sizeof(line), in)) || (state >= 3 && feof(in)) )
{
if( state == 0 && strstr(line, "msgid \"") == line )
{
@@ -108,36 +108,52 @@ int main(int argc, char *argv[])
case -1:
die("Syntax error in msgid");
case 0:
- continue;
- default:
state = 1;
+ break;
+ default:
+ state = 2;
}
}
- else if( state == 1 && strstr(line, "msgstr \"") == line )
+ else if( state == 1 || state == 2 )
{
- switch(extract_string(line, val, sizeof(val)))
+ if( strstr(line, "msgstr \"") == line || state == 2 )
{
- case -1:
- die("Syntax error in msgstr");
- case 0:
- state = 2;
- break;
- default:
- state = 3;
+ switch(extract_string(line, val, sizeof(val)))
+ {
+ case -1:
+ state = 4;
+ break;
+ case 0:
+ state = 2;
+ break;
+ default:
+ state = 3;
+ }
+ }
+ else
+ {
+ switch(extract_string(line, tmp, sizeof(tmp)))
+ {
+ case -1:
+ state = 4;
+ break;
+ default:
+ strcat(key, tmp);
+ }
}
}
- else if( state == 2 )
+ else if( state == 3 )
{
switch(extract_string(line, tmp, sizeof(tmp)))
{
case -1:
- state = 3;
+ state = 4;
break;
default:
strcat(val, tmp);
}
}
- else if( state == 3 )
+ else if( state == 4 )
{
if( strlen(key) > 0 && strlen(val) > 0 )
{