/* Collection of code snippets by Arne Vajhøj */
/* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) */
#include <string.h>

#include <jni.h>

#include "test_TestJNI.h"

static char retbuf[1000];

JNIEXPORT jstring JNICALL Java_test_TestJNI_dup(JNIEnv *cntx, jobject me, jstring s)
{
   const char *s2 = (*cntx)->GetStringUTFChars(cntx,s,0);
   strcpy(retbuf,s2);
   strcat(retbuf,s2),   
   (*cntx)->ReleaseStringUTFChars(cntx,s,s2);
   return (*cntx)->NewStringUTF(cntx,retbuf);
}
