summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2020-06-21 11:59:24 +0100
committerVincent Sanders <vince@kyllikki.org>2020-06-21 12:08:24 +0100
commitb2a1aa9b884ebe2b1283ba54a7864335539b66d7 (patch)
tree84bb8569ddc134396dba8dc3afa27709ad68d137 /utils
parentf31fb08c73b9f4c93f3f89fa865715502afcf390 (diff)
downloadnetsurf-b2a1aa9b884ebe2b1283ba54a7864335539b66d7.tar.gz
netsurf-b2a1aa9b884ebe2b1283ba54a7864335539b66d7.tar.bz2
improvements from review
Diffstat (limited to 'utils')
-rw-r--r--utils/split-messages.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/utils/split-messages.c b/utils/split-messages.c
index fa384feb2..581151485 100644
--- a/utils/split-messages.c
+++ b/utils/split-messages.c
@@ -172,8 +172,13 @@ static nserror process_cmdline(int argc, char **argv, struct param *param)
return NSERROR_OK;
}
-/***
- * extract key/value from a line
+
+/**
+ * extract key/value from a line of input
+ *
+ * \retun NSERROR_OK and key_out and value_out updated
+ * NSERROR_NOT_FOUND if not a key/value input line
+ * NSERROR_INVALID if the line is and invalid format (missing colon)
*/
static nserror
get_key_value(char *line, ssize_t linelen, char **key_out, char **value_out)
@@ -223,6 +228,10 @@ get_key_value(char *line, ssize_t linelen, char **key_out, char **value_out)
return NSERROR_OK;
}
+
+/**
+ * extract language, platform and token elements from a string
+ */
static nserror
get_lang_plat_tok(char *str, char **lang_out, char **plat_out, char **tok_out)
{
@@ -259,6 +268,9 @@ get_lang_plat_tok(char *str, char **lang_out, char **plat_out, char **tok_out)
}
+/**
+ * reverse order of entries in a translation list
+ */
static nserror
translation_list_reverse(struct trnsltn_entry **tlist)
{
@@ -281,6 +293,7 @@ translation_list_reverse(struct trnsltn_entry **tlist)
return NSERROR_OK;
}
+
/**
* find a translation entry from a key
*
@@ -312,6 +325,9 @@ translation_from_key(struct trnsltn_entry *tlist,
}
+/**
+ * create and link an entry into translation list
+ */
static nserror
translation_add(struct trnsltn_entry **tlist,
const char *lang,
@@ -334,6 +350,9 @@ translation_add(struct trnsltn_entry **tlist,
}
+/**
+ * replace key and value on a translation entry
+ */
static nserror
translation_replace(struct trnsltn_entry *tran,
const char *lang,
@@ -350,6 +369,7 @@ translation_replace(struct trnsltn_entry *tran,
return NSERROR_OK;
}
+
/**
* process a line of the input file
*
@@ -395,7 +415,8 @@ messageline(struct param *param,
* new entry is in selected language and
* current entry is not
*/
- res = translation_replace(tran, lang, tok, value); } else if ((strcmp(lang, param->fallback) != 0) &&
+ res = translation_replace(tran, lang, tok, value);
+ } else if ((strcmp(lang, param->fallback) != 0) &&
(strcmp(tran->lang, param->fallback) != 0)) {
/*
* new entry is in fallback language and
@@ -417,6 +438,9 @@ messageline(struct param *param,
}
+/**
+ * read fatmessages file and create a translation entry list
+ */
static nserror
fatmessages_read(struct param *param, struct trnsltn_entry **tlist)
{
@@ -454,6 +478,10 @@ fatmessages_read(struct param *param, struct trnsltn_entry **tlist)
return res;
}
+
+/**
+ * write output in NetSurf messages format
+ */
static nserror
message_write(struct param *param, struct trnsltn_entry *tlist)
{