From: Baptiste DURAND Date: Thu, 4 Sep 2014 14:14:04 +0000 (+0200) Subject: Add ail_list tool X-Git-Tag: accepted/tizen/common/20140905.091237^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F15%2F27115%2F1;p=platform%2Fcore%2Fappfw%2Fail.git Add ail_list tool This tools permits to list all applications avaibles for the current user Change-Id: I992863ea98b238c841707eb0c9e995b550146724 Signed-off-by: Baptiste DURAND --- diff --git a/packaging/ail.spec b/packaging/ail.spec index 6f1dd8f..e124478 100755 --- a/packaging/ail.spec +++ b/packaging/ail.spec @@ -106,6 +106,7 @@ fi %{_bindir}/ail_fota %{_bindir}/ail_desktop %{_bindir}/ail_filter +%{_bindir}/ail_list %{_bindir}/ail_package %{_datadir}/install-info/* %{_libdir}/libail.so.0 diff --git a/tool/CMakeLists.txt b/tool/CMakeLists.txt index e898c7e..afae731 100755 --- a/tool/CMakeLists.txt +++ b/tool/CMakeLists.txt @@ -12,6 +12,9 @@ SET(DESKSRCS src/ail_desktop.c) SET(FILTER ail_filter) SET(FILTERSRCS src/ail_filter.c) +SET(LIST ail_list) +SET(LISTSRCS src/ail_list.c) + SET(PKG ail_package) SET(PKGSRCS src/ail_package.c) @@ -49,9 +52,18 @@ SET_TARGET_PROPERTIES(${FILTER} PROPERTIES SKIP_BUILD_RPATH true) INSTALL(TARGETS ${FILTER} DESTINATION ${BINDIR}) + +ADD_EXECUTABLE(${LIST} ${LISTSRCS}) +TARGET_LINK_LIBRARIES(${LIST} ${LIBNAME} ${INITDB_PKGS_LIBRARIES}) +SET_TARGET_PROPERTIES(${LIST} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS}") +SET_TARGET_PROPERTIES(${LIST} PROPERTIES SKIP_BUILD_RPATH true) + +INSTALL(TARGETS ${LIST} DESTINATION ${BINDIR}) + + ADD_EXECUTABLE(${PKG} ${PKGSRCS}) TARGET_LINK_LIBRARIES(${PKG} ${LIBNAME} ${INITDB_PKGS_LIBRARIES}) SET_TARGET_PROPERTIES(${PKG} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS}") SET_TARGET_PROPERTIES(${PKG} PROPERTIES SKIP_BUILD_RPATH true) -INSTALL(TARGETS ${PKG} DESTINATION ${BINDIR}) \ No newline at end of file +INSTALL(TARGETS ${PKG} DESTINATION ${BINDIR}) diff --git a/tool/src/ail_list.c b/tool/src/ail_list.c new file mode 100644 index 0000000..6fe9dd0 --- /dev/null +++ b/tool/src/ail_list.c @@ -0,0 +1,70 @@ +/* + * ail_list.c is based on ail_filter.c + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include +#include +#include "ail.h" +#include "ail_private.h" + + +static void usage(const char *name) +{ + fprintf(stderr, "\n"); + fprintf(stderr, " Usage: %s\n", name); + fprintf(stderr, "\n"); +} + + +ail_cb_ret_e appinfo_list_appid_namefunc(const ail_appinfo_h appinfo, void *user_data) +{ + char* package_str_name = NULL; + char* package_str_appid = NULL; + char* package_str_x_slp_exe = NULL; + ail_appinfo_get_str(appinfo, AIL_PROP_X_SLP_APPID_STR, &package_str_appid); + ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &package_str_name); + ail_appinfo_get_str(appinfo, AIL_PROP_X_SLP_EXE_PATH, &package_str_x_slp_exe); + + printf("'%s' '%s' '%s'\n",package_str_appid, package_str_name, package_str_x_slp_exe); + return 0; +} + + + +int main(int argc, char *argv[]) +{ + int o; + bool err; + if(getuid() == 0) { + printf("Please use it as non root user\n"); + return; + } + + printf("Application List for user %lu\n", (long)getuid()); + printf("User's Application \n"); + printf("APPID NAME EXEPATH \n"); + ail_filter_list_usr_appinfo_foreach(NULL, appinfo_list_appid_namefunc, NULL, getuid()); + printf("Global's / Common Applications \n"); + printf("APPID NAME EXEPATH \n"); + ail_filter_list_appinfo_foreach(NULL, appinfo_list_appid_namefunc, NULL); + printf("=================================================\n"); + return 0; +}