4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
27 #include <sys/types.h>
31 #include "ail_private.h"
39 AIL_PROP_CATEGORIES_STR,
41 AIL_PROP_MIMETYPE_STR,
42 AIL_PROP_X_SLP_SERVICE_STR,
43 AIL_PROP_X_SLP_PACKAGETYPE_STR,
44 AIL_PROP_X_SLP_PACKAGECATEGORIES_STR,
45 AIL_PROP_X_SLP_PACKAGEID_STR,
46 AIL_PROP_X_SLP_SVC_STR,
47 AIL_PROP_X_SLP_EXE_PATH,
48 AIL_PROP_X_SLP_APPID_STR,
49 AIL_PROP_X_SLP_PKGID_STR,
50 AIL_PROP_X_SLP_DOMAIN_STR,
51 AIL_PROP_X_SLP_SUBMODEMAINID_STR,
52 AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR,
53 AIL_PROP_NODISPLAY_BOOL,
54 AIL_PROP_X_SLP_TASKMANAGE_BOOL,
55 AIL_PROP_X_SLP_MULTIPLE_BOOL,
56 AIL_PROP_X_SLP_REMOVABLE_BOOL,
57 AIL_PROP_X_SLP_SUBMODE_BOOL,
62 static void _print_help(const char *cmd)
66 fprintf(stderr, "Usage:\n");
67 fprintf(stderr, "\n");
68 fprintf(stderr, "[Get appinfo value]\n");
69 fprintf(stderr, " %s get <PACKAGE NAME> <COLUMN NAME>\n", cmd);
70 fprintf(stderr, "\n");
71 fprintf(stderr, " <COLUMN NAME>\n");
73 for (i = 0; prop_tbl[i]; i++) {
74 fprintf(stderr, " %s\n", prop_tbl[i]);
77 fprintf(stderr, "\n");
78 fprintf(stderr, " Ex) %s get com.samsung.menu-screen X_SLP_SERVICE\n", cmd);
79 fprintf(stderr, "\n");
84 static int _get_property(const char *property)
92 for (i = 0; prop_tbl[i]; i++) {
93 if (!strcasecmp(prop_tbl[i], property)) {
98 fprintf(stderr, "%s is not found\n", property);
105 static ail_error_e _get_appinfo(const char *package, const char *property, uid_t uid)
107 ail_appinfo_h handle;
117 ret = ail_package_get_appinfo(package, &handle);
118 if (ret != AIL_ERROR_OK)
119 return AIL_ERROR_FAIL;
121 prop = _get_property(property);
129 if (t == VAL_TYPE_STR) {
130 ret = ail_appinfo_get_str(handle, property, &str);
131 if (ret != AIL_ERROR_OK)
134 fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
135 } else if (t == VAL_TYPE_INT) {
136 ret = ail_appinfo_get_int(handle, property, &ival);
137 if (ret != AIL_ERROR_OK)
140 fprintf(stderr, "Package[%s], Property[%s] : %d\n", package, property, ival);
141 } else if (t == VAL_TYPE_BOOL) {
142 ret = ail_appinfo_get_bool(handle, property, &bval);
143 if (ret != AIL_ERROR_OK)
146 fprintf(stderr, "Package[%s], Property[%s] : %d\n", package, property, bval);
152 ret = ail_package_destroy_appinfo(handle);
153 if (ret != AIL_ERROR_OK)
154 return AIL_ERROR_FAIL;
159 int main(int argc, char** argv)
161 ail_error_e ret = AIL_ERROR_OK;
165 if (!strncmp(argv[1], "get", 3)) {
166 ret = _get_appinfo(argv[2], argv[3], getuid());
170 _print_help(argv[0]);
174 if (ret != AIL_ERROR_OK) {
175 fprintf(stderr, "There are some problems\n");