9 #include "net_sourceforge_phpdt_internal_debug_core_Environment.h"
11 JNIEXPORT jstring JNICALL Java_net_sourceforge_phpdt_internal_debug_core_Environment_getenv
12 (JNIEnv *env, jclass c, jstring jname)
14 // Retrieve the argument
16 const char *str = (*env)->GetStringUTFChars(env, jname, (jboolean *)NULL);
18 strncpy(cname, str, BUFFER);
19 (*env)->ReleaseStringUTFChars(env, jname, str);
23 int result = GetEnvironmentVariable(cname, cvalue, BUFFER);
27 return (*env)->NewStringUTF(env, cvalue);
29 char *cvalue = getenv(cname);
33 return (*env)->NewStringUTF(env, cvalue);
37 JNIEXPORT jstring JNICALL Java_net_sourceforge_phpdt_internal_debug_core_Environment_setenv
38 (JNIEnv *env, jclass c, jstring jname, jstring jvalue)
40 // Retrieve the arguments
41 char cname[BUFFER], cvalue[BUFFER];
42 const char *str = (*env)->GetStringUTFChars(env, jname, (jboolean *)NULL);
44 strncpy(cname, str, BUFFER);
45 (*env)->ReleaseStringUTFChars(env, jname, str);
46 str = (*env)->GetStringUTFChars(env, jvalue, (jboolean *)NULL);
47 strncpy(cvalue, str, BUFFER);
48 (*env)->ReleaseStringUTFChars(env, jvalue, str);
51 SetEnvironmentVariable(cname, cvalue);
54 strncpy(envbuf, cname, BUFFER);
55 strncat(envbuf, "=", BUFFER-strlen(envbuf));
56 strncat(envbuf, cvalue, BUFFER-strlen(envbuf));
65 * Valentin Valchev (Bulgaria, www.prosyst.com)
66 * This is the standart implementation of Java 2 OnLoad and OnUnload native
67 * library calls. This template defines them empty functions
69 JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
71 return JNI_VERSION_1_2;
73 JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved)