void KSircIONotify::sirc_receive(QCString str, bool) { if(str.contains("*)*")){ int s1, s2; s1 = str.find("Signon by") + 10; s2 = str.find(" ", s1); if(s1 < 0 || s2 < 0){ kdDebug(5008) << "Nick Notify mesage broken: " << str << endl; return; } QString nick = str.mid(s1, s2 - s1); emit notify_online(nick); } else if(str.contains("*(*")){ int s1, s2; s1 = str.find("Signoff by") + 11; s2 = str.find(" ", s1); if(s1 < 0 || s2 < 0){ kdDebug(5008) << "Nick Notify mesage broken: " << str << endl; return; } QString nick = str.mid(s1, s2 - s1); emit notify_offline(nick); } else{ proc->getWindowList()["!default"]->sirc_receive(str); kdDebug(5008) << "Nick Notifer got " << str << endl; } }
/* * The actual work. * Return values: -1 = unknown error, 0 = ok, >0 = error code. */ int ChfnProcess::ConverseChfn(const char *pass) { int status=-1; QCString line; while(1) { line = readLine(); if ( line.isEmpty() ) continue;// discard line if ( line.contains( "Password: "******"password" )*/ ) { WaitSlave(); write(m_Fd, pass, strlen(pass)); write(m_Fd, "\n", 1); } line = readLine(); // Let's see what the outcome was if ( line.contains( "Changing finger info" ) ) { // do nothing } else if ( line.contains( "information changed" ) ) { status=0; break; } else if ( line.isEmpty() ) { status=0; break; } else if ( line.contains( "Password error" ) || line.contains("Incorrect password") ) { status=PasswordError; break; } else { status=MiscError; m_Error=line; break; } } return status; }
void QUrl::encode( QString& url ) { if ( url.isEmpty() ) return; QCString curl = url.utf8(); int oldlen = curl.length(); const QCString special( "<>#@\"&%$:,;?={}|^~[]\'`\\ \n\t\r" ); QString newUrl; int newlen = 0; for ( int i = 0; i < oldlen ;++i ) { uchar inCh = (uchar)curl[ i ]; if ( inCh >= 128 || special.contains(inCh) ) { newUrl[ newlen++ ] = QChar( '%' ); ushort c = inCh / 16; c += c > 9 ? 'A' - 10 : '0'; newUrl[ newlen++ ] = c; c = inCh % 16; c += c > 9 ? 'A' - 10 : '0'; newUrl[ newlen++ ] = c; } else { newUrl[ newlen++ ] = inCh; } } url = newUrl; }
void VhdlParser::oneLineComment(QCString qcs) { bool isEndCode=qcs.contains("\\endcode"); int index = qcs.find("\\code"); if (isEndCode) { int end = inputString.find(qcs.data(),iCodeLen); makeInlineDoc(end); } else if (index > 0) { // assert(false); strComment=qcs; startCodeBlock(index); strComment.resize(0); } if (!isEndCode && index==-1) { int j=qcs.find("--!"); qcs=qcs.right(qcs.length()-3-j); if (!checkMultiComment(qcs,iDocLine)) { handleCommentBlock(qcs,TRUE); } } }
void parseDefineConstruct(QCString & largs, MemberDef* mdef ,OutputList& ol) { // QCString largs=mdef->getDefinition(); int kr=largs.contains("\\?"); ol.startBold(); VerilogDocGen::writeLink(mdef,ol); ol.docify(" "); ol.insertMemberAlign(); ol.startTextBlock(); if(kr>0) { largs=mdef->definition(); largs.stripPrefix("feature"); while(largs.stripPrefix(" ")); largs.stripPrefix(mdef->name().data()); QStringList ql=QStringList::split("\\?",largs,false); for(uint i=0;i<ql.count();i++) { // ol.startParagraph(); QCString val=ql[i].data(); //ol.codify(val.data()); VhdlDocGen::formatString(val,ol,mdef); // ol.lineBreak(); // ol.endParagraph(); } } else VhdlDocGen::formatString(largs,ol,mdef); ol.endTextBlock(true); ol.endBold(); }
void NoatunInterface::appRegistered(const QCString &appId) { if (appId.contains("noatun",false)) { mAppId = appId; emit playerStarted(); mNoatunTimer->start(mTimerValue); } }
void NoatunInterface::appRemoved(const QCString &appId) { if (appId.contains("noatun",false)) { // is there still another noatun alive? if (findRunningNoatun()) return; mNoatunTimer->stop(); emit playerStopped(); emit newSliderPosition(0,0); } }
void UmlItem::write_description_properties(FileOut & out) { if (! description().isEmpty()) { static int rank = 0; out.indent(); out << "<ownedComment xmi:type=\"uml:Comment\" xmi:id=\"COMMENT_" << ++rank << "\" body=\""; out.quote(description()); out << "\"/>\n"; } QCString ste = stereotype(); if (_gen_extension) { const QDict<QCString> up = properties(); QDictIterator<QCString> it(up); if (it.current()) { out.indent(); out << "<xmi:Extension extender=\"Bouml\">\n"; if (! ste.isEmpty()) { out.indent(); out << "\t<stereotype name=\""; out.quote(ste); out << "\"/>\n"; } do { out.indent(); out << "\t<taggedValue tag=\""; out.quote(it.currentKey()); out << "\" value=\""; out.quote(*(it.current())); out << "\"/>\n"; ++it; } while (it.current()); out.indent(); out << "</xmi:Extension>\n"; } else if (! ste.isEmpty()) { out.indent(); out << "<xmi:Extension extender=\"Bouml\"><stereotype name=\""; out.quote(ste); out << "\"/></xmi:Extension>\n"; } } if (ste.contains(':') == 1) // probably a stereotype part of profile _stereotypes[ste].append(this); }
void KSircIOLAG::sirc_receive(QCString str, bool) { if(str.contains("*L*")){ int s1, s2; s1 = str.find("*L* ") + 4; s2 = str.length(); if(s1 < 0 || s2 < 0){ kdDebug(5008) << "Lag mesage broken: " << str << endl; return; } QString lag = str.mid(s1, s2 - s1); // cerr << "Lag: " << str << endl; // cerr << "Setting lag to: " << lag << endl; (proc->getWindowList())["!all"]->control_message(SET_LAG, lag); } }
bool PasswdProcess::isPrompt(QCString line, const char *word) { unsigned i, j, colon; unsigned int lineLength(line.length()); for(i = 0, j = 0, colon = 0; i < lineLength; i++) { if(line[i] == ':') { j = i; colon++; continue; } if(!isspace(line[i])) j++; } if((colon != 1) || (line[j] != ':')) return false; if(word == 0L) return true; return line.contains(word, false); }
int ConnectionHandler::doCommand(QCString buf) { if((uid_t)peerUid() != getuid()) { kdWarning(1205) << "Peer uid not equal to me\n"; kdWarning(1205) << "Peer: " << peerUid() << " Me: " << getuid() << endl; return -1; } QCString key, command, pass, name, user, value, env_check; Data_entry data; Lexer *l = new Lexer(buf); int tok = l->lex(); switch(tok) { case Lexer::Tok_pass: // "PASS password:string timeout:int\n" tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; m_Pass.fill('x'); m_Pass = l->lval(); tok = l->lex(); if(tok != Lexer::Tok_num) goto parse_error; m_Timeout = l->lval().toInt(); if(l->lex() != '\n') goto parse_error; if(m_Pass.isNull()) m_Pass = ""; kdDebug(1205) << "Password set!\n"; respond(Res_OK); break; case Lexer::Tok_host: // "HOST host:string\n" tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; m_Host = l->lval(); if(l->lex() != '\n') goto parse_error; kdDebug(1205) << "Host set to " << m_Host << endl; respond(Res_OK); break; case Lexer::Tok_prio: // "PRIO priority:int\n" tok = l->lex(); if(tok != Lexer::Tok_num) goto parse_error; m_Priority = l->lval().toInt(); if(l->lex() != '\n') goto parse_error; kdDebug(1205) << "priority set to " << m_Priority << endl; respond(Res_OK); break; case Lexer::Tok_sched: // "SCHD scheduler:int\n" tok = l->lex(); if(tok != Lexer::Tok_num) goto parse_error; m_Scheduler = l->lval().toInt(); if(l->lex() != '\n') goto parse_error; kdDebug(1205) << "Scheduler set to " << m_Scheduler << endl; respond(Res_OK); break; case Lexer::Tok_exec: // "EXEC command:string user:string [options:string (env:string)*]\n" { QCString options; KStringList env; tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; command = l->lval(); tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; user = l->lval(); tok = l->lex(); if(tok != '\n') { if(tok != Lexer::Tok_str) goto parse_error; options = l->lval(); tok = l->lex(); while(tok != '\n') { if(tok != Lexer::Tok_str) goto parse_error; QCString env_str = l->lval(); env.append(env_str); if(strncmp(env_str, "DESKTOP_STARTUP_ID=", strlen("DESKTOP_STARTUP_ID=")) != 0) env_check += "*" + env_str; tok = l->lex(); } } QCString auth_user; if((m_Scheduler != SuProcess::SchedNormal) || (m_Priority > 50)) auth_user = "******"; else auth_user = user; key = makeKey(2, m_Host, auth_user, command); // We only use the command if the environment is the same. if(repo->find(key) == env_check) { key = makeKey(0, m_Host, auth_user, command); pass = repo->find(key); } if(pass.isNull()) // isNull() means no password, isEmpty() can mean empty password { if(m_Pass.isNull()) { respond(Res_NO); break; } data.value = env_check; data.timeout = m_Timeout; key = makeKey(2, m_Host, auth_user, command); repo->add(key, data); data.value = m_Pass; data.timeout = m_Timeout; key = makeKey(0, m_Host, auth_user, command); repo->add(key, data); pass = m_Pass; } // Execute the command asynchronously kdDebug(1205) << "Executing command: " << command << endl; pid_t pid = fork(); if(pid < 0) { kdDebug(1205) << "fork(): " << strerror(errno) << endl; respond(Res_NO); break; } else if(pid > 0) { m_pid = pid; respond(Res_OK); break; } // Ignore SIGCHLD because "class SuProcess" needs waitpid() signal(SIGCHLD, SIG_DFL); int ret; if(m_Host.isEmpty()) { SuProcess proc; proc.setCommand(command); proc.setUser(user); if(options.contains('x')) proc.setXOnly(true); if(options.contains('f')) proc.setDCOPForwarding(true); proc.setPriority(m_Priority); proc.setScheduler(m_Scheduler); proc.setEnvironment(env); ret = proc.exec(pass.data()); } else { SshProcess proc; proc.setCommand(command); proc.setUser(user); proc.setHost(m_Host); ret = proc.exec(pass.data()); } kdDebug(1205) << "Command completed: " << command << endl; _exit(ret); } case Lexer::Tok_delCmd: // "DEL command:string user:string\n" tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; command = l->lval(); tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; user = l->lval(); if(l->lex() != '\n') goto parse_error; key = makeKey(0, m_Host, user, command); if(repo->remove(key) < 0) { kdDebug(1205) << "Unknown command: " << command << endl; respond(Res_NO); } else { kdDebug(1205) << "Deleted command: " << command << ", user = "******"DELV name:string \n" { tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; name = l->lval(); tok = l->lex(); if(tok != '\n') goto parse_error; key = makeKey(1, name); if(repo->remove(key) < 0) { kdDebug(1205) << "Unknown name: " << name << endl; respond(Res_NO); } else { kdDebug(1205) << "Deleted name: " << name << endl; respond(Res_OK); } break; } case Lexer::Tok_delGroup: // "DELG group:string\n" tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; name = l->lval(); if(repo->removeGroup(name) < 0) { kdDebug(1205) << "No keys found under group: " << name << endl; respond(Res_NO); } else { kdDebug(1205) << "Removed all keys under group: " << name << endl; respond(Res_OK); } break; case Lexer::Tok_delSpecialKey: // "DELS special_key:string\n" tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; name = l->lval(); if(repo->removeSpecialKey(name) < 0) respond(Res_NO); else respond(Res_OK); break; case Lexer::Tok_set: // "SET name:string value:string group:string timeout:int\n" tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; name = l->lval(); tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; data.value = l->lval(); tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; data.group = l->lval(); tok = l->lex(); if(tok != Lexer::Tok_num) goto parse_error; data.timeout = l->lval().toInt(); if(l->lex() != '\n') goto parse_error; key = makeKey(1, name); repo->add(key, data); kdDebug(1205) << "Stored key: " << key << endl; respond(Res_OK); break; case Lexer::Tok_get: // "GET name:string\n" tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; name = l->lval(); if(l->lex() != '\n') goto parse_error; key = makeKey(1, name); kdDebug(1205) << "Request for key: " << key << endl; value = repo->find(key); if(!value.isEmpty()) respond(Res_OK, value); else respond(Res_NO); break; case Lexer::Tok_getKeys: // "GETK groupname:string\n" tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; name = l->lval(); if(l->lex() != '\n') goto parse_error; kdDebug(1205) << "Request for group key: " << name << endl; value = repo->findKeys(name); if(!value.isEmpty()) respond(Res_OK, value); else respond(Res_NO); break; case Lexer::Tok_chkGroup: // "CHKG groupname:string\n" tok = l->lex(); if(tok != Lexer::Tok_str) goto parse_error; name = l->lval(); if(l->lex() != '\n') goto parse_error; kdDebug(1205) << "Checking for group key: " << name << endl; if(repo->hasGroup(name) < 0) respond(Res_NO); else respond(Res_OK); break; case Lexer::Tok_ping: // "PING\n" tok = l->lex(); if(tok != '\n') goto parse_error; respond(Res_OK); break; case Lexer::Tok_exit: // "EXIT\n" tok = l->lex(); if(tok != '\n') goto parse_error; m_needExitCode = true; if(m_hasExitCode) sendExitCode(); break; case Lexer::Tok_stop: // "STOP\n" tok = l->lex(); if(tok != '\n') goto parse_error; kdDebug(1205) << "Stopping by command" << endl; respond(Res_OK); kdesud_cleanup(); exit(0); default: kdWarning(1205) << "Unknown command: " << l->lval() << endl; respond(Res_NO); goto parse_error; } delete l; return 0; parse_error: kdWarning(1205) << "Parse error" << endl; delete l; return -1; }
bool KSshProcess::setOptions(const SshOptList &opts) { kdDebug(KSSHPROC) << "KSshProcess::setOptions()" << endl; mArgs.clear(); SshOptListConstIterator it; QString cmd, subsystem; mPassword = mUsername = mHost = QString::null; QCString tmp; for(it = opts.begin(); it != opts.end(); ++it) { // kdDebug(KSSHPROC) << "opt.opt = " << (*it).opt << endl; // kdDebug(KSSHPROC) << "opt.str = " << (*it).str << endl; // kdDebug(KSSHPROC) << "opt.num = " << (*it).num << endl; switch((*it).opt) { case SSH_VERBOSE: mArgs.append("-v"); break; case SSH_SUBSYSTEM: subsystem = (*it).str; break; case SSH_PORT: mArgs.append("-p"); tmp.setNum((*it).num); mArgs.append(tmp); mPort = (*it).num; break; case SSH_HOST: mHost = (*it).str; break; case SSH_USERNAME: mArgs.append("-l"); mArgs.append((*it).str.latin1()); mUsername = (*it).str; break; case SSH_PASSWD: mPassword = (*it).str; break; case SSH_PROTOCOL: if(mVersion <= OPENSSH) { tmp = "Protocol="; tmp += QString::number((*it).num).latin1(); mArgs.append("-o"); mArgs.append(tmp); } else if(mVersion <= SSH) { if((*it).num == 1) { mArgs.append("-1"); } // else uses version 2 by default } break; case SSH_FORWARDX11: tmp = "ForwardX11="; tmp += (*it).boolean ? "yes" : "no"; mArgs.append("-o"); mArgs.append(tmp); break; case SSH_FORWARDAGENT: tmp = "ForwardAgent="; tmp += (*it).boolean ? "yes" : "no"; mArgs.append("-o"); mArgs.append(tmp); break; case SSH_ESCAPE_CHAR: if((*it).num == -1) tmp = "none"; else tmp = (char)((*it).num); mArgs.append("-e"); mArgs.append(tmp); break; case SSH_OPTION: // don't allow NumberOfPasswordPrompts or StrictHostKeyChecking // since KSshProcess depends on specific setting of these for // preforming authentication correctly. tmp = (*it).str.latin1(); if(tmp.contains("NumberOfPasswordPrompts") || tmp.contains("StrictHostKeyChecking")) { mError = ERR_INVALID_OPT; return false; } else { mArgs.append("-o"); mArgs.append(tmp); } break; case SSH_COMMAND: cmd = (*it).str; break; default: kdDebug(KSSHPROC) << "KSshProcess::setOptions(): " "unrecognized ssh opt " << (*it).opt << endl; } } if(!subsystem.isEmpty() && !cmd.isEmpty()) { kdDebug(KSSHPROC) << "KSshProcess::setOptions(): " "cannot use a subsystem and command at the same time" << endl; mError = ERR_CMD_SUBSYS_CONFLICT; mErrorMsg = i18n("Cannot specify a subsystem and command at the same time."); return false; } // These options govern the behavior of ssh and // cannot be defined by the user // mArgs.append("-o"); // mArgs.append("StrictHostKeyChecking=ask"); mArgs.append("-v"); // So we get a message that the // connection was successful if(mVersion <= OPENSSH) { // nothing } else if(mVersion <= SSH) { mArgs.append("-o"); // So we can check if the connection was successful mArgs.append("AuthenticationSuccessMsg=yes"); } if(mHost.isEmpty()) { kdDebug(KSSHPROC) << "KSshProcess::setOptions(): " "a host name must be supplied" << endl; return false; } else { mArgs.append(mHost.latin1()); } if(!subsystem.isEmpty()) { mArgs.append("-s"); mArgs.append(subsystem.latin1()); } if(!cmd.isEmpty()) { mArgs.append(cmd.latin1()); } return true; }
void VhdlParser::handleCommentBlock(const char* doc1,bool brief) { int position=0; static bool isIn; QCString doc; doc.append(doc1); // fprintf(stderr,"\n %s",doc.data()); if (doc.isEmpty()) return; if (checkMultiComment(doc,yyLineNr)) { strComment.resize(0); return; } isIn=checkInlineCode(doc); bool isEndCode=doc.contains("\\endcode"); // empty comment --! if (isEndCode) { int end=inputString.find(doc.data(),iCodeLen); makeInlineDoc(end); strComment.resize(0); isIn=false; } if (isIn) { isIn=false; return; } VhdlDocGen::prepareComment(doc); bool needsEntry=FALSE; Protection protection=Public; int lineNr; if (iDocLine==-1) lineNr=yyLineNr; if (oldEntry==current) { //printf("\n find pending message < %s > at line: %d \n ",doc.data(),iDocLine); str_doc.doc=doc; str_doc.iDocLine=iDocLine; str_doc.brief=brief; str_doc.pending=TRUE; return; } oldEntry=current; if (brief) { current->briefLine = yyLineNr; } else { current->docLine = yyLineNr; } // printf("parseCommentBlock file<%s>\n [%s]\n at line [%d] \n ",yyFileName.data(),doc.data(),iDocLine); int j=doc.find("[plant]"); if (j>=0) { doc=doc.remove(j,7); current->stat=true; } while (parseCommentBlock( g_thisParser, current, doc, // text yyFileName, // file iDocLine, // line of block start brief, 0, FALSE, protection, position, needsEntry ) ) { //printf("parseCommentBlock position=%d [%s]\n",position,doc.data()+position); if (needsEntry) newEntry(); } if (needsEntry) { if (varr) { varr=FALSE; current->name=varName; current->section=Entry::VARIABLEDOC_SEC; varName=""; } newEntry(); } iDocLine=-1; strComment.resize(0); }
bool LhaArch::processLine( const QCString &line ) { const char *_line = ( const char * ) line; char columns[13][80]; char filename[4096]; if ( line.contains( "[generic]" ) ) { sscanf( _line, " %79[]\\[generic] %79[0-9] %79[0-9] %79[0-9.%*] %10[-a-z0-9 ] %3[A-Za-z]%1[ ]%2[0-9 ]%1[ ]%5[ 0-9:]%1[ ]%4095[^\n]", columns[0], columns[2], columns[3], columns[4], columns[5], columns[6], columns[10], columns[7], columns[11], columns[8], columns[9], filename ); strcpy( columns[1], " " ); } else if ( line.contains( "[MS-DOS]" ) ) { sscanf( _line, " %79[]\\[MS-DOS] %79[0-9] %79[0-9] %79[0-9.%*] %10[-a-z0-9 ] %3[A-Za-z]%1[ ]%2[0-9 ]%1[ ]%5[ 0-9:]%1[ ]%4095[^\n]", columns[0], columns[2], columns[3], columns[4], columns[5], columns[6], columns[10], columns[7], columns[11], columns[8], columns[9], filename ); strcpy( columns[1], " " ); } else { sscanf( _line, " %79[-drlwxst] %79[0-9/] %79[0-9] %79[0-9] %79[0-9.%*] %10[-a-z0-9 ] %3[A-Za-z]%1[ ]%2[0-9 ]%1[ ]%5[ 0-9:]%1[ ]%4095[^\n]", columns[0], columns[1], columns[2], columns[3], columns[4], columns[5], columns[6], columns[10], columns[7], columns[11], columns[8], columns[9], filename ); } // make the time stamp sortable QString massagedTimeStamp = ArkUtils::getTimeStamp( columns[6], columns[7], columns[8] ); strlcpy( columns[6], massagedTimeStamp.ascii(), sizeof( columns[6] ) ); // see if there was a link in filename QString file = filename; QString name, link; bool bLink = false; int pos = file.find( " -> " ); if ( pos != -1 ) { bLink = true; name = file.left(pos); link = file.right(file.length()-pos-4); } else { name = file; } QStringList list; list.append( name ); for ( int i = 0; i < 7; i++ ) { list.append( QString::fromLocal8Bit( columns[i] ) ); } if ( bLink ) list.append( link ); else list.append( "" ); m_gui->fileList()->addItem( list ); // send to GUI return true; }