rem
stringlengths
0
83.5k
add
stringlengths
0
223k
context
stringlengths
10
471k
meta
stringlengths
120
236
if ( m_dcopClient->call( "kded", "mountwatcher", dcopFun.utf8(), param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; }
if ( dcopClient()->call( "kded", "mountwatcher", dcopFun.utf8(), param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; }
QStringList DevicesProtocol::deviceList(){ QByteArray data; QByteArray param; QCString retType; QStringList retVal; QDataStream streamout(param,IO_WriteOnly); kdDebug()<<"list dir: Fullmode=="<<fullMode<<endl; QString dcopFun=fullMode?"basicSystemList()":"basicList()"; if ( m_dcopClient->call( "kded", "mountwatcher", dcopFun.utf8(), param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; } else { retVal.append(QString::fromLatin1("!!!ERROR!!!")); } // add mobile devices info (kmobile) retVal += kmobile_list(QString::null); return retVal;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
return retVal;
return retVal;
QStringList DevicesProtocol::deviceList(){ QByteArray data; QByteArray param; QCString retType; QStringList retVal; QDataStream streamout(param,IO_WriteOnly); kdDebug()<<"list dir: Fullmode=="<<fullMode<<endl; QString dcopFun=fullMode?"basicSystemList()":"basicList()"; if ( m_dcopClient->call( "kded", "mountwatcher", dcopFun.utf8(), param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; } else { retVal.append(QString::fromLatin1("!!!ERROR!!!")); } // add mobile devices info (kmobile) retVal += kmobile_list(QString::null); return retVal;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
QByteArray data; QByteArray param; QCString retType; QString retVal; QDataStream streamout(param,IO_WriteOnly); streamout<<dev; if ( m_dcopClient->call( "kded", "mountwatcher", "mountpoint(QString)", param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; } return retVal;
QByteArray data; QByteArray param; QCString retType; QString retVal; QDataStream streamout(param,IO_WriteOnly); streamout<<dev; if ( dcopClient()->call( "kded", "mountwatcher", "mountpoint(QString)", param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; } return retVal;
QString DevicesProtocol::mountPoint(const QString dev){ QByteArray data; QByteArray param; QCString retType; QString retVal; QDataStream streamout(param,IO_WriteOnly); streamout<<dev; if ( m_dcopClient->call( "kded", "mountwatcher", "mountpoint(QString)", param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; } return retVal;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
if ( m_dcopClient->call( "kded",
if ( dcopClient()->call( "kded",
QString DevicesProtocol::deviceNode(uint id){ QByteArray data; QByteArray param; QCString retType; QString retVal; QDataStream streamout(param,IO_WriteOnly); streamout<<id; if ( m_dcopClient->call( "kded", "mountwatcher", "devicenode(int)", param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; } return retVal;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
{ QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; } return retVal;
{ QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; } return retVal;
QString DevicesProtocol::deviceNode(uint id){ QByteArray data; QByteArray param; QCString retType; QString retVal; QDataStream streamout(param,IO_WriteOnly); streamout<<id; if ( m_dcopClient->call( "kded", "mountwatcher", "devicenode(int)", param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; } return retVal;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
QByteArray data; QByteArray param; QCString retType; QStringList retVal; QDataStream streamout(param,IO_WriteOnly); streamout<<name; if ( m_dcopClient->call( "kded", "mountwatcher", "basicDeviceInfo(QString)", param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; }
QByteArray data; QByteArray param; QCString retType; QStringList retVal; QDataStream streamout(param,IO_WriteOnly); streamout<<name; if ( dcopClient()->call( "kded", "mountwatcher", "basicDeviceInfo(QString)", param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; }
QStringList DevicesProtocol::deviceInfo(QString name){ QByteArray data; QByteArray param; QCString retType; QStringList retVal; QDataStream streamout(param,IO_WriteOnly); streamout<<name; if ( m_dcopClient->call( "kded", "mountwatcher", "basicDeviceInfo(QString)", param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; } // kmobile support if (retVal.isEmpty()) retVal = kmobile_list(name); return retVal;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
kdDebug()<<"DevicesProtocol: Called with slavename:"<<protocol<<endl;
kdDebug(7126)<<"Called with slavename: " << protocol << endl;
DevicesProtocol::DevicesProtocol( const QCString& protocol, const QCString &pool, const QCString &app): SlaveBase(protocol, pool, app ){ kdDebug()<<"DevicesProtocol: Called with slavename:"<<protocol<<endl; if (protocol=="system") fullMode=true; else fullMode=false; m_dcopClient=new DCOPClient(); if (!m_dcopClient->attach()) { kdDebug()<<"ERROR WHILE CONNECTING TO DCOPSERVER"<<endl; }}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
m_dcopClient=new DCOPClient(); if (!m_dcopClient->attach()) { kdDebug()<<"ERROR WHILE CONNECTING TO DCOPSERVER"<<endl; }
DevicesProtocol::DevicesProtocol( const QCString& protocol, const QCString &pool, const QCString &app): SlaveBase(protocol, pool, app ){ kdDebug()<<"DevicesProtocol: Called with slavename:"<<protocol<<endl; if (protocol=="system") fullMode=true; else fullMode=false; m_dcopClient=new DCOPClient(); if (!m_dcopClient->attach()) { kdDebug()<<"ERROR WHILE CONNECTING TO DCOPSERVER"<<endl; }}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
QByteArray data; QByteArray param; QCString retType; QString retVal; QDataStream streamout(param,IO_WriteOnly); streamout<<id; if ( m_dcopClient->call( "kded", "mountwatcher", "type(int)", param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; } return retVal;
QByteArray data; QByteArray param; QCString retType; QString retVal; QDataStream streamout(param,IO_WriteOnly); streamout<<id; if ( dcopClient()->call( "kded", "mountwatcher", "type(int)", param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; } return retVal;
QString DevicesProtocol::deviceType(int id){ QByteArray data; QByteArray param; QCString retType; QString retVal; QDataStream streamout(param,IO_WriteOnly); streamout<<id; if ( m_dcopClient->call( "kded", "mountwatcher", "type(int)", param,retType,data,false ) ) { QDataStream streamin(data,IO_ReadOnly); streamin>>retVal; } return retVal;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
QSize sizeHint() const
QSize sizeHint() const
QSize sizeHint() const { QSize size = KListView::sizeHint(); size.setHeight( size.height() / 2 ); return size; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/5e544ea69a71392da7355c560e6b93be1329462d/kcmstyle.cpp/clean/kcontrol/style/kcmstyle.cpp
kio_sftpProtocol slave(argv[2], argv[3]);
sftpProtocol slave(argv[2], argv[3]);
int kdemain( int argc, char **argv ) { KInstance instance( "kio_sftp" ); kdDebug(KIO_SFTP_DB) << "*** Starting kio_sftp " << endl; if (argc != 4) { kdDebug(KIO_SFTP_DB) << "Usage: kio_sftp protocol domain-socket1 domain-socket2" << endl; exit(-1); } kio_sftpProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); kdDebug(KIO_SFTP_DB) << "*** kio_sftp Done" << endl; return 0; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/8d0ab33f76e18d90bbdd3e5352c889e391e4914a/kio_sftp.cpp/clean/kioslave/sftp/kio_sftp.cpp
cinode_pins[by]--;
void put(int by) { if (ref == 0 || ref_set.count(by) != 1) { dout(7) << " bad put " << *this << " by " << by << " " << cinode_pin_names[by] << " was " << ref << " (" << ref_set << ")" << endl; assert(ref_set.count(by) == 1); assert(ref > 0); } ref--; ref_set.erase(by); if (ref == 0) lru_unpin(); dout(7) << " put " << *this << " by " << by << " " << cinode_pin_names[by] << " now " << ref << " (" << ref_set << ")" << endl; }
2690 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2690/f69665c10a75eb0002d2d5a571a388abd54364f8/CInode.h/buggy/ceph/mds/CInode.h
configMustDeleted=true; }
int main(int argc, char **argv){ KAboutData aboutData("kreadconfig", I18N_NOOP("KReadConfig"), "1.0.1", I18N_NOOP("Read KConfig entries - for use in shell scripts"), KAboutData::License_GPL, "(c) 2001 Red Hat, Inc."); aboutData.addAuthor("Bernhard Rosenkraenzer", 0, "[email protected]"); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::addCmdLineOptions(options); KCmdLineArgs *args=KCmdLineArgs::parsedArgs(); QString group=QString::fromLocal8Bit(args->getOption("group")); QString key=QString::fromLocal8Bit(args->getOption("key")); QString file=QString::fromLocal8Bit(args->getOption("file")); QCString dflt=args->getOption("default"); QCString type=args->getOption("type").lower(); if (key.isNull()) { KCmdLineArgs::usage(); return 1; } KInstance inst(&aboutData); KConfig *konfig; if (file.isEmpty()) konfig = KGlobal::config(); else konfig = new KConfig(file, true, false); konfig->setGroup(group); if(type=="bool") { dflt=dflt.lower(); bool def=(dflt=="true" || dflt=="on" || dflt=="yes" || dflt=="1"); return !konfig->readBoolEntry(key, def); } else if(type=="num") { return konfig->readLongNumEntry(key, dflt.toLong()); } else { /* Assume it's a string... */ fprintf(stdout, "%s\n", konfig->readEntry(key, dflt).local8Bit().data()); return 0; }}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/0b4e99f4c50d6eac12c57958be10998aa140c1e9/kreadconfig.cpp/clean/kreadconfig/kreadconfig.cpp
return !konfig->readBoolEntry(key, def);
bool retValue = !konfig->readBoolEntry(key, def); if ( configMustDeleted ) delete konfig; return retValue;
int main(int argc, char **argv){ KAboutData aboutData("kreadconfig", I18N_NOOP("KReadConfig"), "1.0.1", I18N_NOOP("Read KConfig entries - for use in shell scripts"), KAboutData::License_GPL, "(c) 2001 Red Hat, Inc."); aboutData.addAuthor("Bernhard Rosenkraenzer", 0, "[email protected]"); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::addCmdLineOptions(options); KCmdLineArgs *args=KCmdLineArgs::parsedArgs(); QString group=QString::fromLocal8Bit(args->getOption("group")); QString key=QString::fromLocal8Bit(args->getOption("key")); QString file=QString::fromLocal8Bit(args->getOption("file")); QCString dflt=args->getOption("default"); QCString type=args->getOption("type").lower(); if (key.isNull()) { KCmdLineArgs::usage(); return 1; } KInstance inst(&aboutData); KConfig *konfig; if (file.isEmpty()) konfig = KGlobal::config(); else konfig = new KConfig(file, true, false); konfig->setGroup(group); if(type=="bool") { dflt=dflt.lower(); bool def=(dflt=="true" || dflt=="on" || dflt=="yes" || dflt=="1"); return !konfig->readBoolEntry(key, def); } else if(type=="num") { return konfig->readLongNumEntry(key, dflt.toLong()); } else { /* Assume it's a string... */ fprintf(stdout, "%s\n", konfig->readEntry(key, dflt).local8Bit().data()); return 0; }}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/0b4e99f4c50d6eac12c57958be10998aa140c1e9/kreadconfig.cpp/clean/kreadconfig/kreadconfig.cpp
return konfig->readLongNumEntry(key, dflt.toLong());
long retValue = konfig->readLongNumEntry(key, dflt.toLong()); if ( configMustDeleted ) delete konfig; return retValue;
int main(int argc, char **argv){ KAboutData aboutData("kreadconfig", I18N_NOOP("KReadConfig"), "1.0.1", I18N_NOOP("Read KConfig entries - for use in shell scripts"), KAboutData::License_GPL, "(c) 2001 Red Hat, Inc."); aboutData.addAuthor("Bernhard Rosenkraenzer", 0, "[email protected]"); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::addCmdLineOptions(options); KCmdLineArgs *args=KCmdLineArgs::parsedArgs(); QString group=QString::fromLocal8Bit(args->getOption("group")); QString key=QString::fromLocal8Bit(args->getOption("key")); QString file=QString::fromLocal8Bit(args->getOption("file")); QCString dflt=args->getOption("default"); QCString type=args->getOption("type").lower(); if (key.isNull()) { KCmdLineArgs::usage(); return 1; } KInstance inst(&aboutData); KConfig *konfig; if (file.isEmpty()) konfig = KGlobal::config(); else konfig = new KConfig(file, true, false); konfig->setGroup(group); if(type=="bool") { dflt=dflt.lower(); bool def=(dflt=="true" || dflt=="on" || dflt=="yes" || dflt=="1"); return !konfig->readBoolEntry(key, def); } else if(type=="num") { return konfig->readLongNumEntry(key, dflt.toLong()); } else { /* Assume it's a string... */ fprintf(stdout, "%s\n", konfig->readEntry(key, dflt).local8Bit().data()); return 0; }}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/0b4e99f4c50d6eac12c57958be10998aa140c1e9/kreadconfig.cpp/clean/kreadconfig/kreadconfig.cpp
/* Assume it's a string... */
/* Assume it's a string... */
int main(int argc, char **argv){ KAboutData aboutData("kreadconfig", I18N_NOOP("KReadConfig"), "1.0.1", I18N_NOOP("Read KConfig entries - for use in shell scripts"), KAboutData::License_GPL, "(c) 2001 Red Hat, Inc."); aboutData.addAuthor("Bernhard Rosenkraenzer", 0, "[email protected]"); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::addCmdLineOptions(options); KCmdLineArgs *args=KCmdLineArgs::parsedArgs(); QString group=QString::fromLocal8Bit(args->getOption("group")); QString key=QString::fromLocal8Bit(args->getOption("key")); QString file=QString::fromLocal8Bit(args->getOption("file")); QCString dflt=args->getOption("default"); QCString type=args->getOption("type").lower(); if (key.isNull()) { KCmdLineArgs::usage(); return 1; } KInstance inst(&aboutData); KConfig *konfig; if (file.isEmpty()) konfig = KGlobal::config(); else konfig = new KConfig(file, true, false); konfig->setGroup(group); if(type=="bool") { dflt=dflt.lower(); bool def=(dflt=="true" || dflt=="on" || dflt=="yes" || dflt=="1"); return !konfig->readBoolEntry(key, def); } else if(type=="num") { return konfig->readLongNumEntry(key, dflt.toLong()); } else { /* Assume it's a string... */ fprintf(stdout, "%s\n", konfig->readEntry(key, dflt).local8Bit().data()); return 0; }}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/0b4e99f4c50d6eac12c57958be10998aa140c1e9/kreadconfig.cpp/clean/kreadconfig/kreadconfig.cpp
if ( configMustDeleted ) delete konfig;
int main(int argc, char **argv){ KAboutData aboutData("kreadconfig", I18N_NOOP("KReadConfig"), "1.0.1", I18N_NOOP("Read KConfig entries - for use in shell scripts"), KAboutData::License_GPL, "(c) 2001 Red Hat, Inc."); aboutData.addAuthor("Bernhard Rosenkraenzer", 0, "[email protected]"); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::addCmdLineOptions(options); KCmdLineArgs *args=KCmdLineArgs::parsedArgs(); QString group=QString::fromLocal8Bit(args->getOption("group")); QString key=QString::fromLocal8Bit(args->getOption("key")); QString file=QString::fromLocal8Bit(args->getOption("file")); QCString dflt=args->getOption("default"); QCString type=args->getOption("type").lower(); if (key.isNull()) { KCmdLineArgs::usage(); return 1; } KInstance inst(&aboutData); KConfig *konfig; if (file.isEmpty()) konfig = KGlobal::config(); else konfig = new KConfig(file, true, false); konfig->setGroup(group); if(type=="bool") { dflt=dflt.lower(); bool def=(dflt=="true" || dflt=="on" || dflt=="yes" || dflt=="1"); return !konfig->readBoolEntry(key, def); } else if(type=="num") { return konfig->readLongNumEntry(key, dflt.toLong()); } else { /* Assume it's a string... */ fprintf(stdout, "%s\n", konfig->readEntry(key, dflt).local8Bit().data()); return 0; }}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/0b4e99f4c50d6eac12c57958be10998aa140c1e9/kreadconfig.cpp/clean/kreadconfig/kreadconfig.cpp
KApplication app( false, true);
KApplication app( true);
int kdemain(int argc, char **argv){#ifdef HAVE_NICE nice( 5 );#endif#ifdef USE_KINSTANCE KInstance instance("kio_thumbnail");#else // creating KApplication in a slave in not a very good idea, // as dispatchLoop() doesn't allow it to process its messages, // so it for example wouldn't reply to ksmserver - on the other // hand, this slave uses QPixmaps for some reason, and they // need QApplication // and HTML previews need even KApplication :( putenv(strdup("SESSION_MANAGER=")); KApplication::disableAutoDcopRegistration(); KAboutData about("kio_thumbnail", "kio_thumbmail", "KDE 4.x.x"); KCmdLineArgs::init(&about); KApplication app( false, true);#endif if (argc != 4) { kdError(7115) << "Usage: kio_thumbnail protocol domain-socket1 domain-socket2" << endl; exit(-1); } ThumbnailProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/65656fc14b65fb45a9f9f73e8a54b269ae0172ec/thumbnail.cpp/buggy/kioslave/thumbnail/thumbnail.cpp
CheesySerializer *serializer = new CheesySerializer( new TCPMessenger(MSG_ADDR_CLIENT(i)) ); client[i] = new Client(mdc, i, serializer);
client[i] = new Client(mdc, i, new TCPMessenger(MSG_ADDR_CLIENT(i)) );
int main(int oargc, char **oargv) { //cerr << "tcpsyn starting " << myrank << "/" << world << endl; int argc; char **argv; parse_config_options(oargc, oargv, argc, argv); int start = 0; // build new argc+argv for fuse typedef char* pchar; int nargc = 0; char **nargv = new pchar[argc]; nargv[nargc++] = argv[0]; string syn_sarg1; int syn_mode = SYNCLIENT_MODE_WRITEFILE; int syn_iarg1, syn_iarg2, syn_iarg3; int mkfs = 0; for (int i=1; i<argc; i++) { if (strcmp(argv[i], "--fastmkfs") == 0) { mkfs = MDS_MKFS_FAST; } else if (strcmp(argv[i], "--fullmkfs") == 0) { mkfs = MDS_MKFS_FULL; } else if (strcmp(argv[i],"--synsarg1") == 0) syn_sarg1 = argv[++i]; else if (strcmp(argv[i],"--syniarg1") == 0) syn_iarg1 = atoi(argv[++i]); else if (strcmp(argv[i],"--syniarg2") == 0) syn_iarg2 = atoi(argv[++i]); else if (strcmp(argv[i],"--syniarg3") == 0) syn_iarg3 = atoi(argv[++i]); else if (strcmp(argv[i],"--synmode") == 0) { ++i; if (strcmp(argv[i],"writefile") == 0) syn_mode = SYNCLIENT_MODE_WRITEFILE; else if (strcmp(argv[i],"makedirs") == 0) syn_mode = SYNCLIENT_MODE_MAKEDIRS; else if (strcmp(argv[i],"fullwalk") == 0) syn_mode = SYNCLIENT_MODE_FULLWALK; else if (strcmp(argv[i],"randomwalk") == 0) syn_mode = SYNCLIENT_MODE_RANDOMWALK; else { cerr << "unknown syn mode " << argv[i] << endl; return -1; } } else { // unknown arg, pass it on. nargv[nargc++] = argv[i]; } } int myrank = tcpmessenger_init(argc, argv); int world = tcpmessenger_world(); if (myrank == 0) cerr << "nummds " << NUMMDS << " numosd " << NUMOSD << " numclient " << NUMCLIENT << endl; assert(NUMMDS + NUMOSD + 1 <= world); MDCluster *mdc = new MDCluster(NUMMDS, NUMOSD); char hostname[100]; gethostname(hostname,100); int pid = getpid(); // create mds MDS *mds[NUMMDS]; for (int i=0; i<NUMMDS; i++) { if (myrank != MPI_DEST_TO_RANK(MSG_ADDR_MDS(i),world)) continue; cerr << "mds" << i << " on rank " << myrank << " " << hostname << "." << pid << endl; mds[i] = new MDS(mdc, i, new TCPMessenger(MSG_ADDR_MDS(i))); start++; } // create osd OSD *osd[NUMOSD]; for (int i=0; i<NUMOSD; i++) { if (myrank != MPI_DEST_TO_RANK(MSG_ADDR_OSD(i),world)) continue; cerr << "osd" << i << " on rank " << myrank << " " << hostname << "." << pid << endl; osd[i] = new OSD(i, new TCPMessenger(MSG_ADDR_OSD(i))); start++; } // create client Client *client[NUMCLIENT]; SyntheticClient *syn[NUMCLIENT]; for (int i=0; i<NUMCLIENT; i++) { if (myrank != MPI_DEST_TO_RANK(MSG_ADDR_CLIENT(i),world)) continue; cerr << "client" << i << " on rank " << myrank << " " << hostname << "." << pid << endl; CheesySerializer *serializer = new CheesySerializer( new TCPMessenger(MSG_ADDR_CLIENT(i)) ); client[i] = new Client(mdc, i, serializer); start++; } // start message loop if (start) { tcpmessenger_start(); // init for (int i=0; i<NUMMDS; i++) { if (myrank != MPI_DEST_TO_RANK(MSG_ADDR_MDS(i),world)) continue; mds[i]->init(); } for (int i=0; i<NUMOSD; i++) { if (myrank != MPI_DEST_TO_RANK(MSG_ADDR_OSD(i),world)) continue; osd[i]->init(); } // create client for (int i=0; i<NUMCLIENT; i++) { if (myrank != MPI_DEST_TO_RANK(MSG_ADDR_CLIENT(i),world)) continue; client[i]->init(); // use my argc, argv (make sure you pass a mount point!) //cout << "mounting" << endl; client[i]->mount(mkfs); //cout << "starting synthetic client on rank " << myrank << endl; syn[i] = new SyntheticClient(client[i]); char s[20]; sprintf(s,"syn.%d", i); syn[i]->sarg1 = s; syn[i]->mode = syn_mode; syn[i]->iarg1 = syn_iarg1; syn[i]->iarg2 = syn_iarg2; syn[i]->iarg3 = syn_iarg3; syn[i]->start_thread(); } for (int i=0; i<NUMCLIENT; i++) { if (myrank != MPI_DEST_TO_RANK(MSG_ADDR_CLIENT(i),world)) continue; cout << "waiting for synthetic client" << i << " to finish" << endl; syn[i]->join_thread(); delete syn[i]; client[i]->unmount(); //cout << "client" << i << " unmounted" << endl; client[i]->shutdown(); } // wait for it to finish tcpmessenger_wait(); //assert(0); } else { cerr << "IDLE rank " << myrank << endl; } tcpmessenger_shutdown(); // cleanup for (int i=0; i<NUMMDS; i++) { if (myrank != MPI_DEST_TO_RANK(MSG_ADDR_MDS(i),world)) continue; delete mds[i]; } for (int i=0; i<NUMOSD; i++) { if (myrank != MPI_DEST_TO_RANK(MSG_ADDR_OSD(i),world)) continue; delete osd[i]; } for (int i=0; i<NUMCLIENT; i++) { if (myrank != MPI_DEST_TO_RANK(MSG_ADDR_CLIENT(i),world)) continue; delete client[i]; } delete mdc; return 0;}
2690 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2690/d3ef7c44debfa7997367cff009dac1b770aa56a4/tcpsyn.cc/clean/ceph/tcpsyn.cc
optionChar = getopt_long (argc, argv, "slp",
optionChar = getopt_long (argc, argv, "slpe",
int main(int argc, char *argv[]){ ///////////////////////////////////////////////////////////////// // Command line options 'behaviour' flag setup //////////////////////////////////////////////////////////////// // // Parse the command line arguments, looking to see if the user has asked for any // special behaviours. Any remaining non command arguments will be kept aside to // be passed as a list of layers and / or a project that should be loaded. // // This behaviour is used to load the app, snapshot the map, // save the image to disk and then exit QString mySnapshotFileName=""; // This behaviour will cause QGIS to autoload a project QString myProjectFileName=""; // This behaviour will allow you to force the use of a translation file // which is useful for testing QString myTranslationFileName=""; // This is the 'leftover' arguments collection QStringList * myFileList=new QStringList();#ifndef WIN32 if ( !bundleclicked(argc, argv) ) { //////////////////////////////////////////////////////////////// // USe the GNU Getopts utility to parse cli arguments // Invokes ctor `GetOpt (int argc, char **argv, char *optstring);' /////////////////////////////////////////////////////////////// int optionChar; while (1) { static struct option long_options[] = { /* These options set a flag. */ {"help", no_argument, 0, 'h'}, /* These options don't set a flag. * We distinguish them by their indices. */ {"snapshot", required_argument, 0, 's'}, {"lang", required_argument, 0, 'l'}, {"project", required_argument, 0, 'p'}, {0, 0, 0, 0} }; /* getopt_long stores the option index here. */ int option_index = 0; optionChar = getopt_long (argc, argv, "slp", long_options, &option_index); /* Detect the end of the options. */ if (optionChar == -1) break; switch (optionChar) { case 0: /* If this option set a flag, do nothing else now. */ if (long_options[option_index].flag != 0) break; printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case 's': mySnapshotFileName = optarg; break; case 'l': myTranslationFileName = optarg; break; case 'p': myProjectFileName = optarg; break; case 'h': case '?': usage( argv[0] ); return 2; // XXX need standard exit codes break; default: std::cerr << argv[0] << ": getopt returned character code " << optionChar << "\n"; return 1; // XXX need standard exit codes } } // Add any remaining args to the file list - we will attempt to load them // as layers in the map view further down....#ifdef QGISDEBUG std::cout << "Files specified on command line: " << optind << std::endl;#endif if (optind < argc) { while (optind < argc) {#ifdef QGISDEBUG int idx = optind; std::cout << idx << ": " << argv[idx] << std::endl;#endif myFileList->append(argv[optind++]); } } }#endif //WIN32 ///////////////////////////////////////////////////////////////////// // Now we have the handlers for the different behaviours... //////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // Initialise the application and the translation stuff /////////////////////////////////////////////////////////////////////#ifdef Q_WS_X11 bool myUseGuiFlag = getenv( "DISPLAY" ) != 0;#else bool myUseGuiFlag = TRUE;#endif if (!myUseGuiFlag) { std::cerr << "QGIS starting in non-interactive mode not supported.\n You are seeing this message most likely because you have no DISPLAY environment variable set." << std::endl; exit(1); //exit for now until a version of qgis is capabable of running non interactive } QApplication a(argc, argv, myUseGuiFlag ); // Check to see if qgis was started from the source directory. // This is done by looking for Makefile in the directory where qgis was // started from. If running from the src directory, exit gracefully // Get the application path. This method is required to support qt 3.1.2 // which does not support the applicationFilePath and applicationDirPath // functions. We assume that OS X and Win32 systems will be using at least // Qt 3.2 and therefore support the required functions.#if defined(Q_OS_MACX) || defined(WIN32) QString appPath = qApp->applicationFilePath(); QString appDir = qApp->applicationDirPath(); QString testFile = "Makefile";#else QString appPath = argv[0]; QString appDir = appPath.left(appPath.findRev("/")); QString testFile = "lt-qgis";#endif if(appPath.contains("/src/")) { // check to see if configure is present in the directory QFileInfo fi(appDir + "/" + testFile); if(fi.exists()) { QMessageBox::critical(0,"QGIS Not Installed", "You appear to be running QGIS from the source directory.\n" "You must install QGIS using make install and run it from the " "installed directory."); exit(1); } } // a.setFont(QFont("helvetica", 11));#if defined(Q_OS_MACX) || defined(WIN32) QString PKGDATAPATH = qApp->applicationDirPath() + "/share/qgis";#endif QTranslator tor(0); // For WIN32, get the locale if (myTranslationFileName!="") { QString translation = "qgis_" + myTranslationFileName; tor.load(translation, QString(PKGDATAPATH) + "/i18n"); } else {#ifdef QGISDEBUG std::cout << "Setting translation to " << PKGDATAPATH << "/i18n/qgis_" << QTextCodec::locale() << std::endl; #endif tor.load(QString("qgis_") + QTextCodec::locale(), QString(PKGDATAPATH) + "/i18n"); } //tor.load("qgis_go", "." ); a.installTranslator(&tor); /* uncomment the following line, if you want a Windows 95 look */ //a.setStyle("Windows"); QgisApp *qgis = new QgisApp; // "QgisApp" used to find canonical instance qgis->setName( "QgisApp" ); a.setMainWidget(qgis); ///////////////////////////////////////////////////////////////////// // If no --project was specified, parse the args to look for a // // .qgs file and set myProjectFileName to it. This allows loading // // of a project file by clicking on it in various desktop managers // // where an appropriate mime-type has been set up. // ///////////////////////////////////////////////////////////////////// if(myProjectFileName.isEmpty()) { // check for a .qgs for(int i = 0; i < argc; i++) { QString arg = argv[i]; if(arg.contains(".qgs")) { myProjectFileName = argv[i]; break; } } } ///////////////////////////////////////////////////////////////////// // Load a project file if one was specified ///////////////////////////////////////////////////////////////////// if( ! myProjectFileName.isEmpty() ) {// if ( ! qgis->addProject(myProjectFileName) )// {// #ifdef QGISDEBUG// std::cerr << "unable to load project " << myProjectFileName << "\n";// #endif// } try { if ( ! qgis->addProject(myProjectFileName) ) {#ifdef QGISDEBUG std::cerr << "unable to load project " << myProjectFileName << "\n";#endif } } catch ( QgsIOException & io_exception ) { QMessageBox::critical( 0x0, "QGIS: Unable to load project", "Unable to load project " + myProjectFileName ); } } ///////////////////////////////////////////////////////////////////// // autoload any filenames that were passed in on the command line /////////////////////////////////////////////////////////////////////#ifdef QGISDEBUG std::cout << "Number of files in myFileList: " << myFileList->count() << std::endl;#endif for ( QStringList::Iterator myIterator = myFileList->begin(); myIterator != myFileList->end(); ++myIterator ) {#ifdef QGISDEBUG std::cout << "Trying to load file : " << *myIterator << std::endl;#endif QString myLayerName = *myIterator; // don't load anything with a .qgs extension - these are project files if(!myLayerName.contains(".qgs")) { // try to add all these layers - any unsupported file types will // be rejected automatically // The funky bool ok is so this can be debugged a bit easier... //nope - try and load it as raster bool ok = qgis->addRasterLayer(QFileInfo(myLayerName), false); if(!ok){ //nope - try and load it as a shape/ogr ok = qgis->addLayer(QFileInfo(myLayerName)); //we have no idea what this layer is... if(!ok){ std::cout << "Unable to load " << myLayerName << std::endl; } } } } ///////////////////////////////////////////////////////////////////// // Take a snapshot of the map view then exit if snapshot mode requested ///////////////////////////////////////////////////////////////////// if(mySnapshotFileName!="") { /*You must have at least one paintEvent() delivered for the window to be rendered properly. It looks like you don't run the event loop in non-interactive mode, so the event is never occuring. To achieve this without runing the event loop: show the window, then call qApp->processEvents(), grab the pixmap, save it, hide the window and exit. */ //qgis->show(); a.processEvents(); QPixmap * myQPixmap = new QPixmap(800,600); myQPixmap->fill(); qgis->saveMapAsImage(mySnapshotFileName,myQPixmap); a.processEvents(); qgis->hide(); return 1; } ///////////////////////////////////////////////////////////////////// // Continue on to interactive gui... ///////////////////////////////////////////////////////////////////// qgis->show(); a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); return a.exec();}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/32d095ba7638389e89a859e855e5d9b209f9faa2/main.cpp/buggy/src/main.cpp
if ( ! myInitialExtent.isEmpty() ) { double coords[4]; int pos, posOld = 0; bool ok; for (int i = 0; i < 3; i++) { pos = myInitialExtent.find(',', posOld); if (pos == -1) { ok = false; break; } coords[i] = QString( myInitialExtent.mid(posOld, pos - posOld) ).toDouble(&ok); if (!ok) break; posOld = pos+1; } if (ok) coords[3] = QString( myInitialExtent.mid(posOld) ).toDouble(&ok); if (!ok) std::cout << "Error while parsing initial extent!" << std::endl; else { QgsRect rect(coords[0],coords[1],coords[2],coords[3]); qgis->getMapCanvas()->setExtent(rect); } }
int main(int argc, char *argv[]){ ///////////////////////////////////////////////////////////////// // Command line options 'behaviour' flag setup //////////////////////////////////////////////////////////////// // // Parse the command line arguments, looking to see if the user has asked for any // special behaviours. Any remaining non command arguments will be kept aside to // be passed as a list of layers and / or a project that should be loaded. // // This behaviour is used to load the app, snapshot the map, // save the image to disk and then exit QString mySnapshotFileName=""; // This behaviour will cause QGIS to autoload a project QString myProjectFileName=""; // This behaviour will allow you to force the use of a translation file // which is useful for testing QString myTranslationFileName=""; // This is the 'leftover' arguments collection QStringList * myFileList=new QStringList();#ifndef WIN32 if ( !bundleclicked(argc, argv) ) { //////////////////////////////////////////////////////////////// // USe the GNU Getopts utility to parse cli arguments // Invokes ctor `GetOpt (int argc, char **argv, char *optstring);' /////////////////////////////////////////////////////////////// int optionChar; while (1) { static struct option long_options[] = { /* These options set a flag. */ {"help", no_argument, 0, 'h'}, /* These options don't set a flag. * We distinguish them by their indices. */ {"snapshot", required_argument, 0, 's'}, {"lang", required_argument, 0, 'l'}, {"project", required_argument, 0, 'p'}, {0, 0, 0, 0} }; /* getopt_long stores the option index here. */ int option_index = 0; optionChar = getopt_long (argc, argv, "slp", long_options, &option_index); /* Detect the end of the options. */ if (optionChar == -1) break; switch (optionChar) { case 0: /* If this option set a flag, do nothing else now. */ if (long_options[option_index].flag != 0) break; printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case 's': mySnapshotFileName = optarg; break; case 'l': myTranslationFileName = optarg; break; case 'p': myProjectFileName = optarg; break; case 'h': case '?': usage( argv[0] ); return 2; // XXX need standard exit codes break; default: std::cerr << argv[0] << ": getopt returned character code " << optionChar << "\n"; return 1; // XXX need standard exit codes } } // Add any remaining args to the file list - we will attempt to load them // as layers in the map view further down....#ifdef QGISDEBUG std::cout << "Files specified on command line: " << optind << std::endl;#endif if (optind < argc) { while (optind < argc) {#ifdef QGISDEBUG int idx = optind; std::cout << idx << ": " << argv[idx] << std::endl;#endif myFileList->append(argv[optind++]); } } }#endif //WIN32 ///////////////////////////////////////////////////////////////////// // Now we have the handlers for the different behaviours... //////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // Initialise the application and the translation stuff /////////////////////////////////////////////////////////////////////#ifdef Q_WS_X11 bool myUseGuiFlag = getenv( "DISPLAY" ) != 0;#else bool myUseGuiFlag = TRUE;#endif if (!myUseGuiFlag) { std::cerr << "QGIS starting in non-interactive mode not supported.\n You are seeing this message most likely because you have no DISPLAY environment variable set." << std::endl; exit(1); //exit for now until a version of qgis is capabable of running non interactive } QApplication a(argc, argv, myUseGuiFlag ); // Check to see if qgis was started from the source directory. // This is done by looking for Makefile in the directory where qgis was // started from. If running from the src directory, exit gracefully // Get the application path. This method is required to support qt 3.1.2 // which does not support the applicationFilePath and applicationDirPath // functions. We assume that OS X and Win32 systems will be using at least // Qt 3.2 and therefore support the required functions.#if defined(Q_OS_MACX) || defined(WIN32) QString appPath = qApp->applicationFilePath(); QString appDir = qApp->applicationDirPath(); QString testFile = "Makefile";#else QString appPath = argv[0]; QString appDir = appPath.left(appPath.findRev("/")); QString testFile = "lt-qgis";#endif if(appPath.contains("/src/")) { // check to see if configure is present in the directory QFileInfo fi(appDir + "/" + testFile); if(fi.exists()) { QMessageBox::critical(0,"QGIS Not Installed", "You appear to be running QGIS from the source directory.\n" "You must install QGIS using make install and run it from the " "installed directory."); exit(1); } } // a.setFont(QFont("helvetica", 11));#if defined(Q_OS_MACX) || defined(WIN32) QString PKGDATAPATH = qApp->applicationDirPath() + "/share/qgis";#endif QTranslator tor(0); // For WIN32, get the locale if (myTranslationFileName!="") { QString translation = "qgis_" + myTranslationFileName; tor.load(translation, QString(PKGDATAPATH) + "/i18n"); } else {#ifdef QGISDEBUG std::cout << "Setting translation to " << PKGDATAPATH << "/i18n/qgis_" << QTextCodec::locale() << std::endl; #endif tor.load(QString("qgis_") + QTextCodec::locale(), QString(PKGDATAPATH) + "/i18n"); } //tor.load("qgis_go", "." ); a.installTranslator(&tor); /* uncomment the following line, if you want a Windows 95 look */ //a.setStyle("Windows"); QgisApp *qgis = new QgisApp; // "QgisApp" used to find canonical instance qgis->setName( "QgisApp" ); a.setMainWidget(qgis); ///////////////////////////////////////////////////////////////////// // If no --project was specified, parse the args to look for a // // .qgs file and set myProjectFileName to it. This allows loading // // of a project file by clicking on it in various desktop managers // // where an appropriate mime-type has been set up. // ///////////////////////////////////////////////////////////////////// if(myProjectFileName.isEmpty()) { // check for a .qgs for(int i = 0; i < argc; i++) { QString arg = argv[i]; if(arg.contains(".qgs")) { myProjectFileName = argv[i]; break; } } } ///////////////////////////////////////////////////////////////////// // Load a project file if one was specified ///////////////////////////////////////////////////////////////////// if( ! myProjectFileName.isEmpty() ) {// if ( ! qgis->addProject(myProjectFileName) )// {// #ifdef QGISDEBUG// std::cerr << "unable to load project " << myProjectFileName << "\n";// #endif// } try { if ( ! qgis->addProject(myProjectFileName) ) {#ifdef QGISDEBUG std::cerr << "unable to load project " << myProjectFileName << "\n";#endif } } catch ( QgsIOException & io_exception ) { QMessageBox::critical( 0x0, "QGIS: Unable to load project", "Unable to load project " + myProjectFileName ); } } ///////////////////////////////////////////////////////////////////// // autoload any filenames that were passed in on the command line /////////////////////////////////////////////////////////////////////#ifdef QGISDEBUG std::cout << "Number of files in myFileList: " << myFileList->count() << std::endl;#endif for ( QStringList::Iterator myIterator = myFileList->begin(); myIterator != myFileList->end(); ++myIterator ) {#ifdef QGISDEBUG std::cout << "Trying to load file : " << *myIterator << std::endl;#endif QString myLayerName = *myIterator; // don't load anything with a .qgs extension - these are project files if(!myLayerName.contains(".qgs")) { // try to add all these layers - any unsupported file types will // be rejected automatically // The funky bool ok is so this can be debugged a bit easier... //nope - try and load it as raster bool ok = qgis->addRasterLayer(QFileInfo(myLayerName), false); if(!ok){ //nope - try and load it as a shape/ogr ok = qgis->addLayer(QFileInfo(myLayerName)); //we have no idea what this layer is... if(!ok){ std::cout << "Unable to load " << myLayerName << std::endl; } } } } ///////////////////////////////////////////////////////////////////// // Take a snapshot of the map view then exit if snapshot mode requested ///////////////////////////////////////////////////////////////////// if(mySnapshotFileName!="") { /*You must have at least one paintEvent() delivered for the window to be rendered properly. It looks like you don't run the event loop in non-interactive mode, so the event is never occuring. To achieve this without runing the event loop: show the window, then call qApp->processEvents(), grab the pixmap, save it, hide the window and exit. */ //qgis->show(); a.processEvents(); QPixmap * myQPixmap = new QPixmap(800,600); myQPixmap->fill(); qgis->saveMapAsImage(mySnapshotFileName,myQPixmap); a.processEvents(); qgis->hide(); return 1; } ///////////////////////////////////////////////////////////////////// // Continue on to interactive gui... ///////////////////////////////////////////////////////////////////// qgis->show(); a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); return a.exec();}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/32d095ba7638389e89a859e855e5d9b209f9faa2/main.cpp/buggy/src/main.cpp
KInstance instance("mac");
KInstance instance("kio_mac");
int kdemain(int, char **argv) { KInstance instance("mac"); MacProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); return 0; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/44b8d3744fca8b99d16816d80a18754984e64a16/kio_mac.cpp/buggy/kioslave/mac/kio_mac.cpp
bool ok = qgis->addRasterLayer(myLayerName);
bool ok = qgis->addRasterLayer(myLayerName, false);
int main(int argc, char *argv[]){ ///////////////////////////////////////////////////////////////// // Command line options 'behaviour' flag setup //////////////////////////////////////////////////////////////// // // Parse the command line arguments, looking to see if the user has asked for any // special behaviours. Any remaining non command arguments will be kept aside to // be passed as a list of layers and / or a project that should be loaded. // // This behaviour is used to load the app, snapshot the map, // save the image to disk and then exit QString mySnapshotFileName=""; // This behaviour will cause QGIS to autoload a project QString myProjectFileName=""; // This behaviour will allow you to force the use of a translation file // which is useful for testing QString myTranslationFileName=""; // This is the 'leftover' arguments collection QStringList * myFileList=new QStringList();#ifndef WIN32 //////////////////////////////////////////////////////////////// // USe the GNU Getopts utility to parse cli arguments // Invokes ctor `GetOpt (int argc, char **argv, char *optstring);' /////////////////////////////////////////////////////////////// int optionChar; while (1) { static struct option long_options[] = { /* These options set a flag. */ {"help", no_argument, 0, 'h'}, /* These options don't set a flag. * We distinguish them by their indices. */ {"snapshot", required_argument, 0, 's'}, {"lang", required_argument, 0, 'l'}, {"project", required_argument, 0, 'p'}, {0, 0, 0, 0} }; /* getopt_long stores the option index here. */ int option_index = 0; optionChar = getopt_long (argc, argv, "slp", long_options, &option_index); /* Detect the end of the options. */ if (optionChar == -1) break; switch (optionChar) { case 0: /* If this option set a flag, do nothing else now. */ if (long_options[option_index].flag != 0) break; printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case 's': mySnapshotFileName=optarg; break; case 'l': myTranslationFileName=optarg; break; case 'p': myProjectFileName=optarg; break; case 'h': case '?': usage( argv[0] ); return 2; // XXX need standard exit codes break; default: std::cerr << argv[0] << ": getopt returned character code " << optionChar << "\n"; return 1; // XXX need standard exit codes } } // Add any remaining args to the file list - we will attempt to load them // as layers in the map view further down....#ifdef QGISDEBUG std::cout << "Files specified on command line: " << optind << std::endl;#endif if (optind < argc) { while (optind < argc) {#ifdef QGISDEBUG int idx = optind; std::cout << idx << ": " << argv[idx] << std::endl;#endif myFileList->append(argv[optind++]); } }#endif //WIN32 ///////////////////////////////////////////////////////////////////// // Now we have the handlers for the different behaviours... //////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // Initialise the application and the translation stuff /////////////////////////////////////////////////////////////////////#ifdef Q_WS_X11 bool myUseGuiFlag = getenv( "DISPLAY" ) != 0;#else bool myUseGuiFlag = TRUE;#endif if (!myUseGuiFlag) { std::cerr << "QGIS starting in non-interactive mode because you have no DISPLAY environment variable set." << std::endl; } QApplication a(argc, argv, myUseGuiFlag ); // a.setFont(QFont("helvetica", 11)); QTranslator tor(0); // set the location where your .qm files are in load() below as the last parameter instead of "." // for development, use "/" to use the english original as // .qm files are stored in the base project directory. if (myTranslationFileName!="") { QString translation = "qgis_" + myTranslationFileName; tor.load(translation, QString(PKGDATAPATH) + "/i18n"); } else { tor.load(QString("qgis_") + QTextCodec::locale(), QString(PKGDATAPATH) + "/i18n"); } //tor.load("qgis_go", "." ); a.installTranslator(&tor); /* uncomment the following line, if you want a Windows 95 look */ //a.setStyle("Windows"); QgisApp *qgis = new QgisApp(); a.setMainWidget(qgis); ///////////////////////////////////////////////////////////////////// // Load a project file if one was specified ///////////////////////////////////////////////////////////////////// if(myProjectFileName!="") { if ( ! qgis->addProject(myProjectFileName) ) {#ifdef QGISDEBUG std::cerr << "unable to load project " << myProjectFileName << "\n";#endif } } ///////////////////////////////////////////////////////////////////// // autoload any filenames that were passed in on the command line /////////////////////////////////////////////////////////////////////#ifdef QGISDEBUG std::cout << "Number of files in myFileList: " << myFileList->count() << std::endl;#endif for ( QStringList::Iterator myIterator = myFileList->begin(); myIterator != myFileList->end(); ++myIterator ) {#ifdef QGISDEBUG std::cout << "Trying to load file : " << *myIterator << std::endl;#endif QString myLayerName = *myIterator; // try to add all these layers - any unsupported file types will // be rejected automatically // The funky bool ok is so this can be debugged a bit easier... //nope - try and load it as raster bool ok = qgis->addRasterLayer(myLayerName); if(!ok){ //nope - try and load it as a shape/ogr ok = qgis->addLayer(myLayerName); //we have no idea what this layer is... if(!ok){ std::cout << "Unable to load " << myLayerName << std::endl; } } } ///////////////////////////////////////////////////////////////////// // Take a snapshot of the map view then exit if snapshot mode requested ///////////////////////////////////////////////////////////////////// if(mySnapshotFileName!="") { /*You must have at least one paintEvent() delivered for the window to be rendered properly. It looks like you don't run the event loop in non-interactive mode, so the event is never occuring. To achieve this without runing the event loop: show the window, then call qApp->processEvents(), grab the pixmap, save it, hide the window and exit. */ //qgis->show(); a.processEvents(); QPixmap * myQPixmap = new QPixmap(800,600); myQPixmap->fill(); qgis->saveMapAsImage(mySnapshotFileName,myQPixmap); a.processEvents(); qgis->hide(); return 1; } ///////////////////////////////////////////////////////////////////// // Continue on to interactive gui... ///////////////////////////////////////////////////////////////////// qgis->show(); a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); return a.exec();}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/c8b721046998db20788a1217e48819cc2028e419/main.cpp/clean/src/main.cpp
if ( m_dcopClient->call( "kded",
if ( dcopClient()->call( "kded",
uint DevicesProtocol::mountpointMappingCount(){ QByteArray data; QByteArray param; QCString retType; uint count=0; if ( m_dcopClient->call( "kded", "mountwatcher", "mountpointMappingCount()", param,retType,data,false ) ) { QDataStream stream1(data,IO_ReadOnly); stream1>>count; } return count;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/buggy/kioslave/devices/kio_devices.cc
{ QDataStream stream1(data,IO_ReadOnly); stream1>>count; } return count;
{ QDataStream stream1(data,IO_ReadOnly); stream1>>count; } return count;
uint DevicesProtocol::mountpointMappingCount(){ QByteArray data; QByteArray param; QCString retType; uint count=0; if ( m_dcopClient->call( "kded", "mountwatcher", "mountpointMappingCount()", param,retType,data,false ) ) { QDataStream stream1(data,IO_ReadOnly); stream1>>count; } return count;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/buggy/kioslave/devices/kio_devices.cc
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
void DevicesProtocol::listRoot(){ KIO::UDSEntry entry; uint count; QStringList list=deviceList(); count=0; for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { if ((*it)=="!!!ERROR!!!") { error(KIO::ERR_SLAVE_DEFINED,i18n("The KDE mountwatcher is not running. Please activate it in Control Center->KDE Components->Service Manager, if you want to use the devices:/ protocol")); return; }// FIXME: look for the real ending QString url="devices:/"+(*it); ++it; QString name=*it; ++it; ++it; ++it; QString type=*it; ++it; ++it; createFileEntry(entry,name,url,type); listEntry(entry,false); count++; } totalSize(count); listEntry(entry, true); // Jobs entry // finish finished();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
error(KIO::ERR_SLAVE_DEFINED,i18n("The KDE mountwatcher is not running. Please activate it in Control Center->KDE Components->Service Manager, if you want to use the devices:/ protocol")); return;
error(KIO::ERR_SLAVE_DEFINED,i18n("The KDE mountwatcher is not running. Please activate it in Control Center->KDE Components->Service Manager, if you want to use the devices:/ protocol")); return;
void DevicesProtocol::listRoot(){ KIO::UDSEntry entry; uint count; QStringList list=deviceList(); count=0; for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { if ((*it)=="!!!ERROR!!!") { error(KIO::ERR_SLAVE_DEFINED,i18n("The KDE mountwatcher is not running. Please activate it in Control Center->KDE Components->Service Manager, if you want to use the devices:/ protocol")); return; }// FIXME: look for the real ending QString url="devices:/"+(*it); ++it; QString name=*it; ++it; ++it; ++it; QString type=*it; ++it; ++it; createFileEntry(entry,name,url,type); listEntry(entry,false); count++; } totalSize(count); listEntry(entry, true); // Jobs entry // finish finished();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
totalSize(count); listEntry(entry, true);
totalSize(count); listEntry(entry, true);
void DevicesProtocol::listRoot(){ KIO::UDSEntry entry; uint count; QStringList list=deviceList(); count=0; for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { if ((*it)=="!!!ERROR!!!") { error(KIO::ERR_SLAVE_DEFINED,i18n("The KDE mountwatcher is not running. Please activate it in Control Center->KDE Components->Service Manager, if you want to use the devices:/ protocol")); return; }// FIXME: look for the real ending QString url="devices:/"+(*it); ++it; QString name=*it; ++it; ++it; ++it; QString type=*it; ++it; ++it; createFileEntry(entry,name,url,type); listEntry(entry,false); count++; } totalSize(count); listEntry(entry, true); // Jobs entry // finish finished();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
void DevicesProtocol::listRoot(){ KIO::UDSEntry entry; uint count; QStringList list=deviceList(); count=0; for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { if ((*it)=="!!!ERROR!!!") { error(KIO::ERR_SLAVE_DEFINED,i18n("The KDE mountwatcher is not running. Please activate it in Control Center->KDE Components->Service Manager, if you want to use the devices:/ protocol")); return; }// FIXME: look for the real ending QString url="devices:/"+(*it); ++it; QString name=*it; ++it; ++it; ++it; QString type=*it; ++it; ++it; createFileEntry(entry,name,url,type); listEntry(entry,false); count++; } totalSize(count); listEntry(entry, true); // Jobs entry // finish finished();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
finished();
finished();
void DevicesProtocol::listRoot(){ KIO::UDSEntry entry; uint count; QStringList list=deviceList(); count=0; for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { if ((*it)=="!!!ERROR!!!") { error(KIO::ERR_SLAVE_DEFINED,i18n("The KDE mountwatcher is not running. Please activate it in Control Center->KDE Components->Service Manager, if you want to use the devices:/ protocol")); return; }// FIXME: look for the real ending QString url="devices:/"+(*it); ++it; QString name=*it; ++it; ++it; ++it; QString type=*it; ++it; ++it; createFileEntry(entry,name,url,type); listEntry(entry,false); count++; } totalSize(count); listEntry(entry, true); // Jobs entry // finish finished();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
QString sectionName(const QString& section)
static QString sectionName(const QString& section)
QString sectionName(const QString& section){ if (section == "1") return i18n("User Commands"); else if (section == "2") return i18n("System Calls"); else if (section == "3") return i18n("Subroutines"); else if (section == "3p") return i18n("Perl Modules"); else if (section == "3n") return i18n("Network Functions"); else if (section == "4") return i18n("Devices"); else if (section == "5") return i18n("File Formats"); else if (section == "6") return i18n("Games"); else if (section == "7") return i18n("Miscellaneous"); else if (section == "8") return i18n("System Administration"); else if (section == "9") return i18n("Kernel"); else if (section == "l") return i18n("Local Documentation"); else if (section == "n") return i18n("New"); return QString::null;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/381716671eb61e97e87bb3fe4f8d1a588a76f3cd/kio_man.cpp/clean/kioslave/man/kio_man.cpp
kdDebug(KIO_SMB) << "Smb: kdemain: starting" << endl;
int kdemain( int argc, char **argv ){ KLocale::setMainCatalogue("kio_smbro"); KInstance instance( "kio_smb" ); if (argc != 4) { fprintf(stderr, "Usage: kio_smb protocol domain-socket1 domain-socket2\n"); exit(-1); } //kdDebug(KIO_SMB) << "Smb: kdemain: starting" << endl; SmbProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); kdDebug(KIO_SMB)<<"exiting normally"<<endl; return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/4d45a1a6291ef7b96f9728b69280f6f1fa54d132/kio_smb.cpp/buggy/kioslave/smbro/kio_smb.cpp
kdDebug() << "Could not find module '" << args->arg(0) << "'." << endl;
kdWarning() << "Could not find module '" << args->arg(0) << "'." << endl;
extern "C" int kdemain(int _argc, char *_argv[]){ KAboutData aboutData( "kcmshell", I18N_NOOP("KDE Control Module"), KCONTROL_VERSION, I18N_NOOP("A tool to start single KDE control modules"), KAboutData::License_GPL, "(c) 1999-2002, The KDE Developers"); aboutData.addAuthor("Daniel Molkentin", I18N_NOOP("Current Maintainer"), "[email protected]"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); aboutData.addAuthor("Matthias Ettrich",0, "[email protected]"); aboutData.addAuthor("Waldo Bastian",0, "[email protected]"); KCmdLineArgs::init(_argc, _argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KLocale::setMainCatalogue("kcontrol"); kcmApplication app; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KGlobal::iconLoader()->addAppDir( "kcontrol" ); KGlobal::locale()->setLanguage(args->getOption("lang")); if (args->isSet("list")) { cout << i18n("The following modules are available:").local8Bit() << endl; ConfigModuleList modules; modules.readDesktopEntries(); ConfigModule *module = 0; int maxLen=0; for (module=modules.first(); module != 0; module=modules.next()) { int len = stripPath(module->fileName()).length(); if (len > maxLen) maxLen = len; } for (module=modules.first(); module != 0; module=modules.next()) { QString entry("%1 - %2"); entry = entry.arg(stripPath(module->fileName()).leftJustify(maxLen, ' ')); entry = entry.arg(!module->comment().isEmpty() ? module->comment() : i18n("No description available")); cout << entry.local8Bit() << endl; } return 0; } if (args->count() < 1) { args->usage(); return -1; } if (args->count() == 1) { app.setDCOPName(args->arg(0)); if (app.isRunning()) { app.waitForExit(); return 0; } KService::Ptr service = locateModule(args->arg(0)); if (!service) { kdDebug() << "Could not find module '" << args->arg(0) << "'." << endl; return 1; // error } // load the module KCModuleInfo info(service); KCModule *module = KCModuleLoader::loadModule(info, false); if (module) { // create the dialog QCString embedStr = args->getOption("embed"); bool embed = false; int id = -1; if (!embedStr.isEmpty()) id = embedStr.toInt(&embed); if (!args->isSet("silent")) { if (!embed) { KCDialog * dlg = new KCDialog(module, module->buttons(), info.docPath(), 0, 0, true ); QString caption = (kapp->caption() != i18n("KDE Control Module")) ? kapp->caption() : info.moduleName(); if (kapp->iconName() != kapp->name()) setIcon(dlg, kapp->iconName()); else setIcon(dlg, info.icon()); dlg->setPlainCaption(i18n("Configure - %1").arg(caption)); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // run the dialog dlg->exec(); delete dlg; } // if we are going to be embedded, embed else { QWidget *dlg = new ProxyWidget(module, info.moduleName(), "kcmshell", false); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); QXEmbed::embedClientIntoWindow(dlg, id); kapp->exec(); delete dlg; } } else { //Silent kapp->exec(); } KCModuleLoader::unloadModule(info); return 0; } KCModuleLoader::showLastLoaderError(0L); return 0; } // multiple control modules KService::List modules; for (int i = 0; i < args->count(); i++) { KService::Ptr service = locateModule(args->arg(i)); if (service ) { modules.append(service); continue; } kdDebug() << "Could not find module '" << args->arg(i) << "'." << endl; } if (modules.count() < 1) return -1; // create the dialog KCMultiDialog * dlg = new KCMultiDialog(0, 0, true); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // add modules for (KService::List::ConstIterator it = modules.begin(); it != modules.end(); ++it) dlg->addModule(KCModuleInfo(*it)); // if we are going to be embedded, embed QCString embed = args->getOption("embed"); if (!embed.isEmpty()) { bool ok; int id = embed.toInt(&ok); if (ok) { // NOTE: This has to be changed for QT 3.0. See above! QXEmbed::embedClientIntoWindow(dlg, id); delete dlg; return 0; } } if (kapp->iconName() != kapp->name()) setIcon(dlg, kapp->iconName()); dlg->setPlainCaption(i18n("Configure - %1").arg(kapp->caption())); // run the dialog dlg->exec(); delete dlg; return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/5c47018d6a5dca9d47b51ac3bcf34a9d1f76e9b3/kcmshell.cpp/clean/kcontrol/kcontrol/kcmshell.cpp
kdDebug() << "Could not find module '" << args->arg(i) << "'." << endl;
kdWarning() << "Could not find module '" << args->arg(i) << "'." << endl;
extern "C" int kdemain(int _argc, char *_argv[]){ KAboutData aboutData( "kcmshell", I18N_NOOP("KDE Control Module"), KCONTROL_VERSION, I18N_NOOP("A tool to start single KDE control modules"), KAboutData::License_GPL, "(c) 1999-2002, The KDE Developers"); aboutData.addAuthor("Daniel Molkentin", I18N_NOOP("Current Maintainer"), "[email protected]"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); aboutData.addAuthor("Matthias Ettrich",0, "[email protected]"); aboutData.addAuthor("Waldo Bastian",0, "[email protected]"); KCmdLineArgs::init(_argc, _argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KLocale::setMainCatalogue("kcontrol"); kcmApplication app; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KGlobal::iconLoader()->addAppDir( "kcontrol" ); KGlobal::locale()->setLanguage(args->getOption("lang")); if (args->isSet("list")) { cout << i18n("The following modules are available:").local8Bit() << endl; ConfigModuleList modules; modules.readDesktopEntries(); ConfigModule *module = 0; int maxLen=0; for (module=modules.first(); module != 0; module=modules.next()) { int len = stripPath(module->fileName()).length(); if (len > maxLen) maxLen = len; } for (module=modules.first(); module != 0; module=modules.next()) { QString entry("%1 - %2"); entry = entry.arg(stripPath(module->fileName()).leftJustify(maxLen, ' ')); entry = entry.arg(!module->comment().isEmpty() ? module->comment() : i18n("No description available")); cout << entry.local8Bit() << endl; } return 0; } if (args->count() < 1) { args->usage(); return -1; } if (args->count() == 1) { app.setDCOPName(args->arg(0)); if (app.isRunning()) { app.waitForExit(); return 0; } KService::Ptr service = locateModule(args->arg(0)); if (!service) { kdDebug() << "Could not find module '" << args->arg(0) << "'." << endl; return 1; // error } // load the module KCModuleInfo info(service); KCModule *module = KCModuleLoader::loadModule(info, false); if (module) { // create the dialog QCString embedStr = args->getOption("embed"); bool embed = false; int id = -1; if (!embedStr.isEmpty()) id = embedStr.toInt(&embed); if (!args->isSet("silent")) { if (!embed) { KCDialog * dlg = new KCDialog(module, module->buttons(), info.docPath(), 0, 0, true ); QString caption = (kapp->caption() != i18n("KDE Control Module")) ? kapp->caption() : info.moduleName(); if (kapp->iconName() != kapp->name()) setIcon(dlg, kapp->iconName()); else setIcon(dlg, info.icon()); dlg->setPlainCaption(i18n("Configure - %1").arg(caption)); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // run the dialog dlg->exec(); delete dlg; } // if we are going to be embedded, embed else { QWidget *dlg = new ProxyWidget(module, info.moduleName(), "kcmshell", false); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); QXEmbed::embedClientIntoWindow(dlg, id); kapp->exec(); delete dlg; } } else { //Silent kapp->exec(); } KCModuleLoader::unloadModule(info); return 0; } KCModuleLoader::showLastLoaderError(0L); return 0; } // multiple control modules KService::List modules; for (int i = 0; i < args->count(); i++) { KService::Ptr service = locateModule(args->arg(i)); if (service ) { modules.append(service); continue; } kdDebug() << "Could not find module '" << args->arg(i) << "'." << endl; } if (modules.count() < 1) return -1; // create the dialog KCMultiDialog * dlg = new KCMultiDialog(0, 0, true); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // add modules for (KService::List::ConstIterator it = modules.begin(); it != modules.end(); ++it) dlg->addModule(KCModuleInfo(*it)); // if we are going to be embedded, embed QCString embed = args->getOption("embed"); if (!embed.isEmpty()) { bool ok; int id = embed.toInt(&ok); if (ok) { // NOTE: This has to be changed for QT 3.0. See above! QXEmbed::embedClientIntoWindow(dlg, id); delete dlg; return 0; } } if (kapp->iconName() != kapp->name()) setIcon(dlg, kapp->iconName()); dlg->setPlainCaption(i18n("Configure - %1").arg(kapp->caption())); // run the dialog dlg->exec(); delete dlg; return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/5c47018d6a5dca9d47b51ac3bcf34a9d1f76e9b3/kcmshell.cpp/clean/kcontrol/kcontrol/kcmshell.cpp
prop = xmlGetNsProp(cur, (const xmlChar *)"version", XSLT_NAMESPACE);
prop = xsltGetNsProp(cur, (const xmlChar *)"version", XSLT_NAMESPACE);
xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc) { xmlNodePtr cur; if (doc == NULL) return(NULL); if (ret == NULL) return(ret); /* * First steps, remove blank nodes, * locate the xsl:stylesheet element and the * namespace declaration. */ cur = xmlDocGetRootElement(doc); if (cur == NULL) { xsltGenericError(xsltGenericErrorContext, "xsltParseStylesheetProcess : empty stylesheet\n"); ret->doc = NULL; xsltFreeStylesheet(ret); return(NULL); } xsltPrecomputeStylesheet(ret); if ((IS_XSLT_ELEM(cur)) && ((IS_XSLT_NAME(cur, "stylesheet")) || (IS_XSLT_NAME(cur, "transform")))) {#ifdef WITH_XSLT_DEBUG_PARSING xsltGenericDebug(xsltGenericDebugContext, "xsltParseStylesheetProcess : found stylesheet\n");#endif xsltParseStylesheetTop(ret, cur); } else { xmlChar *prop; xsltTemplatePtr template; /* * the document itself might be the template, check xsl:version */ prop = xmlGetNsProp(cur, (const xmlChar *)"version", XSLT_NAMESPACE); if (prop == NULL) { xsltGenericError(xsltGenericErrorContext, "xsltParseStylesheetProcess : document is not a stylesheet\n"); ret->doc = NULL; xsltFreeStylesheet(ret); return(NULL); }#ifdef WITH_XSLT_DEBUG_PARSING xsltGenericDebug(xsltGenericDebugContext, "xsltParseStylesheetProcess : document is stylesheet\n");#endif if (!xmlStrEqual(prop, (const xmlChar *)"1.0")) { xsltGenericError(xsltGenericErrorContext, "xsl:version: only 1.0 features are supported\n"); /* TODO set up compatibility when not XSLT 1.0 */ ret->warnings++; } xmlFree(prop); /* * Create and link the template */ template = xsltNewTemplate(); if (template == NULL) { ret->doc = NULL; xsltFreeStylesheet(ret); return(NULL); } template->next = ret->templates; ret->templates = template; template->match = xmlStrdup((const xmlChar *)"/"); /* * parse the content and register the pattern */ xsltParseTemplateContent(ret, template, (xmlNodePtr) doc); xsltAddTemplate(ret, template, NULL, NULL); } return(ret);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/fd8a7f1b51439bbcf01b819d7cc964127181d210/xslt.c/buggy/kioslave/help/libxslt/xslt.c
uriRef = xmlGetNsProp(cur, (const xmlChar *)"href", XSLT_NAMESPACE);
uriRef = xsltGetNsProp(cur, (const xmlChar *)"href", XSLT_NAMESPACE);
xsltParseStylesheetInclude(xsltStylesheetPtr style, xmlNodePtr cur) { xmlDocPtr oldDoc; xmlChar *base = NULL; xmlChar *uriRef = NULL; xmlChar *URI = NULL; xsltDocumentPtr include; if ((cur == NULL) || (style == NULL)) return; uriRef = xmlGetNsProp(cur, (const xmlChar *)"href", XSLT_NAMESPACE); if (uriRef == NULL) { xsltGenericError(xsltGenericErrorContext, "xsl:include : missing href attribute\n"); goto error; } base = xmlNodeGetBase(style->doc, cur); URI = xmlBuildURI(uriRef, base); if (URI == NULL) { xsltGenericError(xsltGenericErrorContext, "xsl:include : invalid URI reference %s\n", uriRef); goto error; } include = xsltLoadStyleDocument(style, URI); if (include == NULL) { xsltGenericError(xsltGenericErrorContext, "xsl:include : unable to load %s\n", URI); goto error; } oldDoc = style->doc; style->doc = include->doc; xsltParseStylesheetProcess(style, include->doc); style->doc = oldDoc;error: if (uriRef != NULL) xmlFree(uriRef); if (base != NULL) xmlFree(base); if (URI != NULL) xmlFree(URI);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/fd8a7f1b51439bbcf01b819d7cc964127181d210/imports.c/clean/kioslave/help/libxslt/imports.c
int main(int argc, char *argv[]){ QApplication a(argc, argv); PluginGui *myPluginGui=new PluginGui(); a.setMainWidget(myPluginGui); myPluginGui->show(); return a.exec(); return EXIT_SUCCESS;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3144fa49c2ce17193164da8b10eea05a682b10d1/main.cpp/buggy/plugins/grid_maker/main.cpp
int main(int argc, char *argv[]){ QApplication a(argc, argv); PluginGui *myPluginGui=new PluginGui(); a.setMainWidget(myPluginGui); myPluginGui->show(); return a.exec(); return EXIT_SUCCESS;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3144fa49c2ce17193164da8b10eea05a682b10d1/main.cpp/buggy/plugins/grid_maker/main.cpp
KLocale::setMainCatalogue("kio_fish");
int kdemain( int argc, char **argv ){ KInstance instance("fish"); myDebug( << "*** Starting fish " << endl); if (argc != 4) { myDebug( << "Usage: fish protocol domain-socket1 domain-socket2" << endl); exit(-1); } struct sigaction act; memset(&act,0,sizeof(act)); act.sa_handler = ripper; act.sa_flags = 0#ifdef SA_NOCLDSTOP | SA_NOCLDSTOP#endif#ifdef SA_RESTART | SA_RESTART#endif ; sigaction(SIGCHLD,&act,NULL); fishProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); myDebug( << "*** fish Done" << endl); return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/f8d40929d9810bb78613446247c27f5cc9ffe4a3/fish.cpp/buggy/kioslave/fish/fish.cpp
#endif
int kdemain( int argc, char **argv ){ KInstance instance( "kio_pop3" ); if (argc != 4) { fprintf(stderr, "Usage: kio_pop3 protocol domain-socket1 domain-socket2\n"); exit(-1); } POP3Protocol slave(argv[2], argv[3]); slave.dispatchLoop(); return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/05407a6edfa79039453315a89698295267799062/pop3.cc/clean/kioslave/pop3/pop3.cc
#endif
int kdemain(int argc, char **argv){ qDebug("IMAP4::kdemain"); KInstance instance( "kio_imap4" ); if (argc != 4) { kdDebug() << " Usage: kio_imap4 protocol domain-socket1 domain-socket2" << endl; ::exit(-1); } //set debug handler myDebug = fopen("/tmp/imap_slave","a"); qInstallMsgHandler(myHandler); IMAP4Protocol *slave; if (strcasecmp(argv[1], "imaps") == 0) slave = new IMAP4Protocol(argv[2], argv[3], true); else if (strcasecmp(argv[1], "imap") == 0) slave = new IMAP4Protocol(argv[2], argv[3], false); else abort(); slave->dispatchLoop(); delete slave; fclose(myDebug); return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/7f908fd90b627088fba9f47c997ed8ab1ef94ef2/imap4.cc/clean/kioslave/imap4/imap4.cc
int kdemain(int, char **argv) {
int KDE_EXPORT kdemain(int, char **argv) {
int kdemain(int, char **argv) { KInstance instance("kio_mac"); MacProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); return 0; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/4c48a8b228be22e564be142f2d5b1f60eee1222e/kio_mac.cpp/clean/kioslave/mac/kio_mac.cpp
#endif
int kdemain(int argc, char **argv){ nice( 5 ); // creating KApplication in a slave in not a very good idea, // as dispatchLoop() doesn't allow it to process its messages, // so it for example wouldn't reply to ksmserver - on the other // hand, this slave uses QPixmaps for some reason, and they // need QApplication // and HTML previews need even KApplication :( putenv(strdup("SESSION_MANAGER=")); KApplication::disableAutoDcopRegistration(); KApplication app(argc, argv, "kio_thumbnail", false, true); if (argc != 4) { kdError(7115) << "Usage: kio_thumbnail protocol domain-socket1 domain-socket2" << endl; exit(-1); } ThumbnailProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/c9ccdb5f5a8e65be39ea429dff34c7dd2ffb7362/thumbnail.cpp/buggy/kioslave/thumbnail/thumbnail.cpp
NNTPProtocol slave(argv[2],argv[3]); slave.dispatchLoop();
NNTPProtocol *slave; if (strcasecmp(argv[1], "nntps") == 0) { slave = new NNTPProtocol(argv[2], argv[3], true); } else { slave = new NNTPProtocol(argv[2], argv[3], false); } slave->dispatchLoop(); delete slave;
int kdemain(int argc, char **argv) { KInstance instance ("kio_nntp"); if (argc != 4) { fprintf(stderr, "Usage: kio_nntp protocol domain-socket1 domain-socket2\n"); exit(-1); } NNTPProtocol slave(argv[2],argv[3]); slave.dispatchLoop(); return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/d22bb301fd5e53fc8a33a957d485434583b856fa/nntp.cpp/buggy/kioslave/nntp/nntp.cpp
SmbProtocol slave(argv[2], argv[3]); slave.dispatchLoop();
signal(SIGINT,&destruct); signal(SIGQUIT,&destruct); signal(SIGILL,&destruct); signal(SIGTRAP,&destruct); signal(SIGABRT,&destruct); signal(SIGBUS,&destruct); signal(SIGSEGV,&destruct); signal(SIGUSR2,&destruct); signal(SIGPIPE,&destruct); signal(SIGALRM,&destruct); signal(SIGTERM,&destruct); signal(SIGFPE,&destruct); #ifdef SIGPOLL signal(SIGPOLL, &destruct); #endif #ifdef SIGSYS signal(SIGSYS, &destruct); #endif #ifdef SIGVTALRM signal(SIGVTALRM, &destruct); #endif #ifdef SIGXCPU signal(SIGXCPU, &destruct); #endif #ifdef SIGXFSZ signal(SIGXFSZ, &destruct); #endif SmbProtocol *slave=new SmbProtocol(argv[2], argv[3]); globalSlave=slave; slave->dispatchLoop();
int kdemain( int argc, char **argv ){ KLocale::setMainCatalogue("kio_smbro"); KInstance instance( "kio_smb" ); if (argc != 4) { fprintf(stderr, "Usage: kio_smb protocol domain-socket1 domain-socket2\n"); exit(-1); } //kdDebug(7101) << "Smb: kdemain: starting" << endl; SmbProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/3101298261e3404a5a7724e011dfe97db895b100/kio_smb.cpp/buggy/kioslave/smbro/kio_smb.cpp
{ kdDebug()<<"kdemain for devices"<<endl; KInstance instance( "kio_devices" ); DevicesProtocol slave(argv[1],argv[2], argv[3]); slave.dispatchLoop(); return 0; }
{ kdDebug(7126)<<"kdemain for devices"<<endl; KInstance instance( "kio_devices" ); DevicesProtocol slave(argv[1],argv[2], argv[3]); slave.dispatchLoop(); return 0; }
int kdemain( int, char **argv ) { kdDebug()<<"kdemain for devices"<<endl; KInstance instance( "kio_devices" ); DevicesProtocol slave(argv[1],argv[2], argv[3]); slave.dispatchLoop(); return 0; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a776e4d46653adc584e0d589926f210dc4955ffc/kio_devices.cc/buggy/kioslave/devices/kio_devices.cc
fprintf(stderr, "Usage: kio_file protocol domain-socket1 domain-socket2\n");
fprintf(stderr, "Usage: kio_info protocol domain-socket1 domain-socket2\n");
int kdemain( int argc, char **argv ){ KInstance instance( "kio_info" ); kdDebug() << "kio_info starting " << getpid() << endl; if (argc != 4) { fprintf(stderr, "Usage: kio_file protocol domain-socket1 domain-socket2\n"); exit(-1); } InfoProtocol slave( argv[2], argv[3] ); slave.dispatchLoop(); return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/b133e5c7d257e0c6ac768577199f7d20ee27e527/info.cc/clean/kioslave/info/info.cc
extern "C" int kdemain(int argc, char *argv[])
extern "C" KDE_EXPORT int kdemain(int argc, char *argv[])
extern "C" int kdemain(int argc, char *argv[]){ KLocale::setMainCatalogue("kcontrol"); KAboutData aboutKControl( "kcontrol", I18N_NOOP("KDE Control Center"), KCONTROL_VERSION, I18N_NOOP("The KDE Control Center"), KAboutData::License_GPL, I18N_NOOP("(c) 1998-2004, The KDE Control Center Developers")); KAboutData aboutKInfoCenter( "kinfocenter", I18N_NOOP("KDE Info Center"), KCONTROL_VERSION, I18N_NOOP("The KDE Info Center"), KAboutData::License_GPL, I18N_NOOP("(c) 1998-2004, The KDE Control Center Developers")); QCString argv_0 = argv[0]; KAboutData *aboutData; if (argv_0.right(11) == "kinfocenter") { aboutData = &aboutKInfoCenter; KCGlobal::setIsInfoCenter(true); kdDebug(1208) << "Running as KInfoCenter!\n" << endl; } else { aboutData = &aboutKControl; KCGlobal::setIsInfoCenter(false); } if (argv_0.right(11) == "kinfocenter") aboutData->addAuthor("Helge Deller", I18N_NOOP("Current Maintainer"), "[email protected]"); else aboutData->addAuthor("Daniel Molkentin", I18N_NOOP("Current Maintainer"), "[email protected]"); aboutData->addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData->addAuthor("Matthias Elter",0, "[email protected]"); aboutData->addAuthor("Matthias Ettrich",0, "[email protected]"); aboutData->addAuthor("Waldo Bastian",0, "[email protected]"); KCmdLineArgs::init( argc, argv, aboutData ); KUniqueApplication::addCmdLineOptions(); KCGlobal::init(); if (!KControlApp::start()) { kdDebug(1208) << "kcontrol is already running!\n" << endl; return (0); } KControlApp app; // show the whole stuff app.mainWidget()->show(); return app.exec();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/4c25378bbc0a7e38b1b8dd14c3f51fbd51943767/main.cpp/clean/kcontrol/kcontrol/main.cpp
if ( app.isRestored() ) { RESTORE( MainWindow ); }
extern "C" int kdemain( int argc, char **argv ){ KAboutData aboutData( "khelpcenter", I18N_NOOP("KDE Help Center"), HELPCENTER_VERSION, I18N_NOOP("The KDE Help Center"), KAboutData::License_GPL, I18N_NOOP("(c) 1999-2003, The KHelpCenter developers") ); aboutData.addAuthor( "Cornelius Schumacher", 0, "[email protected]" ); aboutData.addAuthor( "Frerich Raabe", 0, "[email protected]" ); aboutData.addAuthor( "Matthias Elter", I18N_NOOP("Original Author"), "[email protected]" ); aboutData.addAuthor( "Wojciech Smigaj", I18N_NOOP("Info page support"), "[email protected]" ); KCmdLineArgs::init( argc, argv, &aboutData ); KCmdLineArgs::addCmdLineOptions( options ); KApplication::addCmdLineOptions(); KHC::Application app; return app.exec();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/605c61ade2baf2e34321cffa019a1a0904f4ec84/application.cpp/buggy/khelpcenter/application.cpp
int kdemain( int argc, char **argv )
int KDE_EXPORT kdemain( int argc, char **argv )
int kdemain( int argc, char **argv ) { //KInstance instance( "kio_trash" ); // KApplication is necessary to use kio_file putenv(strdup("SESSION_MANAGER=")); KApplication::disableAutoDcopRegistration(); KCmdLineArgs::init(argc, argv, "kio_trash", 0, 0, 0, 0); KCmdLineArgs::addCmdLineOptions( options ); KApplication app( false, false ); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); TrashProtocol slave( args->arg(0), args->arg(1), args->arg(2) ); slave.dispatchLoop(); return 0; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/4c48a8b228be22e564be142f2d5b1f60eee1222e/kio_trash.cpp/buggy/kioslave/trash/kio_trash.cpp
KLocale::setMainCatalogue("kdelibs");
int kdemain( int argc, char **argv ) { KLocale::setMainCatalogue("kdelibs"); KInstance instance("kio_man"); kdDebug(7107) << "STARTING " << getpid() << endl; if (argc != 4) { fprintf(stderr, "Usage: kio_man protocol domain-socket1 domain-socket2\n"); exit(-1); } MANProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); kdDebug(7107) << "Done" << endl; return 0; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/161cad83da570c6afbe4b81bd4ff478d0641f82b/kio_man.cpp/buggy/kioslave/man/kio_man.cpp
int kdemain( int argc, char **argv ) {
int KDE_EXPORT kdemain( int argc, char **argv ) {
int kdemain( int argc, char **argv ) { KInstance instance("kio_about"); if (argc != 4) { fprintf(stderr, "Usage: kio_about protocol domain-socket1 domain-socket2\n"); exit(-1); } AboutProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); return 0; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/4c48a8b228be22e564be142f2d5b1f60eee1222e/kio_about.cpp/clean/kioslave/about/kio_about.cpp
kdDebug() << "kio_cgi starting " << getpid() << endl;
kdDebug(7124) << "kio_cgi starting " << getpid() << endl;
int kdemain( int argc, char **argv ){ KInstance instance( "kio_cgi" ); kdDebug() << "kio_cgi starting " << getpid() << endl; if (argc != 4) { fprintf(stderr, "Usage: kio_cgi protocol domain-socket1 domain-socket2\n"); exit(-1); } CgiProtocol slave( argv[2], argv[3] ); slave.dispatchLoop(); return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/6deed4fab9d384577b02a98f5bff967cf8273f49/cgi.cpp/buggy/kioslave/cgi/cgi.cpp
KApplication app( false, false );
KApplication app( false );
KDE_EXPORT int kdemain( int argc, char **argv ) { // KApplication is necessary to use other ioslaves putenv(strdup("SESSION_MANAGER=")); KCmdLineArgs::init(argc, argv, "kio_system", 0, 0, 0); KCmdLineArgs::addCmdLineOptions( options ); KApplication app( false, false ); // We want to be anonymous even if we use DCOP app.dcopClient()->attach(); DCOPRef ref( "kded", "kded" ); ref.call( "loadModule", "systemdirnotify" ); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); SystemProtocol slave( args->arg(0), args->arg(1), args->arg(2) ); slave.dispatchLoop(); return 0; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/65656fc14b65fb45a9f9f73e8a54b269ae0172ec/kio_system.cpp/clean/kioslave/system/kio_system.cpp
extern "C" int kdemain(int argc, char **argv)
extern "C" KDE_EXPORT int kdemain(int argc, char **argv)
extern "C" int kdemain(int argc, char **argv){ KLocale::setMainCatalogue("kdelibs"); // GS 5/2001 - I changed the name to "KDE" to make it look better // in the titles of dialogs which are displayed. KAboutData aboutdata("kio_uiserver", I18N_NOOP("KDE"), "0.8", I18N_NOOP("KDE Progress Information UI Server"), KAboutData::License_GPL, "(C) 2000, David Faure & Matt Koss"); // Who's the maintainer ? :) aboutdata.addAuthor("David Faure",I18N_NOOP("Developer"),"[email protected]"); aboutdata.addAuthor("Matej Koss",I18N_NOOP("Developer"),"[email protected]"); KCmdLineArgs::init( argc, argv, &aboutdata ); // KCmdLineArgs::addCmdLineOptions( options ); KUniqueApplication::addCmdLineOptions(); if (!KUniqueApplication::start()) { kdDebug(7024) << "kio_uiserver is already running!" << endl; return (0); } KUniqueApplication app; // This app is started automatically, no need for session management app.disableSessionManagement(); app.dcopClient()->setDaemonMode( true ); uiserver = UIServer::createInstance();// app.setMainWidget( uiserver ); return app.exec();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/71258103a6933d213e270ca83790aaaf4ccc564c/uiserver.cpp/clean/kuiserver/uiserver.cpp
int kdemain( int argc, char **argv )
int KDE_EXPORT kdemain( int argc, char **argv )
int kdemain( int argc, char **argv ) { KInstance instance( "kio_sftp" ); kdDebug(KIO_SFTP_DB) << "*** Starting kio_sftp " << endl; if (argc != 4) { kdDebug(KIO_SFTP_DB) << "Usage: kio_sftp protocol domain-socket1 domain-socket2" << endl; exit(-1); } sftpProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); kdDebug(KIO_SFTP_DB) << "*** kio_sftp Done" << endl; return 0; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/4c48a8b228be22e564be142f2d5b1f60eee1222e/kio_sftp.cpp/clean/kioslave/sftp/kio_sftp.cpp
kdDebug(7101) << "NFS: kdemain: starting" << endl;
kdDebug(7121) << "NFS: kdemain: starting" << endl;
int kdemain( int argc, char **argv ){ KInstance instance( "kio_nfs" ); if (argc != 4) { fprintf(stderr, "Usage: kio_nfs protocol domain-socket1 domain-socket2\n"); exit(-1); } kdDebug(7101) << "NFS: kdemain: starting" << endl; NFSProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/2cb2ab38f44e876a51cd16744084e5102e12c7b6/kio_nfs.cpp/buggy/kioslave/nfs/kio_nfs.cpp
int kdemain( int, char **argv )
KDE_EXPORT int kdemain( int, char **argv )
int kdemain( int, char **argv ) { kdDebug() << "kdemain for settings kioslave" << endl; KInstance instance( "kio_settings" ); SettingsProtocol slave(argv[1], argv[2], argv[3]); slave.dispatchLoop(); return 0; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/e1e7cf009e0e126565e643210583d75c2758d527/kio_settings.cc/buggy/kioslave/settings/kio_settings.cc
qDebug ("IMAP4::kdemain");
kdDebug(7116) << "IMAP4::kdemain" << endl;
kdemain (int argc, char **argv){ qDebug ("IMAP4::kdemain"); KInstance instance ("kio_imap4"); if (argc != 4) { kdDebug () << " Usage: kio_imap4 protocol domain-socket1 domain-socket2" << endl; ::exit (-1); } //set debug handler#ifdef EBUGGING myDebug = fopen ("/tmp/imap_slave", "a"); fprintf (myDebug, "Debugging\n"); fflush (myDebug); qInstallMsgHandler (myHandler);#endif IMAP4Protocol *slave; if (strcasecmp (argv[1], "imaps") == 0) slave = new IMAP4Protocol (argv[2], argv[3], true); else if (strcasecmp (argv[1], "imap") == 0) slave = new IMAP4Protocol (argv[2], argv[3], false); else abort (); slave->dispatchLoop (); delete slave;#ifdef EBUGGING fclose (myDebug);#endif return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/f9b4f691986da3bbc60abf7110d8b75c49444c41/imap4.cc/clean/kioslave/imap4/imap4.cc
kdDebug () << " Usage: kio_imap4 protocol domain-socket1 domain-socket2" << endl;
fprintf(stderr, "Usage: kio_imap4 protocol domain-socket1 domain-socket2\n");
kdemain (int argc, char **argv){ qDebug ("IMAP4::kdemain"); KInstance instance ("kio_imap4"); if (argc != 4) { kdDebug () << " Usage: kio_imap4 protocol domain-socket1 domain-socket2" << endl; ::exit (-1); } //set debug handler#ifdef EBUGGING myDebug = fopen ("/tmp/imap_slave", "a"); fprintf (myDebug, "Debugging\n"); fflush (myDebug); qInstallMsgHandler (myHandler);#endif IMAP4Protocol *slave; if (strcasecmp (argv[1], "imaps") == 0) slave = new IMAP4Protocol (argv[2], argv[3], true); else if (strcasecmp (argv[1], "imap") == 0) slave = new IMAP4Protocol (argv[2], argv[3], false); else abort (); slave->dispatchLoop (); delete slave;#ifdef EBUGGING fclose (myDebug);#endif return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/f9b4f691986da3bbc60abf7110d8b75c49444c41/imap4.cc/clean/kioslave/imap4/imap4.cc
int kdemain( int argc, char **argv )
KDE_EXPORT int kdemain( int argc, char **argv )
int kdemain( int argc, char **argv ) { // KApplication is necessary to use other ioslaves putenv(strdup("SESSION_MANAGER=")); KCmdLineArgs::init(argc, argv, "kio_system", 0, 0, 0, 0); KCmdLineArgs::addCmdLineOptions( options ); KApplication app( false, false ); // We want to be anonymous even if we use DCOP //app.dcopClient()->attach(); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); SystemProtocol slave( args->arg(0), args->arg(1), args->arg(2) ); slave.dispatchLoop(); return 0; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/5316e70f34dc14cec20c5dea4866f21647549a5b/kio_system.cpp/buggy/kioslave/system/kio_system.cpp
KCmdLineArgs::init(argc, argv, "kio_remote", 0, 0, 0);
KCmdLineArgs::init(argc, argv, "kio_remote", 0L, 0L, false);
int KDE_EXPORT kdemain( int argc, char **argv ) { // KApplication is necessary to use other ioslaves putenv(strdup("SESSION_MANAGER=")); KCmdLineArgs::init(argc, argv, "kio_remote", 0, 0, 0); KCmdLineArgs::addCmdLineOptions( options ); KApplication app( false, false ); // We want to be anonymous even if we use DCOP app.dcopClient()->attach(); DCOPRef ref( "kded", "kded" ); ref.call( "loadModule", "remotedirnotify" ); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); RemoteProtocol slave( args->arg(0), args->arg(1), args->arg(2) ); slave.dispatchLoop(); return 0; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/52a619d18bd0356d13d5f7618e5a8888120e2ec1/kio_remote.cpp/clean/kioslave/remote/kio_remote.cpp
for( KService::List::ConstIterator it = m_modules.begin(); it != m_modules.end(); it++)
for( KService::List::ConstIterator it = m_modules.begin(); it != m_modules.end(); ++it)
extern "C" KDE_EXPORT int kdemain(int _argc, char *_argv[]){ KAboutData aboutData( "kcmshell", I18N_NOOP("KDE Control Module"), 0, I18N_NOOP("A tool to start single KDE control modules"), KAboutData::License_GPL, I18N_NOOP("(c) 1999-2004, The KDE Developers") ); aboutData.addAuthor("Frans Englich", I18N_NOOP("Maintainer"), "[email protected]"); aboutData.addAuthor("Daniel Molkentin", 0, "[email protected]"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); aboutData.addAuthor("Matthias Ettrich",0, "[email protected]"); aboutData.addAuthor("Waldo Bastian",0, "[email protected]"); KGlobal::locale()->setMainCatalogue("kcmshell"); KCmdLineArgs::init(_argc, _argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KCMShell app; const KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); const QCString lang = args->getOption("lang"); if( !lang.isNull() ) KGlobal::locale()->setLanguage(lang); if (args->isSet("list")) { cout << i18n("The following modules are available:").local8Bit() << endl; listModules( "Settings/" ); int maxLen=0; for( KService::List::ConstIterator it = m_modules.begin(); it != m_modules.end(); it++) { int len = (*it)->desktopEntryName().length(); if (len > maxLen) maxLen = len; } for( KService::List::ConstIterator it = m_modules.begin(); it != m_modules.end(); it++) { QString entry("%1 - %2"); entry = entry.arg((*it)->desktopEntryName().leftJustify(maxLen, ' ')) .arg(!(*it)->comment().isEmpty() ? (*it)->comment() : i18n("No description available")); cout << entry.local8Bit() << endl; } return 0; } if (args->count() < 1) { args->usage(); return -1; } QCString dcopName; KService::List modules; for (int i = 0; i < args->count(); i++) { KService::Ptr service = locateModule(args->arg(i)); if( service ) { modules.append(service); if( !dcopName.isEmpty() ) dcopName += "_"; dcopName += args->arg(i); } } /* Check if this particular module combination is already running, but * allow the same module to run when embedding(root mode) */ app.setDCOPName(dcopName, ( args->isSet( "embed-proxy" ) || args->isSet( "embed" ))); if( app.isRunning() ) { app.waitForExit(); return 0; } KDialogBase::DialogType dtype = KDialogBase::Plain; if ( modules.count() < 1 ) return 0; else if( modules.count() > 1 ) dtype = KDialogBase::IconList; bool idValid; int id; if ( args->isSet( "embed-proxy" )) { id = args->getOption( "embed-proxy" ).toInt(&idValid); if( idValid ) { KCModuleProxy *module = new KCModuleProxy( modules.first()->desktopEntryName() ); module->realModule(); QXEmbed::embedClientIntoWindow( module, id); app.exec(); delete module; } else kdDebug(780) << "Supplied id '" << id << "' is not valid." << endl; return 0; } KCMShellMultiDialog *dlg = new KCMShellMultiDialog( dtype, i18n("Configure - %1").arg(kapp->caption()), 0, "", true ); for (KService::List::ConstIterator it = modules.begin(); it != modules.end(); ++it) dlg->addModule(KCModuleInfo(*it)); if ( args->isSet( "embed" )) { id = args->getOption( "embed" ).toInt(&idValid); if( idValid ) { QXEmbed::embedClientIntoWindow( dlg, id ); dlg->exec(); delete dlg; } else kdDebug(780) << "Supplied id '" << id << "' is not valid." << endl; } else { if (kapp->iconName() != kapp->name()) setIcon(dlg, kapp->iconName()); else if ( modules.count() == 1 ) setIcon(dlg, KCModuleInfo( modules.first()).icon()); dlg->exec(); delete dlg; } return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/d559b6f93ec4f700e8475029369699be97d70c5b/main.cpp/clean/kcmshell/main.cpp
for( KService::List::ConstIterator it = m_modules.begin(); it != m_modules.end(); it++)
for( KService::List::ConstIterator it = m_modules.begin(); it != m_modules.end(); ++it)
extern "C" KDE_EXPORT int kdemain(int _argc, char *_argv[]){ KAboutData aboutData( "kcmshell", I18N_NOOP("KDE Control Module"), 0, I18N_NOOP("A tool to start single KDE control modules"), KAboutData::License_GPL, I18N_NOOP("(c) 1999-2004, The KDE Developers") ); aboutData.addAuthor("Frans Englich", I18N_NOOP("Maintainer"), "[email protected]"); aboutData.addAuthor("Daniel Molkentin", 0, "[email protected]"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); aboutData.addAuthor("Matthias Ettrich",0, "[email protected]"); aboutData.addAuthor("Waldo Bastian",0, "[email protected]"); KGlobal::locale()->setMainCatalogue("kcmshell"); KCmdLineArgs::init(_argc, _argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KCMShell app; const KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); const QCString lang = args->getOption("lang"); if( !lang.isNull() ) KGlobal::locale()->setLanguage(lang); if (args->isSet("list")) { cout << i18n("The following modules are available:").local8Bit() << endl; listModules( "Settings/" ); int maxLen=0; for( KService::List::ConstIterator it = m_modules.begin(); it != m_modules.end(); it++) { int len = (*it)->desktopEntryName().length(); if (len > maxLen) maxLen = len; } for( KService::List::ConstIterator it = m_modules.begin(); it != m_modules.end(); it++) { QString entry("%1 - %2"); entry = entry.arg((*it)->desktopEntryName().leftJustify(maxLen, ' ')) .arg(!(*it)->comment().isEmpty() ? (*it)->comment() : i18n("No description available")); cout << entry.local8Bit() << endl; } return 0; } if (args->count() < 1) { args->usage(); return -1; } QCString dcopName; KService::List modules; for (int i = 0; i < args->count(); i++) { KService::Ptr service = locateModule(args->arg(i)); if( service ) { modules.append(service); if( !dcopName.isEmpty() ) dcopName += "_"; dcopName += args->arg(i); } } /* Check if this particular module combination is already running, but * allow the same module to run when embedding(root mode) */ app.setDCOPName(dcopName, ( args->isSet( "embed-proxy" ) || args->isSet( "embed" ))); if( app.isRunning() ) { app.waitForExit(); return 0; } KDialogBase::DialogType dtype = KDialogBase::Plain; if ( modules.count() < 1 ) return 0; else if( modules.count() > 1 ) dtype = KDialogBase::IconList; bool idValid; int id; if ( args->isSet( "embed-proxy" )) { id = args->getOption( "embed-proxy" ).toInt(&idValid); if( idValid ) { KCModuleProxy *module = new KCModuleProxy( modules.first()->desktopEntryName() ); module->realModule(); QXEmbed::embedClientIntoWindow( module, id); app.exec(); delete module; } else kdDebug(780) << "Supplied id '" << id << "' is not valid." << endl; return 0; } KCMShellMultiDialog *dlg = new KCMShellMultiDialog( dtype, i18n("Configure - %1").arg(kapp->caption()), 0, "", true ); for (KService::List::ConstIterator it = modules.begin(); it != modules.end(); ++it) dlg->addModule(KCModuleInfo(*it)); if ( args->isSet( "embed" )) { id = args->getOption( "embed" ).toInt(&idValid); if( idValid ) { QXEmbed::embedClientIntoWindow( dlg, id ); dlg->exec(); delete dlg; } else kdDebug(780) << "Supplied id '" << id << "' is not valid." << endl; } else { if (kapp->iconName() != kapp->name()) setIcon(dlg, kapp->iconName()); else if ( modules.count() == 1 ) setIcon(dlg, KCModuleInfo( modules.first()).icon()); dlg->exec(); delete dlg; } return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/d559b6f93ec4f700e8475029369699be97d70c5b/main.cpp/clean/kcmshell/main.cpp
int kdemain( int argc, char **argv ){ KInstance instance( "kio_nfs" ); if (argc != 4) { fprintf(stderr, "Usage: kio_nfs protocol domain-socket1 domain-socket2\n"); exit(-1); } kdDebug(7101) << "NFS: kdemain: starting" << endl; NFSProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); kdDebug(7101) << "NFS: kdemain: Done" << endl; return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/39a40b82a2fc55ed7e977945ed4c332480807109/kio_nfs.cpp/clean/kioslave/nfs/kio_nfs.cpp
qgis->addProject(myProjectFileName);
if ( ! qgis->addProject(myProjectFileName) ) { #ifdef QGISDEBUG std::cerr << "unable to load project " << myProjectFileName << "\n"; #endif }
int main(int argc, char *argv[]){ ///////////////////////////////////////////////////////////////// // Command line options 'behaviour' flag setup //////////////////////////////////////////////////////////////// // // Parse the command line arguments, looking to see if the user has asked for any // special behaviours. Any remaining non command arguments will be kept aside to // be passed as a list of layers and / or a project that should be loaded. // // This behaviour is used to load the app, snapshot the map, // save the image to disk and then exit QString mySnapshotFileName=""; // This behaviour will cause QGIS to autoload a project QString myProjectFileName=""; // This behaviour will allow you to force the use of a translation file // which is useful for testing QString myTranslationFileName=""; // This is the 'leftover' arguments collection QStringList * myFileList=new QStringList(); //////////////////////////////////////////////////////////////// // USe the GNU Getopts utility to parse cli arguments // Invokes ctor `GetOpt (int argc, char **argv, char *optstring);' /////////////////////////////////////////////////////////////// int optionChar; while (1) { static struct option long_options[] = { /* These options set a flag. */ {"help", no_argument, 0, 'h'}, /* These options don't set a flag. * We distinguish them by their indices. */ {"snapshot", required_argument, 0, 's'}, {"lang", required_argument, 0, 'l'}, {"project", required_argument, 0, 'p'}, {0, 0, 0, 0} }; /* getopt_long stores the option index here. */ int option_index = 0; optionChar = getopt_long (argc, argv, "slp", long_options, &option_index); /* Detect the end of the options. */ if (optionChar == -1) break; switch (optionChar) { case 0: /* If this option set a flag, do nothing else now. */ if (long_options[option_index].flag != 0) break; printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case 's': mySnapshotFileName=optarg; break; case 'l': myTranslationFileName=optarg; break; case 'p': myProjectFileName=optarg; break; case 'h': case '?': usage( argv[0] ); return 2; // XXX need standard exit codes break; default: std::cerr << argv[0] << ": getopt returned character code " << optionChar << "\n"; return 1; // XXX need standard exit codes } } // Add any remaining args to the file list - we will attempt to load them // as layers in the map view further down....#ifdef QGISDEBUG std::cout << "Files specified on command line: " << optind << std::endl;#endif if (optind < argc) { while (optind < argc) {#ifdef QGISDEBUG int idx = optind; std::cout << idx << ": " << argv[idx] << std::endl;#endif myFileList->append(argv[optind++]); } } ///////////////////////////////////////////////////////////////////// // Now we have the handlers for the different behaviours... //////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // Initialise the application and the translation stuff ///////////////////////////////////////////////////////////////////// QApplication a(argc, argv); // a.setFont(QFont("helvetica", 11)); QTranslator tor(0); // set the location where your .qm files are in load() below as the last parameter instead of "." // for development, use "/" to use the english original as // .qm files are stored in the base project directory. if (myTranslationFileName!="") { QString translation = "qgis_" + myTranslationFileName; tor.load(translation, "."); } else { tor.load(QString("qgis_") + QTextCodec::locale(), "."); } //tor.load("qgis_go", "." ); a.installTranslator(&tor); /* uncomment the following line, if you want a Windows 95 look */ //a.setStyle("Windows"); QgisApp *qgis = new QgisApp(); // // Now we can instantiate the splashscreen global that is declared in qgisapp.h // a.setMainWidget(qgis); ///////////////////////////////////////////////////////////////////// // Load a project file if one was specified ///////////////////////////////////////////////////////////////////// if(myProjectFileName!="") { qgis->addProject(myProjectFileName); } ///////////////////////////////////////////////////////////////////// // autoload any filenames that were passed in on the command line /////////////////////////////////////////////////////////////////////#ifdef QGISDEBUG std::cout << "Number of files in myFileList: " << myFileList->count() << std::endl;#endif for ( QStringList::Iterator myIterator = myFileList->begin(); myIterator != myFileList->end(); ++myIterator ) {#ifdef QGISDEBUG std::cout << "Trying to load file : " << *myIterator << std::endl;#endif QString myLayerName = *myIterator; // try to add all these layers - any unsupported file types will // be rejected automatically // The funky bool ok is so this can be debugged a bit easier... //nope - try and load it as raster bool ok = qgis->addRasterLayer(myLayerName); if(!ok){ //nope - try and load it as a shape/ogr ok = qgis->addLayer(myLayerName); //we have no idea what this layer is... if(!ok){ std::cout << "Unable to load " << myLayerName << std::endl; } } } ///////////////////////////////////////////////////////////////////// // Take a snapshot of the map view then exit if snapshot mode requested ///////////////////////////////////////////////////////////////////// if(mySnapshotFileName!="") { // qgis->show(); QPixmap * myQPixmap = new QPixmap(800,600); myQPixmap->fill(); qgis->saveMapAsImage(mySnapshotFileName,myQPixmap); return 1; } ///////////////////////////////////////////////////////////////////// // Continue on to interactive gui... ///////////////////////////////////////////////////////////////////// qgis->show(); a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); return a.exec();}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/0de5bec56c7914309428749328d3227cd5aee3a1/main.cpp/buggy/src/main.cpp
app.exec();
return app.exec();
int main(int argc, char *argv[]){ KAboutData aboutData( "khelpcenter", I18N_NOOP("KDE HelpCenter"), HELPCENTER_VERSION, I18N_NOOP("The KDE Help Center"), KAboutData::License_GPL, "(c) 1999-2000, Matthias Elter"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); KCmdLineArgs::init( argc, argv, &aboutData ); KCmdLineArgs::addCmdLineOptions( options ); KApplication::addCmdLineOptions(); KApplication app( false, false ); // no GUI in this process app.dcopClient()->attach(); Listener listener; QCString dcopService; QString error; // try to connect to an already running konqueror, if one exists QCStringList apps = app.dcopClient()->registeredApplications(); QCStringList::ConstIterator it; for (it = apps.begin(); it != apps.end(); ++it) if ((*it).left(9) == "konqueror") { createHelpWindow(*it); return 0; } // run a new konqueror instance app.dcopClient()->setNotifications( true ); QObject::connect( app.dcopClient(), SIGNAL( applicationRegistered( const QCString& ) ), &listener, SLOT( slotAppRegistered( const QCString & ) ) ); if (app.startServiceByDesktopName("konqueror", QString::fromLatin1("--silent"), &error)) { warning("Could not launch browser:\n%s\n", error.local8Bit().data()); return 1; } app.exec();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/5e660832d8d3b39027122db161fd99eac26408a1/khc_main.cc/clean/khelpcenter/khc_main.cc
printf("\n Copyright (C) 1997, 1998 Matthias Ettrich ([email protected])\n"); printf("\n Utility to launch legay applications with special KDE window properties"); printf("\n such as iconified, maximized, a certain virtual desktop, a special decoration"); printf("\n or sticky"); printf("\n "); printf("\n In addition, the -activate switch will jump to the window even if it is"); printf("\n started on a different virtual desktop"); printf("\n "); printf("\n Usage:"); printf("\n %s <command> [-window <regular expression>] [-desktop <number>]", argv[0]); printf("\n [-sticky] [-iconify] [-maximize] "); printf("\n [-decoration tiny|none] [-activate]"); printf("\n "); printf("\n If you do not specify a regular expression for the windows title," ); printf("\n then the very first window to appear will be taken. Not recommended!"); printf("\n "); printf("\n Example usage:"); printf("\n %s \"xclock -geometry 80x80-0+0\" -window xclock -decoration tiny -sticky", argv[0]); printf("\n puts a tiny decorated, sticky xclock on the top right corner of the screen."); printf("\n "); printf("\n ");
printf(i18n( "\n Copyright (C) 1997, 1998 Matthias Ettrich ([email protected])\n" "\n Utility to launch legay applications with special KDE window properties" "\n such as iconified, maximized, a certain virtual desktop, a special decoration" "\n or sticky" "\n " "\n In addition, the -activate switch will jump to the window even if it is" "\n started on a different virtual desktop" "\n " "\n Usage:" "\n %s <command> [-window <regular expression>] [-desktop <number>]" "\n [-sticky] [-iconify] [-maximize] " "\n [-decoration tiny|none] [-activate]" "\n " "\n If you do not specify a regular expression for the windows title," "\n then the very first window to appear will be taken. Not recommended!" "\n " "\n Example usage:" "\n %s \"xclock -geometry 80x80-0+0\" -window xclock -decoration tiny -sticky" "\n puts a tiny decorated, sticky xclock on the top right corner of the screen." "\n " "\n "), argv[0], argv[0]);
int main( int argc, char *argv[] ){ if (argc <= 2) { printf(KSTART_VERSION); printf("\n Copyright (C) 1997, 1998 Matthias Ettrich ([email protected])\n"); printf("\n Utility to launch legay applications with special KDE window properties"); printf("\n such as iconified, maximized, a certain virtual desktop, a special decoration"); printf("\n or sticky"); printf("\n "); printf("\n In addition, the -activate switch will jump to the window even if it is"); printf("\n started on a different virtual desktop"); printf("\n "); printf("\n Usage:"); printf("\n %s <command> [-window <regular expression>] [-desktop <number>]", argv[0]); printf("\n [-sticky] [-iconify] [-maximize] "); printf("\n [-decoration tiny|none] [-activate]"); printf("\n "); printf("\n If you do not specify a regular expression for the windows title," ); printf("\n then the very first window to appear will be taken. Not recommended!"); printf("\n "); printf("\n Example usage:"); printf("\n %s \"xclock -geometry 80x80-0+0\" -window xclock -decoration tiny -sticky", argv[0]); printf("\n puts a tiny decorated, sticky xclock on the top right corner of the screen."); printf("\n "); printf("\n "); ::exit(0); } int desktop = 0; char* window = 0; bool activate = FALSE; bool maximize = FALSE; bool iconify = FALSE; bool sticky = FALSE; int decoration = KWM::normalDecoration; for (int i = 2; i < argc; i++) { if (!strcmp(argv[i],"-version")) { printf(KSTART_VERSION); printf("\n Copyright (C) 1997, 1998 Matthias Ettrich ([email protected])\n"); ::exit(0); } if (!strcmp(argv[i],"-window") && i+1 < argc) { window = argv[++i]; } if (!strcmp(argv[i],"-desktop") && i+1 < argc) { QString s = argv[++i]; desktop = s.toInt(); } if (!strcmp(argv[i],"-decoration") && i+1 < argc) { QString s = argv[++i]; if (s == "tiny") decoration = KWM::tinyDecoration; if (s == "none") decoration = KWM::noDecoration; } if (!strcmp(argv[i],"-activate") ) activate = true; if (!strcmp(argv[i],"-maximize") ) maximize = true; if (!strcmp(argv[i],"-iconify") ) iconify = true; if (!strcmp(argv[i],"-sticky") ) sticky = true; } KWMModuleApplication a (argc, argv); fcntl(ConnectionNumber(qt_xdisplay()), F_SETFD, 1); new KStart(&a, argv[1], window, desktop, activate, maximize, iconify, sticky, decoration); return a.exec();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/7bafe685e41d47a2a1846efaadbf6dd27f797ea8/kstart.C/clean/kstart/kstart.C
printf("\n Copyright (C) 1997, 1998 Matthias Ettrich ([email protected])\n");
printf(i18n("\n Copyright (C) 1997, 1998 Matthias Ettrich ([email protected])\n"));
int main( int argc, char *argv[] ){ if (argc <= 2) { printf(KSTART_VERSION); printf("\n Copyright (C) 1997, 1998 Matthias Ettrich ([email protected])\n"); printf("\n Utility to launch legay applications with special KDE window properties"); printf("\n such as iconified, maximized, a certain virtual desktop, a special decoration"); printf("\n or sticky"); printf("\n "); printf("\n In addition, the -activate switch will jump to the window even if it is"); printf("\n started on a different virtual desktop"); printf("\n "); printf("\n Usage:"); printf("\n %s <command> [-window <regular expression>] [-desktop <number>]", argv[0]); printf("\n [-sticky] [-iconify] [-maximize] "); printf("\n [-decoration tiny|none] [-activate]"); printf("\n "); printf("\n If you do not specify a regular expression for the windows title," ); printf("\n then the very first window to appear will be taken. Not recommended!"); printf("\n "); printf("\n Example usage:"); printf("\n %s \"xclock -geometry 80x80-0+0\" -window xclock -decoration tiny -sticky", argv[0]); printf("\n puts a tiny decorated, sticky xclock on the top right corner of the screen."); printf("\n "); printf("\n "); ::exit(0); } int desktop = 0; char* window = 0; bool activate = FALSE; bool maximize = FALSE; bool iconify = FALSE; bool sticky = FALSE; int decoration = KWM::normalDecoration; for (int i = 2; i < argc; i++) { if (!strcmp(argv[i],"-version")) { printf(KSTART_VERSION); printf("\n Copyright (C) 1997, 1998 Matthias Ettrich ([email protected])\n"); ::exit(0); } if (!strcmp(argv[i],"-window") && i+1 < argc) { window = argv[++i]; } if (!strcmp(argv[i],"-desktop") && i+1 < argc) { QString s = argv[++i]; desktop = s.toInt(); } if (!strcmp(argv[i],"-decoration") && i+1 < argc) { QString s = argv[++i]; if (s == "tiny") decoration = KWM::tinyDecoration; if (s == "none") decoration = KWM::noDecoration; } if (!strcmp(argv[i],"-activate") ) activate = true; if (!strcmp(argv[i],"-maximize") ) maximize = true; if (!strcmp(argv[i],"-iconify") ) iconify = true; if (!strcmp(argv[i],"-sticky") ) sticky = true; } KWMModuleApplication a (argc, argv); fcntl(ConnectionNumber(qt_xdisplay()), F_SETFD, 1); new KStart(&a, argv[1], window, desktop, activate, maximize, iconify, sticky, decoration); return a.exec();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/7bafe685e41d47a2a1846efaadbf6dd27f797ea8/kstart.C/clean/kstart/kstart.C
if (pw->pw_uid) { QString kdeHome = KGlobal::dirs()->relativeLocation("home", KGlobal::dirs()->localkdedir()); if (kdeHome[0] != '/') kdeHome.prepend("~/"); else kdeHome=QString::null; env << ("KDEHOME="+ QFile::encodeName(kdeHome)); }
int main(int argc, char *argv[]){ // FIXME: this can be considered a poor man's solution, as it's not // directly obvious to a gui user. :) // anyway, i vote against removing it even when we have a proper gui // implementation. -- ossi const char *duser = ::getenv("ADMIN_ACCOUNT"); if (duser && duser[0]) options[3].def = duser; KAboutData aboutData("kdesu", I18N_NOOP("KDE su"), Version, I18N_NOOP("Runs a program with elevated privileges."), KAboutData::License_Artistic, "Copyright (c) 1998-2000 Geert Jansen, Pietro Iglio"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Maintainer"), "[email protected]", "http://www.stack.nl/~geertj/"); aboutData.addAuthor("Pietro Iglio", I18N_NOOP("Original author"), "[email protected]"); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::addCmdLineOptions(options); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KApplication::disableAutoDcopRegistration(); KApplication *app = new KApplication; { KStartupInfoId id; id.initId( app->startupId()); id.setupStartupEnv(); // make KDE_STARTUP_ENV env. var. available again } // Stop daemon and exit? if (args->isSet("s")) { KDEsuClient client; if (client.ping() == -1) { kdError(1206) << "Daemon not running -- nothing to stop\n"; exit(1); } if (client.stopServer() != -1) { kdDebug(1206) << "Daemon stopped\n"; exit(0); } kdError(1206) << "Could not stop daemon\n"; exit(1); } // Get target uid QCString user = args->getOption("u"); QCString auth_user = user; struct passwd *pw = getpwnam(user); if (pw == 0L) { kdError(1206) << "User " << user << " does not exist\n"; exit(1); } bool change_uid = (getuid() != pw->pw_uid); // If file is writeable, do not change uid QString file = QFile::decodeName(args->getOption("f")); if (change_uid && !file.isEmpty()) { if (file.at(0) != '/') { KStandardDirs dirs; dirs.addKDEDefaults(); file = dirs.findResource("config", file); if (file.isEmpty()) { kdError(1206) << "Config file not found: " << file << "\n"; exit(1); } } QFileInfo fi(file); if (!fi.exists()) { kdError(1206) << "File does not exist: " << file << "\n"; exit(1); } change_uid = !fi.isWritable(); } // Get priority/scheduler QCString tmp = args->getOption("p"); bool ok; int priority = tmp.toInt(&ok); if (!ok || (priority < 0) || (priority > 100)) { KCmdLineArgs::usage(i18n("Illegal priority: %1").arg(tmp)); exit(1); } int scheduler = SuProcess::SchedNormal; if (args->isSet("r")) scheduler = SuProcess::SchedRealtime; if ((priority > 50) || (scheduler != SuProcess::SchedNormal)) { change_uid = true; auth_user = "root"; } // Get command if (args->isSet("c")) { command = args->getOption("c"); for (int i=0; i<args->count(); i++) { QString arg = QFile::decodeName(args->arg(i)); KRun::shellQuote(arg); command += " "; command += QFile::encodeName(arg); } } else { if( args->count() == 0 ) { KCmdLineArgs::usage(i18n("No command specified!")); exit(1); } command = args->arg(0); for (int i=1; i<args->count(); i++) { QString arg = QFile::decodeName(args->arg(i)); KRun::shellQuote(arg); command += " "; command += QFile::encodeName(arg); }}// CJM - Test lines remove when working// kdWarning(1206) << args->count();// kdWarning(1206) << command; // Don't change uid if we're don't need to. if (!change_uid) return system(command); // Check for daemon and start if necessary bool just_started = false; bool have_daemon = true; KDEsuClient client; if (!client.isServerSGID()) { kdWarning(1206) << "Daemon not safe (not sgid), not using it.\n"; have_daemon = false; } else if (client.ping() == -1) { if (client.startServer() == -1) { kdWarning(1206) << "Could not start daemon, reduced functionality.\n"; have_daemon = false; } just_started = true; } // Try to exec the command with kdesud. bool keep = !args->isSet("n") && have_daemon; bool terminal = args->isSet("t"); bool new_dcop = args->isSet("newdcop"); QCStringList env; QCString options; env << ( "KDE_STARTUP_ENV=" + kapp->startupId()); if (!new_dcop) { QCString ksycoca = "KDESYCOCA="+QFile::encodeName(locateLocal("tmp", "ksycoca")); env << ksycoca; options += "xf"; // X-only, dcop forwarding enabled. } if (keep && !terminal && !just_started) { client.setPriority(priority); client.setScheduler(scheduler); if (client.exec(command, user, options, env) != -1) return 0; } // Set core dump size to 0 because we will have // root's password in memory. struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim)) { kdError(1206) << "rlimit(): " << ERR << "\n"; exit(1); } // Read configuration KConfig *config = KGlobal::config(); config->setGroup("Passwords"); int timeout = config->readNumEntry("Timeout", defTimeout); // Check if we need a password SuProcess proc; proc.setUser(auth_user); int needpw = proc.checkNeedPassword(); if (needpw < 0) { QString err = i18n("Su returned with an error!\n"); KMessageBox::error(0L, err); exit(1); } if (needpw == 0) { keep = 0; kdDebug() << "Don't need password!!\n"; } // Start the dialog QCString password; if (needpw) { KStartupInfoId id; id.initId( app->startupId()); KStartupInfoData data; data.setSilent( KStartupInfoData::Yes ); KStartupInfo::sendChange( id, data ); KDEsuDialog dlg(user, auth_user, keep && !terminal); dlg.addLine(i18n("Command:"), command); if ((priority != 50) || (scheduler != SuProcess::SchedNormal)) { QString prio; if (scheduler == SuProcess::SchedRealtime) prio += i18n("realtime: "); prio += QString("%1/100").arg(priority); dlg.addLine(i18n("Priority:"), prio); } int ret = dlg.exec(); if (ret == KDEsuDialog::Rejected) { KStartupInfo::sendFinish( id ); exit(0); } if (ret == KDEsuDialog::AsUser) change_uid = false; password = dlg.password(); keep = dlg.keep(); data.setSilent( KStartupInfoData::No ); KStartupInfo::sendChange( id, data ); } // Some events may need to be handled (like a button animation) app->processEvents(); if (!change_uid) return system(command); // Run command if (keep && have_daemon) { client.setPass(password, timeout); client.setPriority(priority); client.setScheduler(scheduler); return client.exec(command, user, options, env); } else { SuProcess proc; proc.setTerminal(terminal); proc.setErase(true); proc.setUser(user); if (!new_dcop) { proc.setXOnly(true); proc.setDCOPForwarding(true); } proc.setEnvironment(env); proc.setPriority(priority); proc.setScheduler(scheduler); proc.setCommand(command); return proc.exec(password); }}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/f2abdd56ff6670f445add397e6cac3f7a3e9e30d/kdesu.cpp/buggy/kdesu/kdesu/kdesu.cpp
int main( int argc, char **argv )
int main( int , char ** )
int main( int argc, char **argv ){ signal (SIGCHLD, sig_handler); Connection parent( 0, 1 ); GZipProtocol prot( &parent ); prot.dispatchLoop(); while(1); return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/fd884f5ccde26ca363e9ebd3da6b8cbb9217cd51/gzip.cc/buggy/kioslave/gzip/gzip.cc
kdDebug() << "kcontrol is already running!\n" << endl;
kdDebug(1208) << "kcontrol is already running!\n" << endl;
int main(int argc, char *argv[]){ KAboutData aboutData( "kcontrol", I18N_NOOP("KDE Control Center"), "v2.0", I18N_NOOP("The KDE Control Center"), KAboutData::License_GPL, I18N_NOOP("(c) 1998-2000, The KDE Control Center Developers")); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); KCmdLineArgs::init( argc, argv, &aboutData ); KUniqueApplication::addCmdLineOptions(); KCGlobal::init(); if (!KControlApp::start()) { kdDebug() << "kcontrol is already running!\n" << endl; return (0); } KControlApp app; // show the whole stuff app.mainWidget()->show(); return app.exec();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/1358c70a9564cd327c27ff2fe7ae98d914f2e449/main.cpp/clean/kcontrol/kcontrol/main.cpp
debug( "kio_file : Starting");
qDebug( "kio_file : Starting");
int main( int , char ** ){ signal(SIGCHLD, sigchld_handler); signal(SIGSEGV, sigsegv_handler); debug( "kio_file : Starting"); Connection parent( 0, 1 ); FileProtocol file( &parent ); file.dispatchLoop(); debug( "kio_file : Done" );}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/e7b55f90a11e6a58320cf46832e286f420c30ae2/file.cc/buggy/kioslave/file/file.cc
debug( "kio_file : Done" );
qDebug( "kio_file : Done" );
int main( int , char ** ){ signal(SIGCHLD, sigchld_handler); signal(SIGSEGV, sigsegv_handler); debug( "kio_file : Starting"); Connection parent( 0, 1 ); FileProtocol file( &parent ); file.dispatchLoop(); debug( "kio_file : Done" );}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/e7b55f90a11e6a58320cf46832e286f420c30ae2/file.cc/buggy/kioslave/file/file.cc
if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kDebugPError("setrlimit()");
if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kdError(1205) << "setrlimit(): " << ERR << "\n";
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kDebugPError("setrlimit()"); exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kDebugPError("listen()"); kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kDebugPError("fork()"); kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kDebugPError("select()"); exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kDebugPError("accept()"); continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kDebugWarning("???");}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/78882f23290ccd305ca671ecb8ee7946692d879a/kdesud.cpp/clean/kdesu/kdesud/kdesud.cpp
if (listen(sockfd, 1) < 0) { kDebugPError("listen()");
if (listen(sockfd, 1) < 0) { kdError(1205) << "listen(): " << ERR << "\n";
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kDebugPError("setrlimit()"); exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kDebugPError("listen()"); kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kDebugPError("fork()"); kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kDebugPError("select()"); exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kDebugPError("accept()"); continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kDebugWarning("???");}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/78882f23290ccd305ca671ecb8ee7946692d879a/kdesud.cpp/clean/kdesu/kdesud/kdesud.cpp
if (pid == -1) { kDebugPError("fork()");
if (pid == -1) { kdError(1205) << "fork():" << ERR << "\n";
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kDebugPError("setrlimit()"); exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kDebugPError("listen()"); kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kDebugPError("fork()"); kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kDebugPError("select()"); exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kDebugPError("accept()"); continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kDebugWarning("???");}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/78882f23290ccd305ca671ecb8ee7946692d879a/kdesud.cpp/clean/kdesu/kdesud/kdesud.cpp
while (1) {
while (1) {
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kDebugPError("setrlimit()"); exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kDebugPError("listen()"); kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kDebugPError("fork()"); kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kDebugPError("select()"); exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kDebugPError("accept()"); continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kDebugWarning("???");}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/78882f23290ccd305ca671ecb8ee7946692d879a/kdesud.cpp/clean/kdesu/kdesud/kdesud.cpp
if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) {
if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) {
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kDebugPError("setrlimit()"); exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kDebugPError("listen()"); kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kDebugPError("fork()"); kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kDebugPError("select()"); exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kDebugPError("accept()"); continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kDebugWarning("???");}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/78882f23290ccd305ca671ecb8ee7946692d879a/kdesud.cpp/clean/kdesu/kdesud/kdesud.cpp
kDebugPError("select()");
kdError(1205) << "select(): " << ERR << "\n";
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kDebugPError("setrlimit()"); exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kDebugPError("listen()"); kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kDebugPError("fork()"); kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kDebugPError("select()"); exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kDebugPError("accept()"); continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kDebugWarning("???");}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/78882f23290ccd305ca671ecb8ee7946692d879a/kdesud.cpp/clean/kdesu/kdesud/kdesud.cpp
for (int i=0; i<=maxfd; i++) {
for (int i=0; i<=maxfd; i++) {
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kDebugPError("setrlimit()"); exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kDebugPError("listen()"); kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kDebugPError("fork()"); kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kDebugPError("select()"); exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kDebugPError("accept()"); continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kDebugWarning("???");}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/78882f23290ccd305ca671ecb8ee7946692d879a/kdesud.cpp/clean/kdesu/kdesud/kdesud.cpp
if (i == x11Fd) {
if (i == x11Fd) {
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kDebugPError("setrlimit()"); exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kDebugPError("listen()"); kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kDebugPError("fork()"); kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kDebugPError("select()"); exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kDebugPError("accept()"); continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kDebugWarning("???");}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/78882f23290ccd305ca671ecb8ee7946692d879a/kdesud.cpp/clean/kdesu/kdesud/kdesud.cpp
if (i == sockfd) {
if (i == sockfd) {
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kDebugPError("setrlimit()"); exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kDebugPError("listen()"); kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kDebugPError("fork()"); kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kDebugPError("select()"); exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kDebugPError("accept()"); continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kDebugWarning("???");}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/78882f23290ccd305ca671ecb8ee7946692d879a/kdesud.cpp/clean/kdesu/kdesud/kdesud.cpp
if (fd < 0) { kDebugPError("accept()");
if (fd < 0) { kdError(1205) << "accept():" << ERR << "\n";
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kDebugPError("setrlimit()"); exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kDebugPError("listen()"); kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kDebugPError("fork()"); kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kDebugPError("select()"); exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kDebugPError("accept()"); continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kDebugWarning("???");}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/78882f23290ccd305ca671ecb8ee7946692d879a/kdesud.cpp/clean/kdesu/kdesud/kdesud.cpp
if (handler[i]->handle() < 0) {
if (handler[i]->handle() < 0) {
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kDebugPError("setrlimit()"); exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kDebugPError("listen()"); kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kDebugPError("fork()"); kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kDebugPError("select()"); exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kDebugPError("accept()"); continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kDebugWarning("???");}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/78882f23290ccd305ca671ecb8ee7946692d879a/kdesud.cpp/clean/kdesu/kdesud/kdesud.cpp
kDebugWarning("???");
kdWarning(1205) << "???\n";
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kDebugPError("setrlimit()"); exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kDebugPError("listen()"); kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kDebugPError("fork()"); kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kDebugPError("select()"); exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kDebugPError("accept()"); continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kDebugWarning("???");}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/78882f23290ccd305ca671ecb8ee7946692d879a/kdesud.cpp/clean/kdesu/kdesud/kdesud.cpp
int main( int argc, char **argv )
int main( int, char ** )
int main( int argc, char **argv ){ signal(SIGCHLD, sigchld_handler); signal(SIGSEGV, sigsegv_handler); Connection parent( 0, 1 ); HTTPProtocol http( &parent ); http.dispatchLoop();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/fd884f5ccde26ca363e9ebd3da6b8cbb9217cd51/http.cc/buggy/kioslave/http/http.cc
kdebug( KDEBUG_INFO, 0, "Starting");
kdebug( KDEBUG_INFO, 7102, "Starting");
int main( int, char ** ){ signal(SIGCHLD, KIOProtocol::sigchld_handler); signal(SIGSEGV, KIOProtocol::sigsegv_handler); // KProtocolManager manager; KInstance instance( "kio_ftp" ); kdebug( KDEBUG_INFO, 0, "Starting"); KIOConnection parent( 0, 1 ); FtpProtocol ftp( &parent ); ftp.dispatchLoop(); kdebug( KDEBUG_INFO, 0, "Done");}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/7db0e5ae8586cd4e11b1ac073f99c697cb94bf71/main.cc/buggy/kioslave/ftp/main.cc
kdebug( KDEBUG_INFO, 0, "Done");
kdebug( KDEBUG_INFO, 7102, "Done");
int main( int, char ** ){ signal(SIGCHLD, KIOProtocol::sigchld_handler); signal(SIGSEGV, KIOProtocol::sigsegv_handler); // KProtocolManager manager; KInstance instance( "kio_ftp" ); kdebug( KDEBUG_INFO, 0, "Starting"); KIOConnection parent( 0, 1 ); FtpProtocol ftp( &parent ); ftp.dispatchLoop(); kdebug( KDEBUG_INFO, 0, "Done");}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/7db0e5ae8586cd4e11b1ac073f99c697cb94bf71/main.cc/buggy/kioslave/ftp/main.cc
Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen");
Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen");
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); KInstance instance(&aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kdError(1205) << "setrlimit(): " << ERR << "\n"; exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kdError(1205) << "listen(): " << ERR << "\n"; kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kdError(1205) << "fork():" << ERR << "\n"; kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QPtrVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kdError(1205) << "select(): " << ERR << "\n"; exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kdError(1205) << "accept():" << ERR << "\n"; continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i] && handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kdWarning(1205) << "???\n";}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a15fc46ae247aaa93909392ddc4ca7d2609ed34b/kdesud.cpp/buggy/kdesu/kdesud/kdesud.cpp
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); KInstance instance(&aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kdError(1205) << "setrlimit(): " << ERR << "\n"; exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kdError(1205) << "listen(): " << ERR << "\n"; kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kdError(1205) << "fork():" << ERR << "\n"; kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QPtrVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kdError(1205) << "select(): " << ERR << "\n"; exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kdError(1205) << "accept():" << ERR << "\n"; continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i] && handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kdWarning(1205) << "???\n";}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a15fc46ae247aaa93909392ddc4ca7d2609ed34b/kdesud.cpp/buggy/kdesu/kdesud/kdesud.cpp
kdError(1205) << "setrlimit(): " << ERR << "\n"; exit(1);
kdError(1205) << "setrlimit(): " << ERR << "\n"; exit(1);
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); KInstance instance(&aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kdError(1205) << "setrlimit(): " << ERR << "\n"; exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kdError(1205) << "listen(): " << ERR << "\n"; kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kdError(1205) << "fork():" << ERR << "\n"; kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QPtrVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kdError(1205) << "select(): " << ERR << "\n"; exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kdError(1205) << "accept():" << ERR << "\n"; continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i] && handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kdWarning(1205) << "???\n";}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a15fc46ae247aaa93909392ddc4ca7d2609ed34b/kdesud.cpp/buggy/kdesu/kdesud/kdesud.cpp
exit(1);
exit(1);
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); KInstance instance(&aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kdError(1205) << "setrlimit(): " << ERR << "\n"; exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kdError(1205) << "listen(): " << ERR << "\n"; kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kdError(1205) << "fork():" << ERR << "\n"; kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QPtrVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kdError(1205) << "select(): " << ERR << "\n"; exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kdError(1205) << "accept():" << ERR << "\n"; continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i] && handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kdWarning(1205) << "???\n";}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a15fc46ae247aaa93909392ddc4ca7d2609ed34b/kdesud.cpp/buggy/kdesu/kdesud/kdesud.cpp
kdError(1205) << "listen(): " << ERR << "\n"; kdesud_cleanup(); exit(1);
kdError(1205) << "listen(): " << ERR << "\n"; kdesud_cleanup(); exit(1);
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); KInstance instance(&aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kdError(1205) << "setrlimit(): " << ERR << "\n"; exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kdError(1205) << "listen(): " << ERR << "\n"; kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kdError(1205) << "fork():" << ERR << "\n"; kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QPtrVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kdError(1205) << "select(): " << ERR << "\n"; exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kdError(1205) << "accept():" << ERR << "\n"; continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i] && handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kdWarning(1205) << "???\n";}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a15fc46ae247aaa93909392ddc4ca7d2609ed34b/kdesud.cpp/buggy/kdesu/kdesud/kdesud.cpp
kdError(1205) << "fork():" << ERR << "\n"; kdesud_cleanup(); exit(1);
kdError(1205) << "fork():" << ERR << "\n"; kdesud_cleanup(); exit(1);
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); KInstance instance(&aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kdError(1205) << "setrlimit(): " << ERR << "\n"; exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kdError(1205) << "listen(): " << ERR << "\n"; kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kdError(1205) << "fork():" << ERR << "\n"; kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QPtrVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kdError(1205) << "select(): " << ERR << "\n"; exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kdError(1205) << "accept():" << ERR << "\n"; continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i] && handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kdWarning(1205) << "???\n";}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a15fc46ae247aaa93909392ddc4ca7d2609ed34b/kdesud.cpp/buggy/kdesu/kdesud/kdesud.cpp
exit(0);
exit(0);
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); KInstance instance(&aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kdError(1205) << "setrlimit(): " << ERR << "\n"; exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kdError(1205) << "listen(): " << ERR << "\n"; kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kdError(1205) << "fork():" << ERR << "\n"; kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QPtrVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kdError(1205) << "select(): " << ERR << "\n"; exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kdError(1205) << "accept():" << ERR << "\n"; continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i] && handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kdWarning(1205) << "???\n";}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a15fc46ae247aaa93909392ddc4ca7d2609ed34b/kdesud.cpp/buggy/kdesu/kdesud/kdesud.cpp
struct timeval tv;
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); KInstance instance(&aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kdError(1205) << "setrlimit(): " << ERR << "\n"; exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kdError(1205) << "listen(): " << ERR << "\n"; kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kdError(1205) << "fork():" << ERR << "\n"; kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QPtrVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kdError(1205) << "select(): " << ERR << "\n"; exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kdError(1205) << "accept():" << ERR << "\n"; continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i] && handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kdWarning(1205) << "???\n";}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a15fc46ae247aaa93909392ddc4ca7d2609ed34b/kdesud.cpp/buggy/kdesu/kdesud/kdesud.cpp
FD_SET(x11Fd, &active_fds);
FD_SET(x11Fd, &active_fds);
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); KInstance instance(&aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kdError(1205) << "setrlimit(): " << ERR << "\n"; exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kdError(1205) << "listen(): " << ERR << "\n"; kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kdError(1205) << "fork():" << ERR << "\n"; kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QPtrVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kdError(1205) << "select(): " << ERR << "\n"; exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kdError(1205) << "accept():" << ERR << "\n"; continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i] && handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kdWarning(1205) << "???\n";}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a15fc46ae247aaa93909392ddc4ca7d2609ed34b/kdesud.cpp/buggy/kdesu/kdesud/kdesud.cpp
tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kdError(1205) << "select(): " << ERR << "\n"; exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue;
tmp_fds = active_fds; if (select(maxfd+1, &tmp_fds, 0L, 0L, 0L) < 0) { if (errno == EINTR) continue; kdError(1205) << "select(): " << ERR << "\n"; exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue;
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); KInstance instance(&aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kdError(1205) << "setrlimit(): " << ERR << "\n"; exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kdError(1205) << "listen(): " << ERR << "\n"; kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kdError(1205) << "fork():" << ERR << "\n"; kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QPtrVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kdError(1205) << "select(): " << ERR << "\n"; exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kdError(1205) << "accept():" << ERR << "\n"; continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i] && handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kdWarning(1205) << "???\n";}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a15fc46ae247aaa93909392ddc4ca7d2609ed34b/kdesud.cpp/buggy/kdesu/kdesud/kdesud.cpp
if (i == x11Fd) { XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); }
if (i == pipeOfDeath[0]) { char buf[101]; read(pipeOfDeath[0], buf, 100); pid_t result; do { int status; result = waitpid((pid_t)-1, &status, WNOHANG); if (result > 0) { for(int j=handler.size(); j--;) { if (handler[j] && (handler[j]->m_pid == result)) { handler[j]->m_exitCode = WEXITSTATUS(status); handler[j]->m_hasExitCode = true; handler[j]->sendExitCode(); handler[j]->m_pid = 0; break; } } } } while(result > 0); }
int main(int argc, char *argv[]){ KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"), Version, I18N_NOOP("Daemon used by kdesu"), KAboutData::License_Artistic, "Copyright (c) 1999,2000 Geert Jansen"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Author"), "[email protected]", "http://www.stack.nl/~geertj/"); KCmdLineArgs::init(argc, argv, &aboutData); KInstance instance(&aboutData); // Set core dump size to 0 struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim) < 0) { kdError(1205) << "setrlimit(): " << ERR << "\n"; exit(1); } // Create the Unix socket. int sockfd = create_socket(); if (sockfd < 0) exit(1); if (listen(sockfd, 1) < 0) { kdError(1205) << "listen(): " << ERR << "\n"; kdesud_cleanup(); exit(1); } int maxfd = sockfd; // Ok, we're accepting connections. Fork to the background. pid_t pid = fork(); if (pid == -1) { kdError(1205) << "fork():" << ERR << "\n"; kdesud_cleanup(); exit(1); } if (pid) exit(0); // Make sure we exit when the display gets closed. int x11Fd = initXconnection(); maxfd = QMAX(maxfd, x11Fd); repo = new Repository; QPtrVector<ConnectionHandler> handler; handler.setAutoDelete(true); // Signal handlers struct sigaction sa; sa.sa_handler = signal_exit; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGHUP, &sa, 0L); sigaction(SIGINT, &sa, 0L); sigaction(SIGTERM, &sa, 0L); sigaction(SIGQUIT, &sa, 0L); sa.sa_handler = sigchld_handler; sa.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &sa, 0L); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0L); // Main execution loop ksize_t addrlen; struct sockaddr_un clientname; struct timeval tv; fd_set tmp_fds, active_fds; FD_ZERO(&active_fds); FD_SET(sockfd, &active_fds); if (x11Fd != -1) FD_SET(x11Fd, &active_fds); while (1) { tmp_fds = active_fds; tv.tv_sec = 5; tv.tv_usec = 0; if (select(maxfd+1, &tmp_fds, 0L, 0L, &tv) < 0) { if (errno == EINTR) continue; kdError(1205) << "select(): " << ERR << "\n"; exit(1); } repo->expire(); for (int i=0; i<=maxfd; i++) { if (!FD_ISSET(i, &tmp_fds)) continue; if (i == x11Fd) { // Discard X events XEvent event_return; if (x11Display) XNextEvent(x11Display, &event_return); } if (i == sockfd) { // Accept new connection int fd; addrlen = 64; fd = accept(sockfd, (struct sockaddr *) &clientname, &addrlen); if (fd < 0) { kdError(1205) << "accept():" << ERR << "\n"; continue; } if (fd+1 > (int) handler.size()) handler.resize(fd+1); handler.insert(fd, new ConnectionHandler(fd)); maxfd = QMAX(maxfd, fd); FD_SET(fd, &active_fds); continue; } // handle alreay established connection if (handler[i] && handler[i]->handle() < 0) { handler.remove(i); FD_CLR(i, &active_fds); } } } kdWarning(1205) << "???\n";}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a15fc46ae247aaa93909392ddc4ca7d2609ed34b/kdesud.cpp/buggy/kdesu/kdesud/kdesud.cpp