static void __exit(int sig) { __fini(); exit(sig); }
int svc_clear(void) { int rc = 0; if (_init() < 0) return -1; rc = __delete_all(SVC_TBL_NAME); __fini(); return rc; }
int mida_clear(void) { int rc = 0; if (_init() < 0) return -1; rc = __delete_all(MIDA_TBL_NAME); __fini(); return rc; }
int svc_delete_with_svcname(const char *svc_name) { int rc = 0; retvm_if(svc_name == NULL, -1, "Invalid argument: data to delete is NULL\n"); if (_init() < 0) return -1; rc = __delete_with_field(SVC_TBL_NAME, SVC_F_SVCNAME, svc_name, 0); __fini(); return rc; }
int svc_delete_with_pkgname(const char *pkg_name) { int rc = 0; retvm_if(pkg_name == NULL, -1, "Invalid argument: data to delete is NULL\n"); if (_init() < 0) return -1; rc = __delete_with_field(SVC_TBL_NAME, SVC_F_PKGNAME, pkg_name, 1); __fini(); return rc; }
int mida_delete_with_mimetype(const char *mime_type) { int rc = 0; retvm_if(mime_type == NULL, -1, "Invalid argument: data to delete is NULL\n"); if (_init() < 0) return -1; rc = __delete_with_field(MIDA_TBL_NAME, MIDA_F_MIMETYPE, mime_type, 0); __fini(); return rc; }
/* HBL elf entry point */ int __entry_menu(int argc, char **argv) { int ret; InitFunctionPointers(); memoryInitialize(); __init(); fsdev_init(); ret = main(argc, argv); fsdev_exit(); __fini(); memoryRelease(); return ret; }
void _start(int argc, char **argv) { memoryInitialize(); __init(); fsdev_init(); main(argc, argv); fsdev_exit(); /* TODO: fix elf2rpl so it doesn't error with "Could not find matching symbol for relocation" then uncomment this */ #if 0 __fini(); #endif memoryRelease(); SYSRelaunchTitle(0, 0); exit(0); }
int svc_add_app(const char *svc_name, const char *pkg_name) { int rc = -1; int cnt = 0; char *_sqlbuf; retvm_if(svc_name == NULL, -1, "Service name is null\n"); retvm_if(pkg_name == NULL, -1, "Package name is null\n"); if (__doubt_sql_injection(svc_name)) return -1; if (_init() < 0) return -1; cnt = __count_with_field(SVC_TBL_NAME, SVC_F_SVCNAME, svc_name, 0); if (cnt == 0) { /* insert */ _D("Inserting (%s, %s)", pkg_name, svc_name); _sqlbuf = sqlite3_mprintf( "INSERT INTO %s (%s,%s) values (\"%s\", \"%s\");", SVC_TBL_NAME, SVC_F_PKGNAME, SVC_F_SVCNAME, pkg_name, svc_name); rc = _exec(mida_db, _sqlbuf); sqlite3_free(_sqlbuf); } else { /* update */ _D("Setting %s for %s", pkg_name, svc_name); _sqlbuf = sqlite3_mprintf( "UPDATE %s SET %s = '%s' where %s = '%s';", SVC_TBL_NAME, SVC_F_PKGNAME, pkg_name, SVC_F_SVCNAME, svc_name); rc = _exec(mida_db, _sqlbuf); sqlite3_free(_sqlbuf); } if (rc < 0) _E("fail to insert or update\n"); __fini(); return rc; }
char *svc_get_app(const char *svc_name) { char *res = NULL; if (svc_name == NULL) return NULL; if (__doubt_sql_injection(svc_name)) return NULL; if (_init() < 0) return NULL; res = __get_with_field(SVC_TBL_NAME, SVC_F_PKGNAME, SVC_F_SVCNAME, svc_name, 0); __fini(); return res; }
char *mida_get_app(const char *mime_type) { char *res = NULL; if (mime_type == NULL) return NULL; if (__doubt_sql_injection(mime_type)) return NULL; if (_init() < 0) return NULL; res = __get_with_field(MIDA_TBL_NAME, MIDA_F_PKGNAME, MIDA_F_MIMETYPE, mime_type, 0); __fini(); return res; }
int is_supported_svc(const char *svc_name) { int rc = 0; int cnt = 0; retvm_if(svc_name == NULL, 0, "Service name is null\n"); if (__doubt_sql_injection(svc_name)) return 0; if (_init() < 0) return 0; cnt = __count_with_field(SYSSVC_TBL_NAME, SYSSVC_F_SVCNAME, svc_name, 0); if (cnt > 0) rc = 1; else _D("%s is not supported.", svc_name); __fini(); return rc; }