static void show_help(void)
{
+ /* TODO : support -l (--lang) option */
printf("system_info_init_db [OPTIONS]\n");
printf(" -h --help Show this help\n");
printf(" -k --key=KEY System info key to update\n");
printf(" -t --type=TYPE System info type to update (int/bool/double/string)\n");
printf(" -g --tag=TAG System info tag to update (platform/custom)\n");
- printf(" -l --lang=LANG System info value to update (capi/webapi/csapi\n");
printf(" -v --value=VALUE System info value to update\n");
}
char type[KEY_MAX] = {0};
char tag[KEY_MAX] = {0};
char value[KEY_MAX] = {0};
- char lang[KEY_MAX] = {0};
+ char value_bool[LANG_MAX] = {0};
struct option long_options[] = {
{ "key", required_argument, 0, 0 },
{ "type", required_argument, 0, 0 },
{ "tag", required_argument, 0, 0 },
{ "value", required_argument, 0, 0 },
- { "lang", required_argument, 0, 0 },
{ "help", no_argument, 0, 0 },
{ 0, 0, 0, 0 },
};
case 'v':
snprintf(value, sizeof(value), "%s", optarg);
break;
- case 'l':
- snprintf(lang, sizeof(lang), "%s", optarg);
- break;
case 'h':
default:
show_help();
return -ENOENT;
}
- ret = db_set_value(&db, tag, key, type, value, strlen(value));
+ if (!strncmp(type, "bool", 4)) {
+ memset(value_bool, value[0] == 't' ? 'T' : 'F', LANG_MAX);
+ ret = db_set_value(&db, tag, key, type, value_bool, LANG_MAX);
+ } else
+ ret = db_set_value(&db, tag, key, type, value, strlen(value));
if (ret != 0)
_E("Failed to set value (%d)", ret);