Example #1
0
}
/* stop rtk server -----------------------------------------------------------*/
static void stopsvr(vt_t *vt)
{
    char s[3][MAXRCVCMD]={"","",""},*cmds[]={NULL,NULL,NULL};
    int i,ret;
    
    trace(3,"stopsvr:\n");
    
    if (!svr.state) return;
    
    /* read stop commads from command files */
    for (i=0;i<3;i++) {
        if (!*rcvcmds[i]) continue;
        if (!readcmd(rcvcmds[i],s[i],1)) {
            printvt(vt,"no command file: %s\n",rcvcmds[i]);
        }
        else cmds[i]=s[i];
    }
    /* stop rtk server */
    rtksvrstop(&svr,cmds);
    
    /* execute stop command */
    if (*stopcmd&&(ret=system(stopcmd))) {
        trace(2,"command exec error: %s (%d)\n",stopcmd,ret);
        printvt(vt,"command exec error: %s (%d)\n",stopcmd,ret);
    }
Example #2
0
static void RtkServer__destroy(JNIEnv* env, jobject thiz)
{
   struct native_ctx_t *nctx;
   char *cmds[3]={0,};

   LOGV("RtkServer__destroy()");

   nctx = (struct native_ctx_t *)(uintptr_t)(*env)->GetLongField(env, thiz, m_object_field);
   if (nctx == NULL) {
      LOGV("nctx is null");
      return;
   }
   rtksvrstop(&nctx->rtksvr,cmds);
   rtksvrfree(&nctx->rtksvr);

   free(nctx);
   (*env)->SetLongField(env, thiz, m_object_field, 0L);
}
Example #3
0
static void RtkServer__stop(JNIEnv* env, jclass thiz, jobjectArray j_cmds)
{
   unsigned i;
   struct native_ctx_t *nctx;
   const char *cmds[3]={NULL, NULL, NULL};
   jstring cmds_jstring[3]={NULL, NULL, NULL};

   LOGV("RtkServer__stop()");

   nctx = (struct native_ctx_t *)(uintptr_t)(*env)->GetLongField(env, thiz, m_object_field);
   if (nctx == NULL) {
      LOGV("nctx is null");
      return;
   }

   for (i=0; i<sizeof(cmds)/sizeof(cmds[0]); ++i) {
      cmds_jstring[i] = (*env)->GetObjectArrayElement(env, j_cmds, i);
      if ((*env)->ExceptionOccurred(env))
	 goto rtksvrstop_close;
      if (cmds_jstring[i] != NULL) {
	 cmds[i] = (*env)->GetStringUTFChars(env, cmds_jstring[i], NULL);
	 if (cmds[i] == NULL)
	    goto rtksvrstop_close;
      }
   }

rtksvrstop_close:

   rtksvrstop(&nctx->rtksvr,(char **)cmds);

   traceclose();
   rtkclosestat();

   for (i=0; i<sizeof(cmds)/sizeof(cmds[0]); ++i) {
      if (cmds[i] != NULL)
	 (*env)->ReleaseStringUTFChars(env, cmds_jstring[i], cmds[i]);
   }

}