int callSuperIsoSLHA(void) { char* command; int err; char * path=getenv("superIso"); if(!path) { printf("Define environment variable 'superIso' to specify path to the package\n"); return -1;} command=malloc(strlen(path) +100); sprintf(command,"%s/slha.x",path); if(access(command,X_OK)) { int sysTimeLimTmp=sysTimeLim; sysTimeLim=0; System("cd %s; make; make slha",path); sysTimeLim=sysTimeLimTmp; } if(access(command,X_OK)) { printf("Can not compile superIso\n"); free(command); return -2; } slhaWrite("slhaForSuperIso"); System("%s slhaForSuperIso >/dev/null ",command); err=slhaRead("output.flha",1); unlink("slhaForSuperIso"); if(delFiles) unlink("output.flha"); free(command); return err; }
int sbcl_bin_install(struct install_options* param) { char* version=param->version; char* arch=param->arch; char* home=configdir(); char *str,*str2,*str3,*str4; char* version_num= q(version); int ret; str2=cat(home,"src\\sbcl-",version,"-",arch,"-windows\\PFiles\\Steel Bank Common Lisp\\",version_num,"\\sbcl.exe",NULL); str3=cat(home,"impls\\",arch,"\\windows\\sbcl-bin\\",version,"\\bin\\sbcl.exe",NULL); str=cat("cmd /c \"echo f|xcopy ^\"",str2,"^\" ^\"",str3,"^\" > NUL","\"",NULL); s(str2),s(str3); ret=System(str);s(str); if(ret) return 0; str2=cat(home,"src\\sbcl-",version,"-",arch,"-windows\\PFiles\\Steel Bank Common Lisp\\",version_num,"\\sbcl.core",NULL); str3=cat(home,"impls\\",arch,"\\windows\\sbcl-bin\\",version,"\\lib\\sbcl\\sbcl.core",NULL); str=cat("cmd /c \"echo f|xcopy ^\"",str2,"^\" ^\"",str3,"^\" > NUL","\"",NULL); ret=System(str);s(str); if(ret) return 0; str=cat("echo d|xcopy ^\"", home,"src\\sbcl-",version,"-",arch,"-windows\\PFiles\\Steel Bank Common Lisp\\",version_num,"\\contrib^\" ^\"", home,"impls\\",arch,"\\windows\\sbcl-bin\\",version,"\\lib\\sbcl\\contrib^\" >NUL",NULL); str2=cat(home,"src\\sbcl-",version,"-",arch,"-windows\\PFiles\\Steel Bank Common Lisp\\",version_num,"\\contrib",NULL); str3=cat(home,"impls\\",arch,"\\windows\\sbcl-bin\\",version,"\\lib\\sbcl\\contrib",NULL); str=cat("cmd /c \"echo d|xcopy ^\"",str2,"^\" ^\"",str3,"^\""," > NUL","\"",NULL); ret=System(str); s(str),s(home); if(ret) return 0; return 1; }
int CmdWorker(q_msg *m) { char *c = &(m->cmd[0]); char s[MAX_MSGLEN]; int rc; NETDEBUG(MEXECD, NETLOG_DEBUG2, ("To: %x From: %x Flag: %x Cmd: %s\n", m->self_id, m->peer_id, m->flag, c)); if (ISSET_BIT(m, OUT_BIT)) { rc = System(c, s, MAX_CMDLEN); } else { rc = System(c, NULL, 0); s[0]='\0'; } NETDEBUG(MEXECD, NETLOG_DEBUG2, ("Cmd returned %d\n", rc)); if (ISSET_BIT(m, REQ_BIT)) { strncpy(c, s, MAX_CMDLEN); SendResp(m, rc); } free(m); return(rc); }
int main() { printf("client: %d\n", getpid()); int stop = 0; while (stop) { fprintf(stderr, "."); sleep(1); } Handle<es::Stream> output = System()->getOutput(); output->write("hello!\n", 7); Handle<es::Context> nameSpace = System()->getRoot(); Handle<es::Iterator> iterator = nameSpace->list(""); while (iterator->hasNext()) { char name[128]; Handle<es::Binding> binding = iterator->next(); if (binding->getName(name, sizeof name)) { output->write(name, strlen(name)); output->write("\n", 1); } } return 0; }
rt_public EIF_BOOLEAN eiso(EIF_REFERENCE target, EIF_REFERENCE source) { /* Compare `source ' and `target' in term of their structure: * 1/ direct instances should be equal. * 2/ references should be of the same dynamic type. * It assumes that dynamic types of `source' and `target' are the * same. * Return a boolean. */ if (target == source) return EIF_TRUE; #ifdef DEBUG dprintf(2)("eiso: source = 0x%lx [%s] target = 0x%lx [%s]\n", source, System(Dtype(source)).cn_generator, target, System(Dtype(target)).cn_generator); #endif /* Check if the dynamic types are the same */ if (Dftype(source) != Dftype(target)) { return EIF_FALSE; } else { /* Check iomorphism */ return e_field_iso(target, source); } }
int main(int argc, char* argv[]) { esReport("This is the upcall test server process.\n"); // System()->trace(true); Handle<es::Context> nameSpace = System()->getRoot(); Handle<es::CurrentThread> currentThread = System()->currentThread(); // create server TestServer* server = new TestServer; // register this console. Handle<es::Context> device = nameSpace->lookup("device"); ASSERT(device); es::Binding* ret = device->bind("testServer", static_cast<es::Stream*>(server)); ASSERT(ret); ret->release(); while (1 < server->ref) { currentThread->sleep(10000000LL); } server->release(); System()->trace(false); }
void test27c() { /* Test error response. */ struct stat st; int fd, i; subtest = 3; System("echo Hi > foo"); /* Make a file called foo. */ /* Check if a un searchable dir is handled ok. */ Chdir(".."); /* cd .. */ System("chmod 677 DIR_27"); /* no search permission */ if (stat("DIR_27/nono", &st) != -1) e(1); if (superuser) { if (errno != ENOENT) e(2); /* su has access */ } if (!superuser) { if (errno != EACCES) e(3); /* we don't ;-) */ } System("chmod 777 DIR_27"); Chdir("DIR_27"); /* back to test dir */ /* Check on ToLongName etc. */ #ifdef _POSIX_NO_TRUNC # if _POSIX_NO_TRUNC - 0 != -1 if (stat(ToLongName, &st) != -1) e(4); /* name is too long */ if (errno != ENAMETOOLONG) e(5); # endif #else # include "error, this case requires dynamic checks and is not handled" #endif if (stat(ToLongPath, &st) != -1) e(6); /* path is too long */ if (errno != ENAMETOOLONG) e(7); /* Test some common errors. */ if (stat("nono", &st) != -1) e(8); /* nono nonexistent */ if (errno != ENOENT) e(9); if (stat("", &st) != -1) e(10); /* try empty */ if (errno != ENOENT) e(11); if (stat("foo/bar", &st) != -1) e(12); /* foo is a file */ if (errno != ENOTDIR) e(13); /* Test fstat on file descriptors that are not open. */ for (i = 3; i < 6; i++) { if (fstat(i, &st) != -1) e(14); if (errno != EBADF) e(15); } /* Test if a just closed file is `fstat()'-able. */ if ((fd = open("foo", O_RDONLY)) != 3) e(16); /* open foo */ if (fstat(fd, &st) != 0) e(17); /* get stat */ if (close(fd) != 0) e(18); /* close it */ if (fstat(fd, &st) != -1) e(19); /* get stat */ if (errno != EBADF) e(20); System("rm -rf ../DIR_27/*"); }
void test30c() { int fd, does_truncate; subtest = 3; System("rm -rf ../DIR_30/*"); if (!superuser) { /* Test if creat is not usable to open files with the wrong mode */ System("> nono; chmod 177 nono"); fd = creat("nono", 0777); if (fd != -1) e(1); if (errno != EACCES) e(2); } if (mkdir("bar", 0777) != 0) e(3); /* make bar */ /* Check if no access on part of path generates the correct error. */ System("chmod 577 bar"); /* r-xrwxrwx */ if (!superuser) { /* Normal users can't creat without write permision. */ if (creat("bar/nono", 0666) != -1) e(4); if (errno != EACCES) e(5); if (creat("bar/../nono", 0666) != -1) e(6); if (errno != EACCES) e(7); } if (superuser) { /* Super user can still creat stuff. */ if ((fd = creat("bar/nono", 0666)) != 3) e(8); if (close(fd) != 0) e(9); if (unlink("bar/nono") != 0) e(10); } /* Clean up bar. */ System("rm -rf bar"); /* Test ToLongName and ToLongPath */ does_truncate = does_fs_truncate(); fd = creat(ToLongName, 0777); if (does_truncate) { if (fd == -1) e(11); if (close(fd) != 0) e(12); } else { if (fd != -1) e(13); if (errno != ENAMETOOLONG) e(14); (void) close(fd); /* Just in case. */ } ToLongPath[PATH_MAX - 2] = '/'; ToLongPath[PATH_MAX - 1] = 'a'; if ((fd = creat(ToLongPath, 0777)) != -1) e(15); if (errno != ENAMETOOLONG) e(16); if (close(fd) != -1) e(17); ToLongPath[PATH_MAX - 1] = '/'; }
int main() { int status; if ((status = System("date")) < 0) err_sys("System error"); pr_exit(status); if ((status = System("nosuchcommond")) < 0) err_sys("System error"); pr_exit(status); if ((status = System("who; exit 44")) < 0) err_sys("System error"); pr_exit(status); }
void init() { Handle<es::Context> root = System()->getRoot(); framebuffer = root->lookup("device/framebuffer"); long long size; size = framebuffer->getSize(); framebufferPtr = (u8*) System()->map(0, size, es::CurrentProcess::PROT_READ | es::CurrentProcess::PROT_WRITE, es::CurrentProcess::MAP_SHARED, framebuffer, 0); }
void CLogArchiver::DoArchive(bool bDispErr) { uint32 nOldArchId = m_nArchId; ++m_nArchId; if(m_nArchId > m_nArchNo) m_nArchId = 1; char sLogDir[FOCP_MAX_PATH]; CFormatString oCmd; CString::StringCopy(sLogDir, m_oLogDir.GetStr()); CDiskFileSystem::GetInstance()->GetOsPathName(sLogDir); #ifdef WINDOWS oCmd.Print("tar -czf %s\\%s.%03d.log.tar.gz %s\\%s.*.log 1>1.txt 2>2.txt", m_oArchDir.GetStr(), m_oLogName.GetStr(), m_nArchId, sLogDir, m_oLogName.GetStr()); #else oCmd.Print("tar -czf %s/%s.%03d.log.tar.gz %s/%s.*.log 1>1.txt 2>2.txt", m_oArchDir.GetStr(), m_oLogName.GetStr(), m_nArchId, sLogDir, m_oLogName.GetStr()); #endif int32 nRet = System(oCmd.GetStr()); char sErrFile[FOCP_MAX_PATH]; CString::StringCopy(sErrFile, "disk://"); CDiskFileSystem::GetInstance()->GetFullPath("2.txt", sErrFile+7); CFile oFile(sErrFile, "r"); bool bHaveError = false; CString oError; while(true) { int32 nLen = oFile.Read(sErrFile, FOCP_MAX_PATH); if(nLen <= 0) break; bHaveError = true; oError.Append(sErrFile, nLen); } oFile.Redirect(NULL); if(bHaveError) { m_nArchId = nOldArchId; if(bDispErr) FocpError(("%s", oError.GetStr())); } else if(nRet) { m_nArchId = nOldArchId; if(bDispErr) FocpError(("system('%s') failure", oCmd.GetStr())); } else { oCmd.Clear(); oCmd.Print("rm -rf %s\\%s.*.log 1>1.txt 2>2.txt", sLogDir, m_oLogName.GetStr()); System(oCmd.GetStr()); } System("rm -rf 1.txt"); System("rm -rf 2.txt"); }
int XeresCalibMain_main(int argc,char** argv) { MMD_InitArgcArgv(argc,argv); std::string aSeq,aDir,OutCal="Calib"; int aSz=1500; ElInitArgMain ( argc,argv, LArgMain() // << EAMC(aSeq, "Sequence") << EAMC(aDir, "Directory"), LArgMain() << EAM(aSeq,"Seq",true,"Folder of data, Def=./") << EAM(aSz,"Sz",true,"Sz of TieP, Def=1500") << EAM(OutCal,"Out",true,"") ); // std::string aCdDir = "cd " + aDir + "/"; // System(aCdDir); if (!EAMIsInit(&aSeq) ) aSeq = aDir; cElemAppliSetFile anEASF(aDir+"/.*jpg"); const std::vector<std::string> * aVS = anEASF.SetIm(); int aNbIm = aVS->size(); for (int aK=0 ; aK<aNbIm ; aK++) { const std::string & aName = (*aVS)[aK]; ELISE_fp::MvFile(aDir+"/"+aName,aDir+"/"+aSeq+"_Calib" +ToString(aK) + ".jpg"); std::cout << "NAME = " << aName << "\n"; } std::string aStrMMD= "MicMac-LocalChantierDescripteur.xml"; ELISE_fp::CpFile(aStrMMD,aDir+"/"+aStrMMD); std::string aComTiep = MM3dBinFile_quotes("Tapioca") + " All " + aDir + "/.*jpg " + ToString(aSz); System(aComTiep); std::string aComOri = MM3dBinFile_quotes("Tapas ") + " FraserBasic " + aDir + "/.*jpg " + " Out=" + OutCal + " RankInitPP=0 RankInitF=1 RefineAll=0"; System(aComOri); return EXIT_SUCCESS; }
void* start(void* param) { Check check; esReport("start(): %x %x %x\n", testA, testB, &testA); testA = 4; testB = 5; esReport("start(): %x %x %x\n", testA, testB, &testA); pthread_key_t key; pthread_key_create(&key, dtor); pthread_setspecific(key, (void*) 0x1234); esReport("m->lock();\n"); m->lock(); esReport("m->wait();\n"); m->wait(); esReport("m->unlock();\n"); m->unlock(); #if 1 esReport("Let's unwind.\n"); es::CurrentThread* current(System()->currentThread()); current->exit(0); esPanic(__FILE__, __LINE__, "Ooooops\n"); #endif return 0; // lint }
int sbcl_bin_install(struct install_options* param) { int ret; char* home=configdir(); char* impl=param->impl; char* version=param->version; char* impl_path= cat(home,impldir(param->arch,param->os,impl,version),NULL); char* src=param->expand_path; char* sbcl_home=cat(impl_path,"/lib/sbcl",NULL); char* install_root=q(impl_path); char* log_path=cat(home,"impls/log/",impl,"-",version,"/install.log",NULL); cond_printf(0,"Building %s/%s...",impl,version); ensure_directories_exist(impl_path); ensure_directories_exist(log_path); change_directory(src); setenv("SBCL_HOME",sbcl_home,1); setenv("INSTALL_ROOT",install_root,1); ret=System("(cat find-gnumake.sh; echo find_gnumake)|sh"); if(ret!=0) { fprintf(stderr,"'make' command not available.\n"); return 0; } ret=1; if(system_redirect("sh install.sh",log_path)==-1) ret=0; s(home),s(impl_path),s(sbcl_home),s(install_root),s(log_path); printf(" Done.\n"); return ret; }
bool launchMake( const string &i_makefile, const string &i_rule, unsigned int i_nbJobs, const string &i_options, bool i_stopCurrentProgramOnFail ) { #ifdef __TRACE_SYSTEM__ static int iMakefile = 0; string makefileCopyName; // look for a filename that is not already used do{ if ( iMakefile>999 ) cerr << "WARNING: there is a lot of makefile copies already" << endl; stringstream ss; ss << "Makefile" << setw(3) << setfill('0') << iMakefile++; makefileCopyName = ss.str(); } while ( ELISE_fp::exist_file( makefileCopyName ) ); cout << "###copying [" << i_makefile << "] to [" << makefileCopyName << "]" << endl; ELISE_fp::copy_file( i_makefile, makefileCopyName, true ); i_nbJobs = __TRACE_SYSTEM__; // no multithreading in trace_system mode #endif string nbJobsStr( "-j" ); if ( i_nbJobs!=0 ) { stringstream ss; ss << i_nbJobs; nbJobsStr.append( ss.str() ); } std::string aCom = string("\"")+(g_externalToolHandler.get( "make" ).callName())+"\" " + i_rule + " -f \"" + i_makefile + "\" " + nbJobsStr + " " + i_options; return ( System(aCom,!i_stopCurrentProgramOnFail)==EXIT_SUCCESS ); }
void cAppli_MPI2Mnt::ExeCom(const std::string & aCom) { if (mDebug) std::cout << aCom << "\n\n"; else System(aCom); }
static int SystemCall(int mode) { char buff[2000]; int err; FILE*f; if(!access(FOUT,R_OK)) unlink(FOUT); sprintf(buff,"%s/SPheno",SPHENO); if(access( buff,X_OK)) { printf("Executable \n %s\n is not found. Program stops.\n",buff); exit(13); } f=fopen("Control.in","w"); fprintf(f,"0 | ErrorLevel\n" ".false. ! Calculation of branching ratios\n" ".false. ! Calculation of cross sections\n"); fclose(f); err=System(buff); if(err>0) err=slhaRead(FOUT,0); else cleanSLHAdata(); if(delFiles) { unlink(FIN);unlink(FOUT); unlink("Control.in");unlink("Messages.out");unlink("SPheno.out"); } return err; }
int main(int argc, char* argv[]) { esReport("This is the Event manager client process.\n"); // System()->trace(true); Handle<es::CurrentThread> currentThread = System()->currentThread(); Handle<es::Context> nameSpace = System()->getRoot(); Handle<es::EventQueue> eventQueue = 0; while (!eventQueue) { eventQueue = nameSpace->lookup("device/event"); currentThread->sleep(10000000 / 60); } esReport("start client loop.\n"); unsigned int point; int x0; int y0; int x; int y; point = eventQueue->getMousePoint(); x0 = point >> 16; y0 = point & 0xffff; for (;;) { if (int stroke = eventQueue->getKeystroke()) { esReport("0x%x\n", stroke); } point = eventQueue->getMousePoint(); x = point >> 16; y = point & 0xffff; if (x != x0 || y != y0) { x0 = x; y0 = y; esReport("(%3d, %3d)\n", x0, y0); } currentThread->sleep(10000000 / 60); } // System()->trace(false); }
rt_public long ei_offset_of_type(long i, EIF_ENCODED_TYPE enc_ftype) /* Returns the memory address of the i-th field of objects of type `enc_ftype'. */ { EIF_TYPE_INDEX dtype = To_dtype(eif_decoded_type(enc_ftype).id); uint32 offset; offset = wattr(System(dtype).cn_attr[i - 1], dtype); return offset; }
rt_public void * ei_oref(long i, EIF_REFERENCE object) /* Returns the memory address of the i-th field of `object'. */ { EIF_TYPE_INDEX dtype = Dtype(object); uint32 offset; offset = wattr(System(dtype).cn_attr[i], dtype); return object + offset; }
int GCPCtrl_main(int argc,char ** argv) { // MemoArg(argc,argv); MMD_InitArgcArgv(argc,argv); std::string aDir,aPat,aFullDir; std::string AeroIn; std::string DicoPts; std::string MesureIm; bool CPI = false; bool ShowUnused = true; ElInitArgMain ( argc,argv, LArgMain() << EAMC(aFullDir,"Full name (Dir+Pat)", eSAM_IsPatFile) << EAMC(AeroIn,"Orientation in", eSAM_IsExistDirOri) << EAMC(DicoPts,"Ground Control Points File", eSAM_IsExistFile) << EAMC(MesureIm,"Image Measurements File", eSAM_IsExistFile), LArgMain() << EAM(CPI,"CPI",true,"when Calib Per Image has to be used", eSAM_IsBool) << EAM(ShowUnused,"ShowU",true,"Show unused point (def=true)", eSAM_IsBool) ); if (!MMVisualMode) { #if (ELISE_windows) replace( aFullDir.begin(), aFullDir.end(), '\\', '/' ); #endif SplitDirAndFile(aDir,aPat,aFullDir); StdCorrecNameOrient(AeroIn,aDir); std::string aCom = MM3dBinFile_quotes( "Apero" ) + ToStrBlkCorr( MMDir()+"include/XML_MicMac/Apero-GCP-Control.xml" )+" " + std::string(" DirectoryChantier=") +aDir + std::string(" ") + std::string(" +PatternAllIm=") + QUOTE(aPat) + std::string(" ") + std::string(" +AeroIn=") + AeroIn + std::string(" +DicoApp=") + DicoPts + std::string(" +SaisieIm=") + MesureIm ; if (EAMIsInit(&ShowUnused)) aCom = aCom + " +ShowUnused=" + ToString(ShowUnused); if (CPI) aCom += " +CPI=true "; std::cout << "Com = " << aCom << "\n"; int aRes = System(aCom.c_str(),false,true,true); return aRes; } else return EXIT_SUCCESS; }
ObjectValue* constructSystemObject(void* system) { for (es::InterfaceData* data = es::interfaceData; data->iid; ++data) { // Construct Default Interface Object Reflect::Interface interface = es::getInterface(data->iid()); PRINTF("%s\n", interface.getName().c_str()); ObjectValue* object = new ObjectValue; object->setCode(new InterfaceConstructor(object, interface.getQualifiedName())); object->setPrototype(getGlobal()->get("InterfaceStore")->getPrototype()); getGlobal()->put(interface.getName(), object); } System()->addRef(); ObjectValue* object = new InterfacePointerValue(System()); object->setPrototype(getGlobal()->get("CurrentProcess")->get("prototype")); return object; }
int system1_(char *command, int len) { char c_name[200]; int res; fName2c(command,c_name,len); res=System(c_name); ferror_.ferror=FError; return res; }
int splitDictFile(int iPerSize) { char pStrCmd[MAX_NAME]; //按10M左右大小split,并且最多split10个文件。词表名:./g_pConf->pDictPath/g_pArgs->pDictName sprintf(pStrCmd, "split -C %d -d -a 1 %s%s dict_", iPerSize, g_pConf->pDictPath, g_pArgs->pDictName); if (System(pStrCmd) != 0) { ul_writelog(UL_LOG_FATAL, "splitDictFile error!"); return -1; } // split后,将生成的词表文件mv到对应文件夹中 ./dict/timestamp sprintf(pStrCmd, "mv dict_* %s%s", g_pConf->pDictPath, g_pArgs->pStrTimestamp); if (System(pStrCmd) != 0) { return -1; } // TODO:是否同时将最初的词表文件删除? return 0; }
int publish_host_table(void) { List list = hcp->hrecs; host_rec *item, *hitem; char cmd[RS_LINELEN]; int len, flag; int rval; NETDEBUG(MRSD, NETLOG_DEBUG2, ("publish_host_table called - printflag = %d\n", hcp->printflag)); if (!(hcp->printflag)) return(0); snprintf(cmd, RS_LINELEN, "%s rsd clear", RS_CLI_CMD_STR); // rval = ExecuteCliCommand(cmd); // hcp->printflag = rval; rval = System(cmd); hcp->printflag = rval; NETDEBUG(MRSD, NETLOG_DEBUG2, ("executed - %s, rval =%d\n", cmd, rval)); for (item = listGetFirstItem(list), hitem = item; item; \ item = listGetNextItem(list, item)) { flag = (memcmp(&(hitem->primary), &(item->host), sizeof(IPADDRESS))==0); len = 0; //len += snprintf(cmd, RS_LINELEN, "%s rsd add ", RS_CLI_CMD_STR); //len += snprintf(cmd, RS_LINELEN, "%d", ntohs(item->port)); len += snprintf(cmd+len, RS_LINELEN-len, "%s rsd add ", RS_CLI_CMD_STR); len += snprintf(cmd+len, RS_LINELEN-len, "%d", (atoi(rs_port))); len += snprintf(cmd+len, RS_LINELEN-len, " "); FormatIpAddress(ntohl(item->host), cmd+len); strcat(cmd+len, flag?" master":" slave"); // rval = ExecuteCliCommand(cmd); // hcp->printflag = rval; rval = System(cmd); hcp->printflag = rval; NETDEBUG(MRSD, NETLOG_DEBUG2, ("executed - %s, rval = %d\n", cmd, rval)); } /* We should check the status of all the system() and return an appropriate status */ return(0); }
int main(int argc, char* argv[]) { esReport("main(%d, %p)\n", argc, argv); while (0 < argc--) { esReport("%s\n", *argv++); } esReport("%x %x %x\n", testA, testB, &testA); System()->trace(true); m = System()->createMonitor(); es::Thread* thread = System()->createThread((void*) start, 0); thread->start(); es::CurrentThread* current(System()->currentThread()); current->sleep(30000000); // System()->exit(0); esReport("m->notify();\n"); m->notify(); current->sleep(30000000); void* rval = thread->join(); thread->release(); esReport("main(): %x %x %x\n", testA, testB, &testA); #if 1 current = reinterpret_cast<es::CurrentThread*>(current->queryInterface(Object::iid())); try { current->sleep(30000000); // Should raise an exception. } catch (Exception& error) { esReport("catch error: %d\n", error.getResult()); } #endif esReport("hello, world.\n"); }
System System::find( const QString &name ) { QSqlDatabase db = QSqlDatabase::database("CurrEmpire"); if ( !db.isOpen() ) return System(); QSqlQuery query( db ); query.prepare("SELECT * FROM systems WHERE sysname = :sname"); query.bindValue(":sname", name); query.exec(); if( !query.next() ) return System(); // not found query.prepare("SELECT * FROM systemscans WHERE sysname = :sname"); query.bindValue(":sname", name); query.exec(); System sys; sys.m_name = name; if( !query.next() ) return sys; // int idxName = query.record().indexOf( "sysname" ); int idxType= query.record().indexOf( "startype" ); int idxSize = query.record().indexOf( "starsize" ); // QString name = query.value( idxName ).toString(); QString type = query.value( idxType ).toString(); QString size = query.value( idxSize ).toString(); sys.m_starSize = size; sys.m_starType = type; query.finish(); // Get Orbits sys.m_orbits = Planet::getPlanets( name ); sys.m_warppoints = WarpPoint::getWPs( name ); return sys; }
void touch(char* path) { int ret; cond_printf(1,"%s\n",path); #ifndef HAVE_WINDOWS_H char* cmd=s_cat2(q("touch "),q(path)); ret=System(cmd); s(cmd); #else #endif }
int system2_(char *format, char*path, int len1,int len2) { char c_name1[200],c_name2[200]; int res; fName2c(format,c_name1,len1); fName2c(path,c_name2,len2); res=System(c_name1,c_name2); ferror_.ferror=FError; return res; }
void ElSystem(const string &aCommand) { #ifdef PRINT_EL_SYSTEM cout << "ElSystem: [" << aCommand << "]" << endl; #endif #ifdef EXECUTE_EL_SYSTEM int result = System(aCommand + " >/dev/null 2>&1"); if (result != 0) ELISE_ERROR_EXIT("command [" << aCommand << "] failed (" << result << ")"); #endif }