3 static void _print_help(const char *cmd)
7 fprintf(stderr, "Usage:\n");
9 fprintf(stderr, "[Get appinfo value]\n");
10 fprintf(stderr, " %s get <PACKAGE NAME> <COLUMN NAME>\n", cmd);
11 fprintf(stderr, "\n");
12 fprintf(stderr, " <COLUMN NAME>\n");
14 for (i = 0; prop_tbl[i]; i++) {
15 fprintf(stderr, " %s\n", prop_tbl[i]);
18 fprintf(stderr, "\n");
19 fprintf(stderr, " Ex) %s get com.samsung.menu-screen X_SLP_SERVICE\n", cmd);
20 fprintf(stderr, "\n");
25 static int _get_property(const char *property)
33 for (i = 0; prop_tbl[i]; i++) {
34 if (!strcasecmp(prop_tbl[i], property)) {
39 fprintf(stderr, "%s is not found\n", property);
46 static ail_error_e _get_appinfo(const char *package, const char *property)
57 ret = ail_package_get_appinfo(package, &handle);
58 if (ret != AIL_ERROR_OK) {
59 return AIL_ERROR_FAIL;
62 prop = _get_property(property);
64 return AIL_ERROR_FAIL;
71 if (t == VAL_TYPE_STR) {
72 ret = ail_appinfo_get_str(handle, prop, &str);
73 if (ret != AIL_ERROR_OK) {
74 return AIL_ERROR_FAIL;
76 fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
77 } else if (t == VAL_TYPE_INT) {
78 ret = ail_appinfo_get_int(handle, prop, &ival);
79 if (ret != AIL_ERROR_OK) {
80 return AIL_ERROR_FAIL;
82 fprintf(stderr, "Package[%s], Property[%s] : %d\n", package, property, ival);
83 } else if (t == VAL_TYPE_BOOL) {
84 ret = ail_appinfo_get_bool(handle, prop, &bval);
85 if (ret != AIL_ERROR_OK) {
86 return AIL_ERROR_FAIL;
88 fprintf(stderr, "Package[%s], Property[%s] : %d\n", package, property, bval);
91 ret = ail_package_destroy_appinfo(handle);
92 if (ret != AIL_ERROR_OK) {
93 return AIL_ERROR_FAIL;
99 int main(int argc, char** argv)
101 ail_error_e ret = AIL_ERROR_OK;
105 if (!strncmp(argv[1], "get", 3)) {
106 ret = _get_appinfo(argv[2], argv[3]);
110 _print_help(argv[0]);
114 if (ret != AIL_ERROR_OK) {
115 fprintf(stderr, "There are some problems\n");