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>
33 static void _print_help(const char *cmd)
35 fprintf(stderr, "Usage:\n");
36 fprintf(stderr, "\n");
37 fprintf(stderr, "[Add a desktop]\n");
38 fprintf(stderr, " %s add <PACKAGE NAME>\n", cmd);
39 fprintf(stderr, "\n");
40 fprintf(stderr, " Ex) %s add com.samsung.menu-screen\n", cmd);
41 fprintf(stderr, "\n");
42 fprintf(stderr, "[Update a desktop]\n");
43 fprintf(stderr, " %s update <PACKAGE NAME>\n", cmd);
44 fprintf(stderr, "\n");
45 fprintf(stderr, " Ex) %s update com.samsung.menu-screen\n", cmd);
46 fprintf(stderr, "\n");
47 fprintf(stderr, "[Remove a desktop]\n");
48 fprintf(stderr, " %s remove <PACKAGE NAME>\n", cmd);
49 fprintf(stderr, "\n");
50 fprintf(stderr, " Ex) %s remove com.samsung.menu-screen\n", cmd);
51 fprintf(stderr, "\n");
56 static ail_error_e _add_desktop(const char *package)
61 return AIL_ERROR_FAIL;
64 ret = ail_desktop_add(package);
65 if (ret != AIL_ERROR_OK) {
66 return AIL_ERROR_FAIL;
74 static ail_error_e _update_desktop(const char *package)
79 return AIL_ERROR_FAIL;
82 ret = ail_desktop_update(package);
83 if (ret != AIL_ERROR_OK) {
84 return AIL_ERROR_FAIL;
92 static ail_error_e _remove_desktop(const char *package)
97 return AIL_ERROR_FAIL;
100 ret = ail_desktop_remove(package);
101 if (ret != AIL_ERROR_OK) {
102 return AIL_ERROR_FAIL;
110 int main(int argc, char** argv)
112 ail_error_e ret = AIL_ERROR_OK;
115 if (!strncmp(argv[1], "add", 3)) {
116 ret = _add_desktop(argv[2]);
117 } else if (!strncmp(argv[1], "update", 6)) {
118 ret = _update_desktop(argv[2]);
119 } else if (!strncmp(argv[1], "remove", 6)) {
120 ret = _remove_desktop(argv[2]);
122 fprintf(stderr, "%s is a invalid command\n", argv[1]);
126 _print_help(argv[0]);
130 if (ret != AIL_ERROR_OK) {
131 fprintf(stderr, "There are some problems\n");