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.
25 #include <sys/types.h>
31 #define TMP_FILE "/tmp/.testpkg"
36 static bundle *create_internal_bundle(int start)
44 for (i = start; i < gargc - 1; i++) {
45 if ((i + 1) > gargc - 1)
46 bundle_add(kb, gargv[i], " ");
49 strncpy(arg, gargv[i + 1], 1024);
50 val_array[0] = strtok(arg,",");
53 val_array[j] = strtok(NULL,",");
54 if(val_array[j] == NULL)
59 bundle_add(kb, gargv[i], gargv[i + 1]);
61 bundle_add_str_array(kb, gargv[i],
62 (const char**)val_array, j);
76 kb = create_internal_bundle(2);
78 printf("bundle creation fail\n");
82 pid = aul_launch_app(gargv[1], kb);
88 /* Write the package name to TMP_FILE*/
89 fp = fopen(TMP_FILE, "w");
92 ret = fprintf(fp, "%d", pid);
100 void print_usage(char *progname)
102 printf("[usage] %s <pkgname> <key1> <val1> <key2> <val2> ...\n",
106 static Eina_Bool run_func(void *data)
109 printf("... successfully launched\n");
111 printf("... launch failed\n");
114 ecore_main_loop_quit();
119 int main(int argc, char **argv)
122 /* Checking the User ID*/
123 if (getuid() != ROOT_UID) {
124 fprintf(stderr, "permission error\n");
129 print_usage(argv[0]);
138 aul_launch_init(NULL, NULL);
140 ecore_idler_add(run_func, NULL);
142 ecore_main_loop_begin();