jboolean Java_koneu_rootapp_MainActivity_sudo(JNIEnv *env, jobject obj, jstring xmd) { char const * const cmd = (*env)->GetStringUTFChars(env, xmd, 0), *rmd; jboolean ret = JNI_TRUE; if(process.pid) { for(rmd = cmd; *rmd; ++rmd) { if(write(process.infd, rmd, 1) != 1) ret = JNI_FALSE; } if(write(process.infd, "\n", 1) != 1) ret = JNI_FALSE; } else if(sustem(cmd)) ret = JNI_FALSE; (*env)->ReleaseStringUTFChars(env, xmd, cmd); return ret; }
//********************************************************************************************** //***********************Преобразование в класс PolynomGF3************************************* PolynomGF3 Converter::ToPolynomGF3(const Integer &integer) { Integer sustem("3"); Integer num(integer); Integer div(integer); unsigned int count; std::string tern = ""; while(div > 2) { tern.append((num%sustem).ToString()); div = num/sustem; num = div; } tern.append(div.ToString()); std::string overtern(tern.rbegin(),tern.rend()); return PolynomGF3(overtern); }