/*
 * Class:     fr_umlv_unitex_jni_UnitexJni
 * Method:    setStdErrTrashMode
 * Signature: (Z)Z
 */
JNIEXPORT jboolean JNICALL Java_fr_umlv_unitex_jni_UnitexJni_setStdErrTrashMode
  (JNIEnv *, jclass, jboolean trashOutput)
{
	enum stdwrite_kind swk=stdwrite_kind_err;
	return (SetStdWriteCB(swk, trashOutput ? 1 : 0, NULL, NULL) == 1) ? JNI_TRUE : JNI_FALSE;
}
예제 #2
0
/**
 * This is the customized diff program designed to compare grf files.
 */
int main_SelectOutput(int argc,char* const argv[]) {
if (argc==1) {
	usage();
	return SUCCESS_RETURN_CODE;
}

VersatileEncodingConfig vec=VEC_DEFAULT;
int val,index=-1;
bool only_verify_arguments = false;
UnitexGetOpt options;
while (EOF!=(val=options.parse_long(argc,argv,optstring_SelectOutput,lopts_SelectOutput,&index))) {
   switch(val) {
   case 'V': only_verify_arguments = true;
             break;    
   case 'h': usage(); 
             return SUCCESS_RETURN_CODE;
   case 'e':
   case 'o':
	   {
		   enum stdwrite_kind swk = (val == 'o') ? stdwrite_kind_out : stdwrite_kind_err;
		   if (strcmp(options.vars()->optarg,"on") == 0)
		   {
		       SetStdWriteCB(swk,0,NULL,NULL);
		   }
		   else
		   if (strcmp(options.vars()->optarg,"off") == 0)
		   {
		       SetStdWriteCB(swk,1,NULL,NULL);
		   }
		   else 
		   {
		       error("Invalid option --%s, must be 'on' or 'off'\n",options.vars()->optarg);
		       return USAGE_ERROR_CODE;
		   }
		   break;
	   }
   
   case 'k': if (options.vars()->optarg[0]=='\0') {
                error("Empty input_encoding argument\n");
                return USAGE_ERROR_CODE;
             }
             decode_reading_encoding_parameter(&(vec.mask_encoding_compatibility_input),options.vars()->optarg);
             break;
   case 'q': if (options.vars()->optarg[0]=='\0') {
                error("Empty output_encoding argument\n");
                return USAGE_ERROR_CODE;
             }
             decode_writing_encoding_parameter(&(vec.encoding_output),&(vec.bom_output),options.vars()->optarg);
             break;
   case ':': index==-1 ? error("Missing argument for option -%c\n",options.vars()->optopt) :
                         error("Missing argument for option --%s\n",lopts_SelectOutput[index].name);
             return USAGE_ERROR_CODE;            
   case '?': index==-1 ? error("Invalid option -%c\n",options.vars()->optopt) :
                         error("Invalid option --%s\n",options.vars()->optarg);
             return USAGE_ERROR_CODE;
   }
   index=-1;
}

  // keep this for further modifications
  if (only_verify_arguments) {
    // freeing all allocated memory
    return SUCCESS_RETURN_CODE;
  }


	return SUCCESS_RETURN_CODE;
}