コード例 #1
0
ファイル: opt.c プロジェクト: neuroradiology/roswell
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;
}
コード例 #2
0
ファイル: 12_4_getenv.c プロジェクト: yangwii/wii_linux_cpp_c
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;
}
コード例 #3
0
ファイル: jni_helper.c プロジェクト: lvshaco/ejoy2d
JNIEnv *
jni_helper_env() {
    return _getenv();
}
コード例 #4
0
ファイル: jni_helper.c プロジェクト: lvshaco/ejoy2d
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;
    }