X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tool%2Fsrc%2Fail_package.c;h=d69920fce81da1e16f5f17adec5c1c7b8ced7126;hb=refs%2Ftags%2Fsubmit%2Ftizen_common%2F20151229.144031;hp=fd3a49052b8c58c844bbcc37c0ecb182489c8c82;hpb=9241f15a201da5ea3e02b95f15325f7aa83f64bf;p=platform%2Fcore%2Fappfw%2Fail.git diff --git a/tool/src/ail_package.c b/tool/src/ail_package.c index fd3a490..d69920f 100644 --- a/tool/src/ail_package.c +++ b/tool/src/ail_package.c @@ -58,7 +58,6 @@ char *prop_tbl[] = { NULL }; - static void _print_help(const char *cmd) { int i; @@ -70,29 +69,24 @@ static void _print_help(const char *cmd) fprintf(stderr, "\n"); fprintf(stderr, " \n"); - for (i = 0; prop_tbl[i]; i++) { + for (i = 0; prop_tbl[i]; i++) fprintf(stderr, " %s\n", prop_tbl[i]); - } fprintf(stderr, "\n"); fprintf(stderr, " Ex) %s get com.samsung.menu-screen X_SLP_SERVICE\n", cmd); fprintf(stderr, "\n"); } - - static int _get_property(const char *property) { int i; - if (!property) { + if (!property) return 0; - } for (i = 0; prop_tbl[i]; i++) { - if (!strcasecmp(prop_tbl[i], property)) { + if (!strcasecmp(prop_tbl[i], property)) return i; - } } fprintf(stderr, "%s is not found\n", property); @@ -100,8 +94,6 @@ static int _get_property(const char *property) return -1; } - - static ail_error_e _get_appinfo(const char *package, const char *property, uid_t uid) { ail_appinfo_h handle; @@ -114,7 +106,7 @@ static ail_error_e _get_appinfo(const char *package, const char *property, uid_t int t; /* __is admin */ - ret = ail_package_get_appinfo(package, &handle); + ret = ail_get_appinfo(package, &handle); if (ret != AIL_ERROR_OK) return AIL_ERROR_FAIL; @@ -124,7 +116,7 @@ static ail_error_e _get_appinfo(const char *package, const char *property, uid_t e.prop = prop; p = &e; - ELEMENT_TYPE(p,t); + ELEMENT_TYPE(p, t); if (t == VAL_TYPE_STR) { ret = ail_appinfo_get_str(handle, property, &str); @@ -149,7 +141,7 @@ static ail_error_e _get_appinfo(const char *package, const char *property, uid_t END: free(str); - ret = ail_package_destroy_appinfo(handle); + ret = ail_destroy_appinfo(handle); if (ret != AIL_ERROR_OK) return AIL_ERROR_FAIL; @@ -161,21 +153,16 @@ int main(int argc, char** argv) ail_error_e ret = AIL_ERROR_OK; - if (4 == argc) { - if (!strncmp(argv[1], "get", 3)) { + if (argc == 4) { + if (!strncmp(argv[1], "get", 3)) ret = _get_appinfo(argv[2], argv[3], getuid()); - } - } - else { + } else { _print_help(argv[0]); return EXIT_FAILURE; } - if (ret != AIL_ERROR_OK) { + if (ret != AIL_ERROR_OK) fprintf(stderr, "There are some problems\n"); - } return EXIT_SUCCESS; } - -