return -1;
}
- type = p_info->args[1];
- pkgpath = p_info->args[2];
- pkgid = p_info->args[3];
- teppath = p_info->args[4];
-
- D("args: type=%s, pkgpath=%s, pkgid=%s, teppath=%s\n", type, pkgpath, pkgid, teppath);
-
- if (strncmp(pkgid, "null", 4) == 0) {
- if (strncmp(teppath, "null", 4) == 0) {
- /* Normal install case */
- snprintf(buf, len, "pkgcmd -i -q -t \'%s\' -p \'%s\' -G", type, pkgpath);
- } else {
- /* TEP install case */
- snprintf(buf, len, "pkgcmd -i -q -p \'%s\' -e \'%s\' -G", pkgpath, teppath);
- }
- } else {
- /* Re-install case */
- snprintf(buf, len, "pkgcmd -r -q -t \'%s\' -n \'%s\'", type, pkgid);
- }
-
- return 0;
+ type = parse_arg(p_info->args[1]);
+ pkgpath = parse_arg(p_info->args[2]);
+ pkgid = parse_arg(p_info->args[3]);
+ teppath = parse_arg(p_info->args[4]);
+
+ if (type != NULL && pkgpath != NULL && pkgid != NULL && teppath != NULL) {
+ D("args: type=%s, pkgpath=%s, pkgid=%s, teppath=%s\n", type, pkgpath, pkgid, teppath);
+
+ if (strncmp(pkgid, "null", 4) == 0) {
+ if (strncmp(teppath, "null", 4) == 0) {
+ /* Normal install case */
+ snprintf(buf, len, "pkgcmd -i -q -t %s -p %s -G", type, pkgpath);
+ } else {
+ /* TEP install case */
+ snprintf(buf, len, "pkgcmd -i -q -p %s -e %s -G", pkgpath, teppath);
+ }
+ } else {
+ /* Re-install case */
+ snprintf(buf, len, "pkgcmd -r -q -t %s -n %s", type, pkgid);
+ }
+
+ free(type);
+ free(pkgpath);
+ free(pkgid);
+ free(teppath);
+
+ return 0;
+ }
+ if (type != NULL) {
+ free(type);
+ }
+ if (pkgpath != NULL) {
+ free(pkgpath);
+ }
+ if (pkgid != NULL) {
+ free(pkgid);
+ }
+ if (teppath != NULL) {
+ free(teppath);
+ }
+ return -1;
}
static int appcmd_uninstall_gen_shellcmd(appcmd_info* p_info) {
return -1;
}
- pkgid = p_info->args[1];
+ pkgid = parse_arg(p_info->args[1]);
- D("args: pkgid=%s\n", pkgid);
+ if (pkgid != NULL) {
+ D("args: pkgid=%s\n", pkgid);
- snprintf(buf, len, "pkgcmd -u -q -n \'%s\'", pkgid);
+ snprintf(buf, len, "pkgcmd -u -q -n %s", pkgid);
- return 0;
+ free(pkgid);
+
+ return 0;
+ }
+ return -1;
}
static int appcmd_runapp_gen_shellcmd(appcmd_info* p_info) {
return -1;
}
- appid = p_info->args[1];
+ appid = parse_arg(p_info->args[1]);
- D("args: appid=%s\n", appid);
+ if (appid != NULL) {
+ D("args: appid=%s\n", appid);
- snprintf(buf, len, "/usr/bin/pkginfo --app \'%s\' | grep component: | awk '{print $2}'"
- " | while read var; do if [ $var = watchapp ] || [ $var = widgetapp ]; then /usr/bin/app_launcher "
- "--start org.tizen.widget_viewer_sdk widget_id \'%s\'; else /usr/bin/app_launcher "
- "--start \'%s\'; fi; done", appid, appid, appid);
+ snprintf(buf, len, "/usr/bin/pkginfo --app %s | grep component: | awk '{print $2}'"
+ " | while read var; do if [ $var = watchapp ] || [ $var = widgetapp ]; then /usr/bin/app_launcher "
+ "--start org.tizen.widget_viewer_sdk widget_id %s; else /usr/bin/app_launcher "
+ "--start %s; fi; done", appid, appid, appid);
- return 0;
+ free(appid);
+
+ return 0;
+ }
+ return -1;
}
static int appcmd_rununittestapp_gen_shellcmd(appcmd_info* p_info) {
p_info->args[1] = strdup(p_appid);
p_info->args[2] = strdup(ptr);
- appid = p_info->args[1];
- usr_args = p_info->args[2];
+ appid = parse_arg(p_info->args[1]);
+ usr_args = parse_arg(p_info->args[2]);
- D("args: appid=%s, usr_args=%s\n", appid, usr_args);
+ if (appid != NULL && usr_args != NULL) {
+ D("args: appid=%s, usr_args=%s\n", appid, usr_args);
- snprintf(buf, len, "/usr/bin/app_launcher -s \'%s\' __AUL_SDK__ UNIT_TEST __LAUNCH_APP_MODE__ SYNC __DLP_UNIT_TEST_ARG__ \'%s\'", appid, usr_args);
+ snprintf(buf, len, "/usr/bin/app_launcher -s %s __AUL_SDK__ UNIT_TEST __LAUNCH_APP_MODE__ SYNC __DLP_UNIT_TEST_ARG__ \'%s\'", appid, usr_args);
- return 0;
+ free(appid);
+ free(usr_args);
+
+ return 0;
+ }
+ if (appid != NULL) {
+ free(appid);
+ }
+ if (usr_args != NULL) {
+ free(usr_args);
+ }
+ return -1;
}
static int appcmd_killapp_gen_shellcmd(appcmd_info* p_info) {
return -1;
}
- appid = p_info->args[1];
+ appid = parse_arg(p_info->args[1]);
- D("args: appid=%s\n", appid);
+ if (appid != NULL) {
+ D("args: appid=%s\n", appid);
- snprintf(buf, len, "/usr/bin/app_launcher --kill \'%s\'", appid);
+ snprintf(buf, len, "/usr/bin/app_launcher --kill %s", appid);
- return 0;
+ free(appid);
+
+ return 0;
+ }
+ return -1;
}
static int appcmd_packagelist_gen_shellcmd(appcmd_info* p_info) {
return -1;
}
- type = p_info->args[1];
+ type = parse_arg(p_info->args[1]);
- D("args: type=%s\n", type);
+ if (type != NULL) {
+ D("args: type=%s\n", type);
- snprintf(buf, len, "/usr/bin/pkgcmd -l -t \'%s\'", type);
+ snprintf(buf, len, "/usr/bin/pkgcmd -l -t %s", type);
- return 0;
+ free(type);
+
+ return 0;
+ }
+ return -1;
}
static int appcmd_debugwebapp_gen_shellcmd(appcmd_info* p_info) {
return -1;
}
- appid = p_info->args[1];
+ appid = parse_arg(p_info->args[1]);
- D("args: appid=%s\n", appid);
+ if (appid != NULL) {
+ D("args: appid=%s\n", appid);
- snprintf(buf, len, "/usr/bin/app_launcher --start \'%s\' -w", appid);
+ snprintf(buf, len, "/usr/bin/app_launcher --start %s -w", appid);
- return 0;
+ free(appid);
+
+ return 0;
+ }
+ return -1;
}
static int appcmd_debugnativeapp_gen_shellcmd(appcmd_info* p_info) {
return -1;
}
- debug_port = p_info->args[1];
- appid= p_info->args[2];
- pid_str = p_info->args[3];
- gdbserver_path = p_info->args[4]; // not used. for 3.0 platform.
+ debug_port = parse_arg(p_info->args[1]);
+ appid= parse_arg(p_info->args[2]);
+ pid_str = parse_arg(p_info->args[3]);
+ gdbserver_path = parse_arg(p_info->args[4]); // not used. for 3.0 platform.
- pid = atoi(pid_str);
- D("args: debug_port=%s, appid=%s, pid=%d, gdbserver_path=%s\n", debug_port, appid, pid, gdbserver_path);
+ if (debug_port != NULL && appid != NULL && pid_str != NULL && gdbserver_path != NULL) {
+ pid = atoi(pid_str);
+ D("args: debug_port=%s, appid=%s, pid=%d, gdbserver_path=%s\n", debug_port, appid, pid, gdbserver_path);
- if (pid == -1) {
- snprintf(buf, len, "/usr/bin/app_launcher --start \'%s\' __AUL_SDK__ DEBUG __DLP_DEBUG_ARG__ :\'%s\' __DLP_GDBSERVER_PATH__ \'%s\'", appid, debug_port, gdbserver_path);
- } else {
- /* attach mode */
- snprintf(buf, len, "/usr/bin/launch_debug \'%s\' __AUL_SDK__ ATTACH __DLP_GDBSERVER_PATH__ \'%s\' __DLP_ATTACH_ARG__ --attach,:\'%s\',%d", appid, gdbserver_path, debug_port, pid);
- }
+ if (pid == -1) {
+ snprintf(buf, len, "/usr/bin/app_launcher --start %s __AUL_SDK__ DEBUG __DLP_DEBUG_ARG__ :%s __DLP_GDBSERVER_PATH__ %s", appid, debug_port, gdbserver_path);
+ } else {
+ /* attach mode */
+ snprintf(buf, len, "/usr/bin/launch_debug %s __AUL_SDK__ ATTACH __DLP_GDBSERVER_PATH__ %s __DLP_ATTACH_ARG__ --attach,:%s,%d", appid, gdbserver_path, debug_port, pid);
+ }
- return 0;
+ free(debug_port);
+ free(appid);
+ free(pid_str);
+ free(gdbserver_path);
+
+ return 0;
+ }
+ if (debug_port != NULL) {
+ free(debug_port);
+ }
+ if (appid != NULL) {
+ free(appid);
+ }
+ if (pid_str != NULL) {
+ free(pid_str);
+ }
+ if (gdbserver_path != NULL) {
+ free(gdbserver_path);
+ }
+ return -1;
}
static int appcmd_appinfo_gen_shellcmd(appcmd_info* p_info) {
return -1;
}
- pkgid = p_info->args[1];
+ pkgid = parse_arg(p_info->args[1]);
- D("args: pkgid=%s\n", pkgid);
+ if (pkgid != NULL) {
+ D("args: pkgid=%s\n", pkgid);
- snprintf(buf, len, "/usr/bin/pkginfo --list \'%s\'", pkgid);
+ snprintf(buf, len, "/usr/bin/pkginfo --list %s", pkgid);
- return 0;
+ free(pkgid);
+
+ return 0;
+ }
+ return -1;
}
static void appcmd_receiver_debugwebapp(int fd_in, int fd_out)
return;
}
- type = p_info->args[1];
- pkgid= p_info->args[2];
+ type = parse_arg(p_info->args[1]);
+ pkgid= parse_arg(p_info->args[2]);
- D("args: type=%s, pkgid=%s\n", type, pkgid);
+ if (type != NULL && pkgid != NULL) {
+ D("args: type=%s, pkgid=%s\n", type, pkgid);
- if (get_pkg_info(pkgid, pkginfo_buf, sizeof(pkginfo_buf)) == 0) {
- D("success to get pkginfo. (%s)\n", pkginfo_buf);
- p_info->exitcode = 0;
- snprintf(result_buf, sizeof(result_buf), "\n%s:%s\n", MESSAGE_PREFIX_APPCMD_RETURN, pkginfo_buf);
- writex(p_info->fd, result_buf, strlen(result_buf));
- } else {
- D("failed to get pkginfo.\n");
+ if (get_pkg_info(pkgid, pkginfo_buf, sizeof(pkginfo_buf)) == 0) {
+ D("success to get pkginfo. (%s)\n", pkginfo_buf);
+ p_info->exitcode = 0;
+ snprintf(result_buf, sizeof(result_buf), "\n%s:%s\n", MESSAGE_PREFIX_APPCMD_RETURN, pkginfo_buf);
+ writex(p_info->fd, result_buf, strlen(result_buf));
+ } else {
+ D("failed to get pkginfo.\n");
+ }
+
+ free(type);
+ free(pkgid);
+ }
+ if (type != NULL) {
+ free(type);
+ }
+ if (pkgid != NULL) {
+ free(pkgid);
}
}
#else
return -1;
}
- pkgid = p_info->args[1];
+ pkgid = parse_arg(p_info->args[1]);
- D("args: pkgid=%s\n", pkgid);
+ if (pkgid != NULL) {
+ D("args: pkgid=%s\n", pkgid);
- snprintf(buf, len, "/usr/bin/pkginfo --pkg %s;/usr/bin/pkgcmd -C -n %s", pkgid, pkgid);
+ snprintf(buf, len, "/usr/bin/pkginfo --pkg %s;/usr/bin/pkgcmd -C -n %s", pkgid, pkgid);
- return 0;
+ free(pkgid);
+
+ return 0;
+ }
+ return -1;
}
static void appcmd_receiver_packageinfo(int fd_in, int fd_out)