summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJengHyun Kang <jhyuni.kang@samsung.com>2016-08-11 11:40:01 +0900
committerJengHyun Kang <jhyuni.kang@samsung.com>2016-08-11 14:01:59 +0900
commit92757f28fc9cf7fb90bdfc290b1b97e173c30a72 (patch)
treeddc80f2f72322f9aedfe73b7de78f6e27c17aa01
parente5fe530882c11969d12608810f9be0c6221377a7 (diff)
downloadxkeyboard-config-92757f28fc9cf7fb90bdfc290b1b97e173c30a72.tar.gz
xkeyboard-config-92757f28fc9cf7fb90bdfc290b1b97e173c30a72.tar.bz2
xkeyboard-config-92757f28fc9cf7fb90bdfc290b1b97e173c30a72.zip
Change-Id: I6f1fb02fa110bc2e730e89a9964e14b8cc96ea29
-rw-r--r--cache/cache.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/cache/cache.c b/cache/cache.c
index cab812a3..4b79281f 100644
--- a/cache/cache.c
+++ b/cache/cache.c
@@ -90,31 +90,31 @@ void parseArgs(int argc, char **argv, struct xkb_rule_names *names)
{
res = fscanf(file, "%1023s", buf);
if (res < 0) break;
- if (strstr(buf, "rules") > 0)
+ if (!names->rules && strstr(buf, "rules") > 0)
{
tmp = strtok_r(buf, "=", &buf_ptr);
tmp = strtok_r(NULL, "=", &buf_ptr);
if (tmp) names->rules= strdup(tmp);
}
- else if (strstr(buf, "model") > 0)
+ else if (!names->model && strstr(buf, "model") > 0)
{
tmp = strtok_r(buf, "=", &buf_ptr);
tmp = strtok_r(NULL, "=", &buf_ptr);
if (tmp) names->model= strdup(tmp);
}
- else if (strstr(buf, "layout") > 0)
+ else if (!names->layout && strstr(buf, "layout") > 0)
{
tmp = strtok_r(buf, "=", &buf_ptr);
tmp = strtok_r(NULL, "=", &buf_ptr);
if (tmp) names->layout= strdup(tmp);
}
- else if (strstr(buf, "variant") > 0)
+ else if (!names->variant && strstr(buf, "variant") > 0)
{
tmp = strtok_r(buf, "=", &buf_ptr);
tmp = strtok_r(NULL, "=", &buf_ptr);
if (tmp) names->variant= strdup(tmp);
}
- else if (strstr(buf, "options") > 0)
+ else if (!names->options && strstr(buf, "options") > 0)
{
tmp = strtok_r(buf, "=", &buf_ptr);
tmp = strtok_r(NULL, "=", &buf_ptr);
@@ -130,35 +130,35 @@ void parseArgs(int argc, char **argv, struct xkb_rule_names *names)
{
printf("Cache file rule from argument\n");
- if (strstr(argv[i], "-rules") > 0)
+ if (!names->rules && strstr(argv[i], "-rules") > 0)
{
tmp = strtok_r(argv[i], "=", &buf_ptr);
tmp = strtok_r(NULL, "=", &buf_ptr);
- names->rules= strdup(tmp);
+ if (tmp) names->rules= strdup(tmp);
}
- else if (strstr(argv[i], "-model") > 0)
+ else if (!names->model && strstr(argv[i], "-model") > 0)
{
tmp = strtok_r(argv[i], "=", &buf_ptr);
tmp = strtok_r(NULL, "=", &buf_ptr);
- names->model = strdup(tmp);
+ if (tmp) names->model = strdup(tmp);
}
- else if (strstr(argv[i], "-layout") > 0)
+ else if (!names->layout && strstr(argv[i], "-layout") > 0)
{
tmp = strtok_r(argv[i], "=", &buf_ptr);
tmp = strtok_r(NULL, "=", &buf_ptr);
- names->layout = strdup(tmp);
+ if (tmp) names->layout = strdup(tmp);
}
- else if (strstr(argv[i], "-variant") > 0)
+ else if (!names->variant && strstr(argv[i], "-variant") > 0)
{
tmp = strtok_r(argv[i], "=", &buf_ptr);
tmp = strtok_r(NULL, "=", &buf_ptr);
- names->variant = strdup(tmp);
+ if (tmp) names->variant = strdup(tmp);
}
- else if (strstr(argv[i], "-options") > 0)
+ else if (!names->options && strstr(argv[i], "-options") > 0)
{
tmp = strtok_r(argv[i], "=", &buf_ptr);
tmp = strtok_r(NULL, "=", &buf_ptr);
- names->options = strdup(tmp);
+ if (tmp) names->options = strdup(tmp);
}
}
}
@@ -198,7 +198,7 @@ int main(int argc, char **argv)
{
struct xkb_context *ctx;
struct xkb_keymap *map;
- struct xkb_rule_names names;
+ struct xkb_rule_names names = {0, };
char *keymap_path = NULL;
char *keymap_string = NULL;
char *cache_path = NULL;