bool DBPlugin::SetupLogAndIniFile(TCHAR* nwnxhome) { assert(GetPluginFileName()); /* Log file */ wxString logfile(nwnxhome); logfile.append(wxT("\\")); logfile.append(GetPluginFileName()); logfile.append(wxT(".txt")); logger = new wxLogNWNX(logfile, wxString(header.c_str())); /* Ini file */ wxString inifile(nwnxhome); inifile.append(wxT("\\")); inifile.append(GetPluginFileName()); inifile.append(wxT(".ini")); wxLogTrace(TRACE_VERBOSE, wxT("* reading inifile %s"), inifile); config = new wxFileConfig(wxEmptyString, wxEmptyString, inifile, wxEmptyString, wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_NO_ESCAPE_CHARACTERS); config->Read(wxT("loglevel"), &logLevel); switch(logLevel) { case 0: wxLogMessage(wxT("* Log level set to 0 (nothing)")); break; case 1: wxLogMessage(wxT("* Log level set to 1 (only errors)")); break; case 2: wxLogMessage(wxT("* Log level set to 2 (everything)")); break; } return true; }
void CMainFrame::load_config() { char full_path[1024] = ""; char ini_path[1024] = ""; CString param_value; if(GetModuleFileName(NULL,full_path,sizeof(full_path)-1)>0) { char *p = strrchr(full_path,'\\'); if(p) { strncpy(ini_path,full_path,p-full_path); strcat(ini_path,"\\cpucard.ini"); } } if(strlen(ini_path)==0) { strcpy(ini_path,".\\cpucard.ini"); } CCIniFile inifile(ini_path); param_value = inifile.ReadString("SERVER","IP","127.0.0.1").c_str(); g_config.m_svrip = param_value; g_config.m_svrport = inifile.ReadInteger("SERVER","PORT",4000); g_config.m_mainfunc = inifile.ReadInteger("SERVER","FUNC",6000); }
void MainWindow::slotFileOpt() { int ret,cnt,i; if(opt.arg_debug) printf("slotFileOpt\n"); DlgOpt *dlg = new DlgOpt(this); dlg->setWindowTitle("pvbrowser options"); dlg->setFilename(inifile()); if(opt.arg_debug) printf("slotFileOpt before dlg->exec()\n"); ret = dlg->exec(); if(opt.arg_debug) printf("slotFileOpt after dlg->exec() ret=%d\n", ret); if(ret == QDialog::Accepted) { cnt = urlComboBox->count(); for(i=0; i<cnt; i++) { urlComboBox->removeItem(0); } readIniFile(); for(i=0; i<MAX_TABS; i++) { pvbtab[i].interpreter.temp = opt.temp; } readHosts(); } delete dlg; }
void testIniParser() { std::istringstream inifile( "[s1]\n" "k1=v1\n"); E e; cxxtools::IniParser p(e); p.parse(inifile); CXXTOOLS_UNIT_ASSERT_EQUALS(e.result(), "S(s1)K(k1)V(v1)"); }
void MainWindow::appendIniFile(const char *host) { FILE *fp; char buf[MAX_PRINTF_LENGTH]; int found = 0; if(opt.arg_debug) printf("appendIniFile(%s)\n",host); if(strchr(host,'?') != NULL) return; // don't remember parameters fp = fopen(inifile(),"r"); if(fp == NULL) return; while( fgets(buf,sizeof(buf)-1,fp) != NULL ) { if(strncmp(buf,"host=",5) == 0) { if(strncmp(&buf[5],host,strlen(host)) == 0) { if(opt.arg_debug) printf("appendIniFile(%s) already in list\n",host); found = 1; break; // host already in list } } } fclose(fp); if(found == 0) { fp = fopen(inifile(),"a"); if(fp != NULL) { fprintf(fp,"host=%s\n",host); urlComboBox->insertItem(0,host); } fclose(fp); } for(int i=0; i<urlComboBox->count(); i++) { if(urlComboBox->itemText(i) == host) { urlComboBox->setCurrentIndex(i); } } }
void testEmptyValue() { std::istringstream inifile( "[s1]\n" "k1=\n" "[s2]\n" "k2=\n" ); E e; cxxtools::IniParser p(e); p.parse(inifile); CXXTOOLS_UNIT_ASSERT_EQUALS(e.result(), "S(s1)K(k1)V()S(s2)K(k2)V()"); }
void QFExtensionB040SPADMeasurement::deinit() { /* add code for cleanup here */ QSettings inifile(services->getGlobalConfigFileDirectory()+"/meas_spadmeasurement.ini", QSettings::IniFormat); if (inifile.isWritable()) { inifile.setValue("device_count", getMeasurementDeviceCount()); for (unsigned int i=0; i<getMeasurementDeviceCount(); i++) { int p=devices[i].port; if (ports.getCOMPort(p)) { ports.storeCOMPort(p, inifile, "device"+QString::number(i+1)+"/"); } } } }
BRIDGE_IMPEXP bool BridgeSettingSet(const char* section, const char* key, const char* value) { bool success = false; if(section) { EnterCriticalSection(&csIni); CSimpleIniA inifile(true, false, false); inifile.LoadFile(szIniFile); if(!key || !value) //delete value/key when 0 inifile.Delete(section, key, true); else inifile.SetValue(section, key, value); success = inifile.SaveFile(szIniFile, false) >= 0; LeaveCriticalSection(&csIni); } return success; }
void MainWindow::readHosts() { FILE *fp; char buf[MAX_PRINTF_LENGTH],host[MAX_PRINTF_LENGTH]; fp = fopen(inifile(),"r"); if(fp == NULL) return; while( fgets(buf,sizeof(buf)-1,fp) != NULL ) { if(strncmp(buf,"host=",5) == 0) { sscanf(buf,"host=%s",host); if(opt.arg_debug > 0) printf("readHosts host=%s\n",host); urlComboBox->insertItem(0,host); } } fclose(fp); }
BRIDGE_IMPEXP bool BridgeSettingGet(const char* section, const char* key, char* value) { if(!section || !key || !value) return false; EnterCriticalSection(&csIni); CSimpleIniA inifile(true, false, false); bool success = false; if(inifile.LoadFile(szIniFile) >= 0) { const char* szValue = inifile.GetValue(section, key); if(szValue) { strcpy_s(value, MAX_SETTING_SIZE, szValue); success = true; } } LeaveCriticalSection(&csIni); return success; }
/** * 配置初始化 */ int TestContext::cfg_init(const char* config, ngx_tcp_server_srv_conf_t* tcp_svr_cfg) { test_config_t* testcfg = &this->m_config; CIniFile inifile(config); if(!inifile.ReadFile()){ CONF_ERROR("read config [%s] failed! err: %s", config, strerror(errno)); return NGX_ERROR; } string ip = inifile.GetValue("backend", "ip", "127.0.0.1"); strncpy(testcfg->backend_ip, ip.c_str(), sizeof(testcfg->backend_ip)); testcfg->backend_port = inifile.GetValueI("backend", "port", 2014); mysql_config_read(&inifile, &testcfg->mysql_config, "mysql"); //这一步很重要,当使用异步方式时,timeout必须为0,否则mysql_connect会出错。 if(tcp_svr_cfg->use_async){ testcfg->mysql_config.timeout = 0; } NLOG_DEBUG("mysql: config:%s", testcfg->mysql_config.host); return NGX_OK; }
// 读取本地配置 static int gw_read_local_conf(SvrInfo_s *svr) { char fullpath[1128] = ""; int len = GetModuleFileName(NULL, fullpath, 1024); if(len <= 0) { return -1; } fullpath[len] = '\0'; char* pos = strrchr(fullpath,'\\'); if(pos) strcpy(pos,"\\gwdll.ini"); else return -1; //strcat(fullpath,"gwdll.ini"); CCIniFile inifile(fullpath); std::string tmp = inifile.ReadString("SVR","IP",""); if(tmp.length() == 0) return -1; STR_COPY(svr->drtp_ip,tmp.c_str()); svr->drtp_port = inifile.ReadInteger("SVR","PORT",0); if(svr->drtp_port == 0) return -1; svr->drtp_mainfunc = inifile.ReadInteger("SVR","FUNC",0); if(svr->drtp_mainfunc == 0) return -1; tmp = inifile.ReadString("LOCAL","IP",""); if(tmp.length() == 0) return -1; STR_COPY(svr->ip,tmp.c_str()); svr->drtp_request = inifile.ReadInteger("SVR","REQUEST",-1); if(svr->drtp_request <= 1) return -1; return 0; }
static int main (char *arg,int flags) { char *section = NULL; char *item = NULL; char *value = NULL; int ret = 0; if (!(buff = malloc(32<<10))) return 0; if (!open(arg)) goto quit; section = skip_to(0,arg); item = strstr(++section,"]"); if (!item) goto quit; *item++ = 0; item = skip_to(0x200,item); if (substring("/B",item,1) != 1) { setenvi = 1; item = skip_to(0x200,item); } if (value = strstr(item,"=")) { *value++ = 0; value = trim(value); } else { value=skip_to(0x201,item); if (!*value) value = NULL; } ret = inifile(section,item,value); quit: close(); free(buff); return ret; }
void QF3ObjectiveCombobox::loadObjectives() { objectives.clear(); QString currentO=cmbObjective->currentText(); bool updt=updatesEnabled(); bool widVisible=isVisible(); if (widVisible) setUpdatesEnabled(false); cmbObjective->clear(); QSettings inifileg(globalobjectives, QSettings::IniFormat); QSettings inifile(localobjectives, QSettings::IniFormat); // first read global config QStringList groups=inifile.childGroups(); QStringList groupsg=inifile.childGroups(); for (int i=0; i<groupsg.size(); i++) { if (!groups.contains(groupsg[i])) groups.append(groupsg[i]); } for (int i=0; i<groups.size(); i++) { QString g=groups[i]; ObjectiveDescription o; o.name=inifile.value(g+"/name", inifileg.value(g+"/name", "")).toString(); o.manufacturer=inifile.value(g+"/manufacturer", inifileg.value(g+"/manufacturer", "")).toString(); o.magnification=inifile.value(g+"/magnification", inifileg.value(g+"/magnification", 1)).toDouble(); o.NA=inifile.value(g+"/na", 1).toDouble(); objectives.append(o); } qSort(objectives); for (int i=0; i<objectives.size(); i++) { cmbObjective->addItem(QIcon(":/libqf3widgets/objective.png"), objectives[i].name); } int i=cmbObjective->findText(currentO); if (i<0) i=0; cmbObjective->setCurrentIndex(i); //hbl->update(); if (widVisible) setUpdatesEnabled(updt); }
void QFExtensionB040SPADMeasurement::initExtension() { /* do initializations here but do not yet connect to the camera! */ QString ini=services->getGlobalConfigFileDirectory()+QString("/meas_spadmeasurement.ini"); if (!QFile::exists(ini)) ini=services->getConfigFileDirectory()+QString("/meas_spadmeasurement.ini"); if (!QFile::exists(ini)) ini=services->getAssetsDirectory()+QString("/plugins/")+getID()+QString("/meas_spadmeasurement.ini"); QFPluginServices::getInstance()->log_global_text(tr("%1loading INI-file %2\n").arg(QString(LOG_PREFIX)).arg(ini)); QSettings inifile(ini, QSettings::IniFormat); int device_count=inifile.value("device_count", 0).toUInt(); for (int i=0; i<device_count; i++) { DEVICEINFO s; s.port=ports.addCOMPort(inifile, "device"+QString::number(i+1)+"/", 115200); s.infoMessage=""; s.lastAction=QTime::currentTime(); s.serial=new QF3SimpleB040SerialProtocolHandler(ports.getCOMPort(s.port), getName()); //s.serial->setAddToCommand(""); s.label=inifile.value("device"+QString::number(i+1)+"/label", tr("B040 SPAD surveilance #%1").arg(i+1)).toString(); s.autoconnect=inifile.value("device"+QString::number(i+1)+"/autoconnect", false).toBool(); for (int j=0; j<3; j++) { s.voltage_factor[j]=inifile.value("device"+QString::number(i+1)+"/voltage"+QString::number(j)+"_factor", 1.0).toDouble(); s.voltage_offset[j]=inifile.value("device"+QString::number(i+1)+"/voltage"+QString::number(j)+"_offset", 0.0).toDouble(); s.current_factor[j]=inifile.value("device"+QString::number(i+1)+"/current"+QString::number(j)+"_factor", 1.0).toDouble(); s.current_offset[j]=inifile.value("device"+QString::number(i+1)+"/current"+QString::number(j)+"_offset", 0.0).toDouble(); s.valuelabels[j]=inifile.value("device"+QString::number(i+1)+"/voltage"+QString::number(j)+"_label", tr("voltage %1 [V]").arg(j)).toString(); s.valueids[j]=inifile.value("device"+QString::number(i+1)+"/voltage"+QString::number(j)+"_id", QString("VOLTAGE%1").arg(j)).toString(); s.valuelabels[3+j]=inifile.value("device"+QString::number(i+1)+"/current"+QString::number(j)+"_label", tr("current %1 [mA]").arg(j)).toString(); s.valueids[3+j]=inifile.value("device"+QString::number(i+1)+"/current"+QString::number(j)+"_id", QString("CURRENT%1").arg(j)).toString(); } s.valuelabels[6]=inifile.value("device"+QString::number(i+1)+"/temperature0_label", tr("temperature 0")).toString(); s.valuelabels[7]=inifile.value("device"+QString::number(i+1)+"/temperature1_label", tr("temperature 1")).toString(); s.valueids[6]=inifile.value("device"+QString::number(i+1)+"/temperature0_id", tr("TEMP0")).toString(); s.valueids[7]=inifile.value("device"+QString::number(i+1)+"/temperature1_id", tr("TEMP1")).toString(); devices.append(s); if (s.autoconnect) connectMeasurementDevice(devices.size()-1); } }
void cparse(ConfigurationHolder & configuration_holder, const char * filename) { std::ifstream inifile(filename); this->cparse(configuration_holder, inifile); }
Global::Global() { mw = 0; db = 0; p = 0; nam = 0; uiSession = 0; uiDoublePush = 1000000; iPushToTalk = 0; iTarget = 0; iPrevTarget = 0; bPushToMute = false; bCenterPosition = false; bPosTest = false; bInAudioWizard = false; iAudioPathTime = 0; iAudioBandwidth = -1; iMaxBandwidth = -1; iCodecAlpha = 0; iCodecBeta = 0; bPreferAlpha = true; bOpus = true; bAttenuateOthers = false; bAllowHTML = true; uiMessageLength = 5000; uiImageLength = 131072; qs = NULL; ocIntercept = NULL; bc = NULL; lcd = NULL; o = NULL; l = NULL; bHappyEaster = false; bQuit = false; QStringList qsl; qsl << QCoreApplication::instance()->applicationDirPath(); qsl << QDesktopServices::storageLocation(QDesktopServices::DataLocation); #if defined(Q_OS_WIN) QString appdata; wchar_t appData[MAX_PATH]; if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appData))) { appdata = QDir::fromNativeSeparators(QString::fromWCharArray(appData)); if (!appdata.isEmpty()) { appdata.append(QLatin1String("/Mumble")); qsl << appdata; } } #endif foreach(const QString &dir, qsl) { QFile inifile(QString::fromLatin1("%1/mumble.ini").arg(dir)); if (inifile.exists() && inifile.permissions().testFlag(QFile::WriteUser)) { qdBasePath = dir; qs = new QSettings(inifile.fileName(), QSettings::IniFormat); break; } }
bool CMaster::Init() { ENTER_FUNCTION_FOXNET Common::Timer::SetTimeFunction(MyGetTime); srand(Common::Timer::GetTime()); Common::Ini inifile("config.ini"); // Init Console Callback { Common::ConsoleCmd consoleCMD[] = { { "GetVer", &Console_GetVer, "版本号" }, { "Test", &Console_Test, "" }, { "BugCount", &Console_BugCount, "BugCount" }, }; Common::Console::getSingle().AddCommand(consoleCMD, sizeof(consoleCMD) / sizeof(*consoleCMD)); } // Init Network { m_pAsioNetwork = new AsioNetwork; IOHANDLER_DESC desc; desc.nIoHandlerKey = CLIENT_IOHANDLER_KEY; desc.nMaxAcceptSession = 255; desc.nMaxConnectSession = 5; desc.nSendBufferSize = inifile.ReadInt("Network", "SvrSendBuf"); desc.nRecvBufferSize = inifile.ReadInt("Network", "SvrRecvBuf"); desc.nTimeOut = inifile.ReadInt("Network", "SvrTimeout"); desc.nMaxPacketSize = inifile.ReadInt("Network", "SvrMaxPackSize"); desc.nNumberOfIoThreads = inifile.ReadInt("Network", "SvrIoThread"); desc.fnCreateAcceptedObject = CreateAcceptedObject; desc.fnDestroyAcceptedObject = DestroyAcceptedObject; if (!m_pAsioNetwork->Init(&desc, 1)) { ERRMSG("InitNetwork() Error!!!"); return false; } } m_pOTLDatabase = new COTLDataBase; // CONNECT_INFO info; // info.nTimeOut = 5; // strcpy(info.strConnect, "sa/ubuntu@test1"); // m_pOTLDatabase->Init(3, &info, 1); // Init Global Data { new CDBUserMgr; } // Init Member { char strIni[50] = { 0 }; inifile.ReadText("CenterSvr", "IP", strIni, sizeof(strIni)); SetConfigSvrIP(strIni); SetConfigSvrPort(inifile.ReadInt("CenterSvr", "Port")); inifile.ReadText("IP", "IP1", strIni, sizeof(strIni)); SetListenIP(strIni); SetSvrID(0); m_fCurFps = 0.0f; m_bIsExit = false; m_CheckConnectTimer.SetTimer(2000); m_CheckActionLogTable.SetTimer(60 * 1000); SetWorldAmount(0); SetDBThreadAmount(inifile.ReadInt("DBAgent", "DBThreadAmount")); if (GetDBThreadAmount() == 0) { SetDBThreadAmount(1); } } m_strActionLogTable = ""; m_tCurActionLogTable = 0; return true; LEAVE_FUNCTION_RETURN_FALSE }
const char *readIniFile() { FILE *fp; char buf[MAXOPT],buf2[MAXOPT],cmd[MAXOPT]; const char *cptr; int i; opt.port=5050; opt.sshport=50500; opt.zoom=100; opt.fontzoom=100; opt.autoreconnect=0; opt.exitpassword=0; opt.menubar=1; opt.toolbar=1; opt.statusbar=1; opt.scrollbars=1; opt.fullscreen=0; opt.maximized=0; opt.tabs_above_toolbar=0; opt.echo_table_updates=0; opt.enable_webkit_plugins=1; opt.temp[0] = '\0'; opt.customlogo[0] = '\0'; opt.newwindow[0] = '\0'; opt.ssh[0] = '\0'; opt.i_have_started_servers = 0; opt.view_audio[0] = '\0'; opt.view_video[0] = '\0'; opt.view_pdf[0] = '\0'; opt.view_img[0] = '\0'; opt.view_svg[0] = '\0'; opt.view_txt[0] = '\0'; opt.view_html[0] = '\0'; opt.initialhost[0] = '\0'; opt.language[0] = '\0'; opt.codec = pvbUTF8; // strongly advised to use pvbUTF8 opt.closed = 0; opt.cookies = 1; // YES strcpy(opt.manual,"index.html"); while(1) { fp = fopen(inifile(),"r"); if(fp != NULL) { while( fgets(buf,sizeof(buf)-1,fp) != NULL ) { char *ptr = strchr(buf,'\n'); if(ptr != NULL) *ptr = '\0'; if(strncmp(buf,"port=",5) == 0) { sscanf(buf,"port=%d",&opt.port); } else if(strncmp(buf,"sshport=",8) == 0) { sscanf(buf,"sshport=%d",&opt.sshport); } else if(strncmp(buf,"zoom=",5) == 0) { sscanf(buf,"zoom=%d",&opt.zoom); } else if(strncmp(buf,"fontzoom=",9) == 0) { sscanf(buf,"fontzoom=%d",&opt.fontzoom); } else if(strncmp(buf,"autoreconnect=",14) == 0) { sscanf(buf,"autoreconnect=%d",&opt.autoreconnect); } else if(strncmp(buf,"scrollbars=",11) == 0) { sscanf(buf,"scrollbars=%d",&opt.scrollbars); } else if(strncmp(buf,"cookies=",8) == 0) { sscanf(buf,"cookies=%d",&opt.cookies); } else if(strncmp(buf,"enable_webkit_plugins=",22) == 0) { sscanf(buf,"enable_webkit_plugins=%d",&opt.enable_webkit_plugins); } else if(strncmp(buf,"temp=",5) == 0) { int ret; sscanf(buf,"temp=%s",buf2); #ifdef PVUNIX sprintf(cmd,"mkdir -p %s", buf2); if(system(cmd) != 0) printf("could not create temporary directory: %s\n", cmd); #endif #ifdef PVWIN32 ExpandEnvironmentStrings(buf2,buf,sizeof(buf)-1); if(strstr(buf,"%") != NULL) QMessageBox::warning(NULL,buf,"readIniFile temp directory unknown: adjust pvbrowser.ini temp="); strcpy(buf2,buf); #endif ret = chdir(buf2); if(ret < 0) { #ifdef PVUNIX QMessageBox::warning(NULL,buf2,"readIniFile could not change to temp dir: adjust ~/.pvbrowser.ini temp="); ret = system("xterm -e \"vi ~/.pvbrowser.ini\" &"); #endif #ifdef PVWIN32 QMessageBox::warning(NULL,buf2,"readIniFile could not change to temp dir: adjust pvbrowser.ini temp="); sprintf(buf,"notepad %s",inifile()); system(buf); #endif return "Error chdir"; } #ifdef PVUNIX strcat(buf2,"/"); #endif #ifdef PVWIN32 strcat(buf2,"\\"); #endif strcpy(opt.temp,buf2); } else if(strncmp(buf,"toolbar=",8) == 0) { sscanf(buf,"toolbar=%d",&opt.toolbar); } else if(strncmp(buf,"statusbar=",10) == 0) { sscanf(buf,"statusbar=%d",&opt.statusbar); } else if(strncmp(buf,"menubar=",8) == 0) { sscanf(buf,"menubar=%d",&opt.menubar); } else if(strncmp(buf,"initialhost=",12) == 0) { sscanf(buf,"initialhost=%s",buf2); strcpy(opt.initialhost,buf2); } else if(strncmp(buf,"fullscreen=",11) == 0) { sscanf(buf,"fullscreen=%d",&opt.fullscreen); } else if(strncmp(buf,"maximized=",10) == 0) { sscanf(buf,"maximized=%d",&opt.maximized); } else if(strncmp(buf,"tabs_above_toolbar=",19) == 0) { sscanf(buf,"tabs_above_toolbar=%d",&opt.tabs_above_toolbar); } else if(strncmp(buf,"exitpassword="******"exitpassword=%d",&opt.exitpassword); } else if(strncmp(buf,"echo_table_updates=",19) == 0) { sscanf(buf,"echo_table_updates=%d",&opt.echo_table_updates); } else if(strncmp(buf,"newwindow=",10) == 0) { sscanf(buf,"newwindow=%s",buf); strcpy(opt.newwindow,buf); } else if(strncmp(buf,"ssh=",4) == 0) { strcpy(opt.ssh,&buf[4]); } else if(strncmp(buf,"start=",6) == 0) { mysystem(&buf[6]); opt.i_have_started_servers++; } else if(strncmp(buf,"fillbackground=1",16) == 0) { opt.arg_fillbackground = 1; } else if(strncmp(buf,"view.audio=",11) == 0) { strcpy(opt.view_audio,&buf[11]); } else if(strncmp(buf,"view.video=",11) == 0) { strcpy(opt.view_video,&buf[11]); } else if(strncmp(buf,"view.pdf=",9) == 0) { strcpy(opt.view_pdf,&buf[9]); } else if(strncmp(buf,"view.img=",9) == 0) { strcpy(opt.view_img,&buf[9]); } else if(strncmp(buf,"view.svg=",9) == 0) { strcpy(opt.view_svg,&buf[9]); } else if(strncmp(buf,"view.txt=",9) == 0) { strcpy(opt.view_txt,&buf[9]); } else if(strncmp(buf,"view.csv=",9) == 0) { strcpy(opt.view_csv,&buf[9]); } else if(strncmp(buf,"view.html=",10) == 0) { strcpy(opt.view_html,&buf[10]); } else if(strncmp(buf,"language =",10) == 0) { cptr = strchr(buf,'='); cptr++; if(*cptr == ' ') cptr++; sscanf(cptr,"%s",opt.language); opt.language[100] = '\0'; } else if(strncmp(buf,"customlogo=",11) == 0) { cptr = strchr(buf,'='); cptr++; if(*cptr == ' ') cptr++; sscanf(cptr,"%s",opt.customlogo); } else if(strncmp(buf,"codec=",6) == 0) { opt.codec = pvbUTF8; if(strstr(buf,"=None") != NULL) opt.codec = pvbNone; } else if(buf[0] != '#' && strchr(buf,'{') != NULL) { for(i=0; buf[i] != ' ' && buf[i] != '{'; i++) { opt.language_section[i] = buf[i]; } opt.language_section[i] = '\0'; } else if(buf[0] == '-' && strcmp(opt.language,opt.language_section) == 0) { getLanguage(buf); } } fclose(fp); return NULL; } else // write a default initialisation file { #ifdef USE_ANDROID mkdir("/sdcard/pvbrowser", 0x0fff); // android mkdir("/sdcard/pvbrowser/temp", 0x0fff); // android #endif fp = fopen(inifile(),"w"); if(fp != NULL) { fprintf(fp,"###############################################\n"); fprintf(fp,"# This is the default initialization file for\n"); fprintf(fp,"# ProcessViewBrowser\n"); fprintf(fp,"###############################################\n"); fprintf(fp,"port=5050 # default port\n"); fprintf(fp,"sshport=50500 # local port for ssh connections\n"); fprintf(fp,"zoom=100 # zoom factor in percent\n"); fprintf(fp,"fontzoom=100 # zoom factor for fonts in percent\n"); fprintf(fp,"fillbackground=0 # 0|1 transparency in dialog boxes\n"); fprintf(fp,"codec=utf8 # utf8 | None where None uses latin charset\n"); fprintf(fp,"autoreconnect=0 # 0|1\n"); fprintf(fp,"exitpassword=0 # 0|1\n"); fprintf(fp,"menubar=1 # 0|1\n"); fprintf(fp,"toolbar=1 # 0|1\n"); fprintf(fp,"statusbar=1 # 0|1\n"); fprintf(fp,"scrollbars=1 # 0|1\n"); fprintf(fp,"fullscreen=0 # 0|1\n"); fprintf(fp,"maximized=0 # 0|1\n"); fprintf(fp,"tabs_above_toolbar=0 # 0|1\n"); fprintf(fp,"cookies=1 # 0=No 1=Yes 2=Ask\n"); fprintf(fp,"echo_table_updates=0 # 0|1\n"); fprintf(fp,"enable_webkit_plugins=1 # 0|1\n"); fprintf(fp,"# temporary directory\n"); #ifdef PVUNIX #ifdef USE_ANDROID fprintf(fp,"temp=/sdcard/pvbrowser/temp\n"); #else sprintf(buf,"mkdir -p /tmp/pvb-%s", getenv("USER")); if(system(buf) != 0) printf("could not create temporary directory: %s\n", buf); fprintf(fp,"temp=/tmp/pvb-%s\n", getenv("USER")); #endif #endif #ifdef PVWIN32 //fprintf(fp,"temp=%%PVBDIR%%\\win\\temp\n"); fprintf(fp,"temp=%%TEMP%%\n"); #endif #ifdef __VMS fprintf(fp,"temp=sys$login:\n"); #endif fprintf(fp,"# your custom logo\n"); #ifdef PVUNIX fprintf(fp,"customlogo=/opt/pvb/gamsleiten.png\n"); #endif #ifdef PVWIN32 fprintf(fp,"customlogo=%%PVBDIR%%\\gamsleiten.png\n"); #endif #ifdef __VMS fprintf(fp,"customlogo=[ProcessView.processview.processview]gamsleiten.png\n"); #endif fprintf(fp,"# howto start \"New Window\", can be commented out\n"); fprintf(fp,"#newwindow=pvbrowser\n"); fprintf(fp,"# windows users may put their putty.exe here\n"); fprintf(fp,"ssh=ssh\n"); fprintf(fp,"# we will automatically connect to this node\n"); #ifdef USE_MAEMO fprintf(fp,"initialhost=pv://pvbrowser.org\n"); #else fprintf(fp,"initialhost=pv://localhost\n"); #endif fprintf(fp,"# define the programs that handle the following file formats\n"); #ifdef PVWIN32 fprintf(fp,"view.pdf=\"c:\\path\\to\\acroread\"\n"); fprintf(fp,"view.img=mspaint\n"); fprintf(fp,"view.svg=\"c:\\path\\to\\inkscape\"\n"); fprintf(fp,"view.txt=\"c:\\windows\\system32\\write\"\n"); fprintf(fp,"view.csv=\"c:\\path\\to\\ooffice\"\n"); fprintf(fp,"view.html=\"c:\\path\\to\\firefox\"\n"); fprintf(fp,"view.audio=\"c:\\path\\to\\vlc\"\n"); fprintf(fp,"view.video=\"c:\\path\\to\\vlc\"\n"); #elif defined(PVMAC) fprintf(fp,"view.pdf=okular\n"); fprintf(fp,"view.img=gimp\n"); fprintf(fp,"view.svg=inkscape\n"); fprintf(fp,"view.txt=kwrite\n"); fprintf(fp,"view.csv=ooffice\n"); fprintf(fp,"view.html=firefox\n"); fprintf(fp,"view.audio=vlc\n"); fprintf(fp,"view.video=vlc\n"); #elif defined(PVUNIX) fprintf(fp,"view.pdf=okular\n"); fprintf(fp,"view.img=gimp\n"); fprintf(fp,"view.svg=inkscape\n"); fprintf(fp,"view.txt=kwrite\n"); fprintf(fp,"view.csv=ooffice\n"); fprintf(fp,"view.html=firefox\n"); fprintf(fp,"view.audio=vlc\n"); fprintf(fp,"view.video=vlc\n"); #endif fprintf(fp,"##################################################################\n"); fprintf(fp,"#\n"); fprintf(fp,"# Language settings for ProcessViewBrowser\n"); fprintf(fp,"# you may input your own language (I only know german and english)\n"); fprintf(fp,"# example: comment out: language = german\n"); fprintf(fp,"# comment in: #language = default\n"); fprintf(fp,"# restart ProcessViewBrowser\n"); fprintf(fp,"##################################################################\n"); fprintf(fp,"language = default\n"); fprintf(fp,"#language = german\n"); fprintf(fp,"#language = french\n"); fprintf(fp,"#language = spanish\n"); fprintf(fp,"#language = italian\n"); fprintf(fp,"#language = chinese\n"); fprintf(fp,"#---------------------------------------\n"); fprintf(fp,"german {\n"); fprintf(fp,"-file = &Datei\n"); fprintf(fp,"-options = &Optionen\n"); fprintf(fp,"-new_window = &Neues Fenster\n"); fprintf(fp,"-new_tab = Neuer &Tab\n"); fprintf(fp,"-delete_tab = Schliesst den aktuellen Tab\n"); fprintf(fp,"-reconnect = &Reconnect\n"); fprintf(fp,"-save_as_bmp = &Speichere als BMP ...\n"); fprintf(fp,"-log_as_bmp = Logge Metafiles als &BMP ...\n"); fprintf(fp,"-log_as_pvm = Logge Metafiles als P&VM ...\n"); fprintf(fp,"-print = &Drucken\n"); fprintf(fp,"-exit = Schli&essen\n"); fprintf(fp,"-edit = &Bearbeiten\n"); fprintf(fp,"-copy = &Kopieren\n"); fprintf(fp,"-copy_plus_title = Ko&pieren mit Titel\n"); fprintf(fp,"-view = &Ansicht\n"); fprintf(fp,"-help = &Hilfe\n"); fprintf(fp,"-toolbar = &Werkzeugleiste\n"); fprintf(fp,"-statusbar = &Statuszeile\n"); fprintf(fp,"-maximized = &Maximiert\n"); fprintf(fp,"-fullscreen = &Vollbildmodus\n"); fprintf(fp,"-Manual = &Manual\n"); fprintf(fp,"-about = &About ...\n"); fprintf(fp,"-status_connection_lost = Verbindung zu Server verloren, CTRL-R fuer erneute Verbindung\n"); fprintf(fp,"-status_connected = Verbunden mit Server\n"); fprintf(fp,"-status_could_not_connect = Konnte nicht mit Server verbinden, CTRL-R fuer erneute Verbindung\n"); fprintf(fp,"-status_reconnect = Erneut mit host verbinden\n"); fprintf(fp,"-status_options = Ansehen/Ändern der ProcessViewBrowser Optionen\n"); fprintf(fp,"-status_new_window = Öffnet ein neues ProcessViewBrowser Fenster\n"); fprintf(fp,"-status_new_tab = Öffnet einen neuen Tab\n"); fprintf(fp,"-status_save_as_bmp = Speichert den aktuellen Bildschirm als BMP Datei\n"); fprintf(fp,"-status_log_as_bmp = Logge QDrawWidgets als BMP Datei\n"); fprintf(fp,"-status_log_as_pvm = Logge QDrawWidgets als PVM Datei\n"); fprintf(fp,"-status_print = Druckt den aktuellen Bildschirm\n"); fprintf(fp,"-status_exit = Schliesst pvbrowser\n"); fprintf(fp,"-status_copy = Kopiere den aktuellen Bildschirm in die Zwischenablage\n"); fprintf(fp,"-status_toolbar = Werkzeugleiste (an/aus)\n"); fprintf(fp,"-status_statusbar = Statuszeile (an/aus)\n"); fprintf(fp,"-status_toggle_full_screen = Vollbildmodus (an/aus)\n"); fprintf(fp,"-status_manual = Anwendungsspezifische Hilfe\n"); fprintf(fp,"-status_about = Aboutbox anzeigen\n"); fprintf(fp,"-print_header = Gedruckt von pvbrowser am: \n"); fprintf(fp,"}\n"); fprintf(fp,"#---------------------------------------\n"); fprintf(fp,"french {\n"); fprintf(fp,"-file = Fichier\n"); fprintf(fp,"-options = Option\n"); fprintf(fp,"-new_window = Nouvelle Fenêtre\n"); fprintf(fp,"-new_tab = Nouvelle &Tab\n"); fprintf(fp,"-reconnect = Reconnection\n"); fprintf(fp,"-save_as_bmp = Sauvegarder en BMP ...\n"); fprintf(fp,"-log_as_bmp = Enregistrer en BMP ...\n"); fprintf(fp,"-log_as_pvm = Enregistrer en PVM ...\n"); fprintf(fp,"-print = Imprimer\n"); fprintf(fp,"-exit = Sortir\n"); fprintf(fp,"-edit = éditer\n"); fprintf(fp,"-copy = Copier\n"); fprintf(fp,"-copy_plus_title = Copier + title\n"); fprintf(fp,"-view = Voir\n"); fprintf(fp,"-toolbar = Bare d'outil\n"); fprintf(fp,"-statusbar = Bare d'état\n"); fprintf(fp,"-toggle_full_screen = Permuter la grandeur de fenêtre\n"); fprintf(fp,"-help = Aide\n"); fprintf(fp,"-booklet = Livret\n"); fprintf(fp,"-manual = Manuel\n"); fprintf(fp,"-about = à propos\n"); fprintf(fp,"-recent_urls = Dernier sites visité\n"); fprintf(fp,"-status_connection_lost = Connexion perdu, Faire CTRL-R pour reconnecter en local\n"); fprintf(fp,"-status_connected = Connexion\n"); fprintf(fp,"-status_could_not_connect = Ne peut pas connecter, faire CTRL-R pour reconnecter local\n"); fprintf(fp,"-status_options = Options\n"); fprintf(fp,"-status_new_window = Nouvelle fenêtre\n"); fprintf(fp,"-status_save_as_bmp = Sauvegarder au BMP\n"); fprintf(fp,"-status_log_as_bmp = QDrawWidgets est enregistrer au BMP\n"); fprintf(fp,"-status_log_as_pvm = QDrawWidgets est enregistrer au PVM\n"); fprintf(fp,"-status_print = Imprimer\n"); fprintf(fp,"-status_exit = Sortie de ProcessViewBrowser\n"); fprintf(fp,"-status_copy = Copie\n"); fprintf(fp,"-status_toolbar = Bare d'outil\n"); fprintf(fp,"-status_statusbar = bare d'état\n"); fprintf(fp,"-status_toggle_full_screen = Permuter mode pleine écran\n"); fprintf(fp,"-status_booklet = Livret sur ProcessViewServer\n"); fprintf(fp,"-status_manual = Documentation de ProcessViewServer\n"); fprintf(fp,"-status_about = à propos\n"); fprintf(fp,"-print_header = Imprimer avec pvbrowser\n"); fprintf(fp,"}\n"); fprintf(fp,"#---------------------------------------\n"); fprintf(fp,"spanish {\n"); fprintf(fp,"-file = &Fichero\n"); fprintf(fp,"-options = &Opciones\n"); fprintf(fp,"-new_window = &Nueva Ventana\n"); fprintf(fp,"-new_tab = Nueva &Tab\n"); fprintf(fp,"-reconnect = &Reconectar\n"); fprintf(fp,"-save_as_bmp = &Guardar como BMP...\n"); fprintf(fp,"-log_as_bmp = Log Metafiles como &BMP...\n"); fprintf(fp,"-log_as_pvm = Log Metafiles como P&VM...\n"); fprintf(fp,"-print = &Imprimir\n"); fprintf(fp,"-exit = &Salir\n"); fprintf(fp,"-edit = &Editar\n"); fprintf(fp,"-copy = &Copiar\n"); fprintf(fp,"-copy_plus_title = Co&piar + title\n"); fprintf(fp,"-view = &Ver\n"); fprintf(fp,"-toolbar = &Barra Herramientas\n"); fprintf(fp,"-statusbar = &Barra Estado\n"); fprintf(fp,"-toggle_full_screen = Pantalla Completa (On/Off)\n"); fprintf(fp,"-help = &Ayuda\n"); fprintf(fp,"-booklet = &Manuales\n"); fprintf(fp,"-manual = &Documentación...\n"); fprintf(fp,"-about = &Acerca de...\n"); fprintf(fp,"-recent_urls = URLs Recientes\n"); fprintf(fp,"-status_connection_lost = Conexión al Servidor perdida, CTRL-R para reconecta\n"); fprintf(fp,"-status_connected = Conectado al Servidor\n"); fprintf(fp,"-status_reconnect = Reconectar al Servidor\n"); fprintf(fp,"-status_could_not_connect = No se pudo conectar al Servidor, CTRL-R para reconectar\n"); fprintf(fp,"-status_options = Ver/Cambiar las Opciones ProcessViewBrowser\n"); fprintf(fp,"-status_new_window = Abrir nueva ventana de ProcessViewBrowser\n"); fprintf(fp,"-status_save_as_bmp = Guardar pantalla actual como fichero BMP\n"); fprintf(fp,"-status_log_as_bmp = Logge QDrawWidgets como fichero BMP\n"); fprintf(fp,"-status_log_as_pvm = Logge QDrawWidgets como fichero PVM\n"); fprintf(fp,"-status_print = Imprimir la pantalla actual\n"); fprintf(fp,"-status_exit = Salir de ProcessViewBrowser\n"); fprintf(fp,"-status_copy = Copiar la pantalla al Portapapeles\n"); fprintf(fp,"-status_toolbar = Barra de Herramientas (On/Off)\n"); fprintf(fp,"-status_statusbar = Barra de Estado (On/Off)\n"); fprintf(fp,"-status_toggle_full_screen = Pantalla Completa (On/Off)\n"); fprintf(fp,"-status_booklet = Mostrar ProcessViewServer Manual\n"); fprintf(fp,"-status_manual = Mostrar ProcessViewServer Documentación\n"); fprintf(fp,"-status_about = Acerca de...\n"); fprintf(fp,"-print_header = Impreso desde ProcessViewBrowser\n"); fprintf(fp,"}\n"); fprintf(fp,"#---------------------------------------\n"); fprintf(fp,"italian {\n"); fprintf(fp,"-file = &File\n"); fprintf(fp,"-options = &Opzioni\n"); fprintf(fp,"-new_window = &Nuova Finestra\n"); fprintf(fp,"-new_tab = Nuovo &Tab\n"); fprintf(fp,"-reconnect = &Riconnessione\n"); fprintf(fp,"-save_as_bmp = &Salva come BMP...\n"); fprintf(fp,"-log_as_bmp = Log come &BMP...\n"); fprintf(fp,"-log_as_pvm = Log come P&VM...\n"); fprintf(fp,"-print = Sta&mpa\n"); fprintf(fp,"-exit = &Esci\n"); fprintf(fp,"-edit = &Modifica\n"); fprintf(fp,"-copy = &Copia\n"); fprintf(fp,"-view = &Visualizza\n"); fprintf(fp,"-toolbar = &Barra dei tool\n"); fprintf(fp,"-maximized = &Massimizza\n"); fprintf(fp,"-statusbar = &Barra di stato\n"); fprintf(fp,"-toggle_full_screen = Schermo Completo (On/Off)\n"); fprintf(fp,"-help = &Aiuto\n"); fprintf(fp,"-booklet = &Manuali\n"); fprintf(fp,"-manual = &Documentazione...\n"); fprintf(fp,"-about = &Informazioni su...\n"); fprintf(fp,"-recent_urls = URLs Recenti\n"); fprintf(fp,"-status_connection_lost = Connessione col Server persa, CTRL-R per riconnettere\n"); fprintf(fp,"-status_connected = Connesso al Server\n"); fprintf(fp,"-status_reconnect = Reconnettere col Server\n"); fprintf(fp,"-status_could_not_connect = Connessione col servere fallita, CTRL-R per riconnettere\n"); fprintf(fp,"-status_options = Vedere/Modificare le Opzioni di ProcessViewBrowser\n"); fprintf(fp,"-status_new_window = Aprire nuova finestra di ProcessViewBrowser\n"); fprintf(fp,"-status_save_as_bmp = Salvare la schermata attuale come file BMP\n"); fprintf(fp,"-status_log_as_bmp = Registrando QDrawWidgets come file BMP\n"); fprintf(fp,"-status_log_as_pvm = Registrando QDrawWidgets come file PVM\n"); fprintf(fp,"-status_print = Stampare la schermata attuale\n"); fprintf(fp,"-status_exit = Uscita da ProcessViewBrowser\n"); fprintf(fp,"-status_copy = Copia\n"); fprintf(fp,"-status_toolbar = Barra dei Tools (On/Off)\n"); fprintf(fp,"-status_statusbar = Barra di Stato (On/Off)\n"); fprintf(fp,"-status_toggle_full_screen = A Tutto schermo (On/Off)\n"); fprintf(fp,"-status_booklet = Visualizza il Manuale di ProcessViewServer\n"); fprintf(fp,"-status_manual = Visualizza la Documentazione di ProcessViewServer\n"); fprintf(fp,"-status_about = Informazioni su...\n"); fprintf(fp,"-print_header = Stampato da ProcessViewBrowser\n"); fprintf(fp,"}\n"); fprintf(fp,"\n"); fprintf(fp,"chinese {\n"); fprintf(fp,"-file = &文件\n"); fprintf(fp,"-options = &选项\n"); fprintf(fp,"-new_window = &新建窗口\n"); fprintf(fp,"-new_tab = &新建标签\n"); fprintf(fp,"-delete_tab = 关闭当前标签\n"); fprintf(fp,"-reconnect = &重新连接\n"); fprintf(fp,"-save_as_bmp = &保存为BMP格式 ...\n"); fprintf(fp,"-log_as_bmp = &作为BMP图元文件记录 ...?\n"); fprintf(fp,"-log_as_pvm = &作为VMP图元文件记录 ...?\n"); fprintf(fp,"-print = &打印\n"); fprintf(fp,"-exit = &退出\n"); fprintf(fp,"-edit = &编辑\n"); fprintf(fp,"-copy = &复制\n"); fprintf(fp,"-copy_plus_title = &复制(加标题)\n"); fprintf(fp,"-view = &查看\n"); fprintf(fp,"-help = &帮助\n"); fprintf(fp,"-toolbar = &工具栏\n"); fprintf(fp,"-statusbar = &状态栏\n"); fprintf(fp,"-maximized = &最大化\n"); fprintf(fp,"-fullscreen = &全屏\n"); fprintf(fp,"-Manual = &帮助手册(手动?)\n"); fprintf(fp,"-about = &关于 ...\n"); fprintf(fp,"-status_connection_lost = 状态_连接服务器丢失,“CTRL-R”为重新连接\n"); fprintf(fp,"-status_connected = 状态_服务器已连接\n"); fprintf(fp,"-status_could_not_connect = 状态_无法连接到服务器,“CTRL-R”为重新连接\n"); fprintf(fp,"-status_reconnect = 状态_重新连接\n"); fprintf(fp,"-status_options = 状态_查看/更改浏览器选项\n"); fprintf(fp,"-status_new_window = 状态_打开一个新的浏览器窗口\n"); fprintf(fp,"-status_new_tab = 状态_打开一个新标签\n"); fprintf(fp,"-status_save_as_bmp = 状态_将当前屏幕保存为BMP文件\n"); fprintf(fp,"-status_log_as_bmp = 状态_作为BMP图元文件记录\n"); fprintf(fp,"-status_log_as_pvm = 状态_作为PVM图元文件记录\n"); fprintf(fp,"-status_print = 状态_打印当前屏幕\n"); fprintf(fp,"-status_exit = 状态_关闭pvbrowser\n"); fprintf(fp,"-status_copy = 状态_将当前屏幕复制到剪切板\n"); fprintf(fp,"-status_toolbar = 状态_工具栏(开/关)\n"); fprintf(fp,"-status_statusbar = 状态_状态栏(开/关)\n"); fprintf(fp,"-status_toggle_full_screen = 状态_全屏模式(开/关)\n"); fprintf(fp,"-status_manual = 状态_特殊应用帮助\n"); fprintf(fp,"-status_about = 状态_显示\"关于\"\n"); fprintf(fp,"-print_header = 状态_打印标题\n"); fprintf(fp,"}\n"); fprintf(fp,"# other languages\n"); fprintf(fp,"##################################################################\n"); fprintf(fp,"#\n"); fprintf(fp,"# End of Language settings for pvbrowser\n"); fprintf(fp,"#\n"); fprintf(fp,"##################################################################\n"); fprintf(fp,"#\n"); fprintf(fp,"# This is the list of recent nodes you have visited\n"); fprintf(fp,"host=pv://localhost\n"); fclose(fp); } else { return "Could not write initialization file"; } } } }