char* get_opt(const char* name,int env) { char* ret=NULL; if(env)ret=_getenv(name); if(!ret) { ret=_get_opt(local_opt,name); if(!ret) ret=_get_opt(global_opt,name); } return ret; }
int main(void) { char name[10] = "LANG"; char *val = malloc(30); if(_getenv(name, val, 30) == 1) { printf("%s\n", val); } else { printf("%s\n", "error"); } return 0; }
JNIEnv * jni_helper_env() { return _getenv(); }
void jni_helper_set_javavm(JavaVM *vm) { VM = vm; pthread_key_create(&KEY, _detach_current_thread); } int jni_helper_getstaticmethodinfo(const char *class, const char *method, const char *param, struct jni_methodinfo *info) { assert(class); assert(method); assert(param); JNIEnv *env = _getenv(); if (env == NULL) return 1; jclass jc = (*env)->FindClass(env, class); if (!jc) { pf_log("failed to find class %s", class); (*env)->ExceptionClear(env); return 1; } jmethodID jmid = (*env)->GetStaticMethodID(env, jc, method, param); if (!jmid) { pf_log("failed to find static method %s", method); (*env)->ExceptionClear(env); return 1; }