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,
61 static void _print_help(const char *cmd)
65 fprintf(stderr, "Usage:\n");
66 fprintf(stderr, "\n");
67 fprintf(stderr, "[Get appinfo value]\n");
68 fprintf(stderr, " %s get <PACKAGE NAME> <COLUMN NAME>\n", cmd);
69 fprintf(stderr, "\n");
70 fprintf(stderr, " <COLUMN NAME>\n");
72 for (i = 0; prop_tbl[i]; i++)
73 fprintf(stderr, " %s\n", prop_tbl[i]);
75 fprintf(stderr, "\n");
76 fprintf(stderr, " Ex) %s get com.samsung.menu-screen X_SLP_SERVICE\n", cmd);
77 fprintf(stderr, "\n");
80 static int _get_property(const char *property)
87 for (i = 0; prop_tbl[i]; i++) {
88 if (!strcasecmp(prop_tbl[i], property))
92 fprintf(stderr, "%s is not found\n", property);
97 static ail_error_e _get_appinfo(const char *package, const char *property, uid_t uid)
109 ret = ail_get_appinfo(package, &handle);
110 if (ret != AIL_ERROR_OK)
111 return AIL_ERROR_FAIL;
113 prop = _get_property(property);
121 if (t == VAL_TYPE_STR) {
122 ret = ail_appinfo_get_str(handle, property, &str);
123 if (ret != AIL_ERROR_OK)
126 fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
127 } else if (t == VAL_TYPE_INT) {
128 ret = ail_appinfo_get_int(handle, property, &ival);
129 if (ret != AIL_ERROR_OK)
132 fprintf(stderr, "Package[%s], Property[%s] : %d\n", package, property, ival);
133 } else if (t == VAL_TYPE_BOOL) {
134 ret = ail_appinfo_get_bool(handle, property, &bval);
135 if (ret != AIL_ERROR_OK)
138 fprintf(stderr, "Package[%s], Property[%s] : %d\n", package, property, bval);
144 ret = ail_destroy_appinfo(handle);
145 if (ret != AIL_ERROR_OK)
146 return AIL_ERROR_FAIL;
151 int main(int argc, char** argv)
153 ail_error_e ret = AIL_ERROR_OK;
157 if (!strncmp(argv[1], "get", 3))
158 ret = _get_appinfo(argv[2], argv[3], getuid());
160 _print_help(argv[0]);
164 if (ret != AIL_ERROR_OK)
165 fprintf(stderr, "There are some problems\n");