author | llornkcor <llornkcor> | 2002-07-10 18:41:34 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-07-10 18:41:34 (UTC) |
commit | 01b04adb73c8bc49938b71a4bebe6fb6a5477f75 (patch) (unidiff) | |
tree | 1d9ba49cf5937d04cf203064b64472ddfb04cc82 | |
parent | 729309f7875915b2617f99228b0a71464ecfe699 (diff) | |
download | opie-01b04adb73c8bc49938b71a4bebe6fb6a5477f75.zip opie-01b04adb73c8bc49938b71a4bebe6fb6a5477f75.tar.gz opie-01b04adb73c8bc49938b71a4bebe6fb6a5477f75.tar.bz2 |
make compilable again
-rw-r--r-- | noncore/tools/formatter/formatter.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp index 983459c..d52a4be 100644 --- a/noncore/tools/formatter/formatter.cpp +++ b/noncore/tools/formatter/formatter.cpp | |||
@@ -427,105 +427,105 @@ void FormatterApp::parsetab(const QString &fileName) { | |||
427 | fileSystemTypeList << deviceName+"::"+filesystemType; | 427 | fileSystemTypeList << deviceName+"::"+filesystemType; |
428 | } | 428 | } |
429 | } | 429 | } |
430 | } | 430 | } |
431 | endmntent( mntfp ); | 431 | endmntent( mntfp ); |
432 | // } else if(fileName == "/etc/fstab") { | 432 | // } else if(fileName == "/etc/fstab") { |
433 | // QFile f("/etc/fstab"); | 433 | // QFile f("/etc/fstab"); |
434 | // if ( f.open(IO_ReadOnly) ) { | 434 | // if ( f.open(IO_ReadOnly) ) { |
435 | // QTextStream t (&f); | 435 | // QTextStream t (&f); |
436 | // QString s; | 436 | // QString s; |
437 | // while (! t.eof()) { | 437 | // while (! t.eof()) { |
438 | // s=t.readLine(); | 438 | // s=t.readLine(); |
439 | // s=s.simplifyWhiteSpace(); | 439 | // s=s.simplifyWhiteSpace(); |
440 | // if ( (!s.isEmpty() ) && (s.find(" ")!=0) ) { | 440 | // if ( (!s.isEmpty() ) && (s.find(" ")!=0) ) { |
441 | // // = me->mnt_fsname; | 441 | // // = me->mnt_fsname; |
442 | // QString filesystemType = me->mnt_type; | 442 | // QString filesystemType = me->mnt_type; |
443 | // QString deviceName = s.left(0,s.find(BLANK) ); | 443 | // QString deviceName = s.left(0,s.find(BLANK) ); |
444 | // s=s.remove(0,s.find(BLANK)+1 ); // devicename | 444 | // s=s.remove(0,s.find(BLANK)+1 ); // devicename |
445 | 445 | ||
446 | // s=s.remove(0,s.find(BLANK)+1 ); // mountpoint | 446 | // s=s.remove(0,s.find(BLANK)+1 ); // mountpoint |
447 | // QStringt mountPoint= s.left(0,s.find(BLANK) ); | 447 | // QStringt mountPoint= s.left(0,s.find(BLANK) ); |
448 | // s=s.remove(0,s.find(BLANK)+1 ); // fs | 448 | // s=s.remove(0,s.find(BLANK)+1 ); // fs |
449 | // QString filesystemType= s.left(0,s.find(BLANK) ); | 449 | // QString filesystemType= s.left(0,s.find(BLANK) ); |
450 | // } | 450 | // } |
451 | // } | 451 | // } |
452 | // } | 452 | // } |
453 | // f.close(); | 453 | // f.close(); |
454 | // } | 454 | // } |
455 | } | 455 | } |
456 | 456 | ||
457 | QString FormatterApp::getFileSystemType(const QString ¤tText) { | 457 | QString FormatterApp::getFileSystemType(const QString ¤tText) { |
458 | 458 | ||
459 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 459 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
460 | 460 | ||
461 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { | 461 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { |
462 | QString temp = (*it); | 462 | QString temp = (*it); |
463 | if( temp.find( currentText,0,TRUE) != -1) { | 463 | if( temp.find( currentText,0,TRUE) != -1) { |
464 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 464 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
465 | // qDebug(fsType); | 465 | // qDebug(fsType); |
466 | } | 466 | } |
467 | } | 467 | } |
468 | return ""; | 468 | return ""; |
469 | } | 469 | } |
470 | 470 | ||
471 | bool FormatterApp::doFsck() { | 471 | bool FormatterApp::doFsck() { |
472 | 472 | ||
473 | Output *outDlg; | 473 | Output *outDlg; |
474 | QString selectedDevice; | 474 | QString selectedDevice; |
475 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) // lets test on something cheap | 475 | //f defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) // lets test on something cheap |
476 | selectedDevice = deviceComboBox->currentText(); | 476 | selectedDevice = deviceComboBox->currentText(); |
477 | #else | 477 | //#else |
478 | // currentText = diskDevice = "/dev/fd0"; | 478 | // currentText = diskDevice = "/dev/fd0"; |
479 | QString umountS = "umount -v /floppy 2>&1"; | 479 | QString umountS = "umount -v /floppy 2>&1"; |
480 | QString remountS = "mount -v /floppy 2>&1"; | 480 | QString remountS = "mount -v /floppy 2>&1"; |
481 | selectedDevice ="/dev/fd0"; | 481 | selectedDevice ="/dev/fd0"; |
482 | 482 | ||
483 | #endif | 483 | //#endif |
484 | 484 | ||
485 | QString fsType = getFileSystemType((const QString &)selectedDevice); | 485 | QString fsType = getFileSystemType((const QString &)selectedDevice); |
486 | QString cmd; | 486 | QString cmd; |
487 | qDebug( selectedDevice +" "+ fsType); | 487 | qDebug( selectedDevice +" "+ fsType); |
488 | if(fsType == "vfat") cmd = "dosfsck -vy "; | 488 | if(fsType == "vfat") cmd = "dosfsck -vy "; |
489 | if(fsType == "ext2") cmd = "e2fsck -cpvy "; | 489 | if(fsType == "ext2") cmd = "e2fsck -cpvy "; |
490 | cmd += selectedDevice + " 2>&1"; | 490 | cmd += selectedDevice + " 2>&1"; |
491 | 491 | ||
492 | outDlg = new Output(this, tr("Formatter Output"),FALSE); | 492 | outDlg = new Output(this, tr("Formatter Output"),FALSE); |
493 | outDlg->showMaximized(); | 493 | outDlg->showMaximized(); |
494 | outDlg->show(); | 494 | outDlg->show(); |
495 | qApp->processEvents(); | 495 | qApp->processEvents(); |
496 | FILE *fp; | 496 | FILE *fp; |
497 | char line[130]; | 497 | char line[130]; |
498 | outDlg->OutputEdit->append( tr("Trying to umount.")); | 498 | outDlg->OutputEdit->append( tr("Trying to umount.")); |
499 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 499 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
500 | 500 | ||
501 | sleep(1); | 501 | sleep(1); |
502 | // qDebug("Command is "+umountS); | 502 | // qDebug("Command is "+umountS); |
503 | fp = popen( (const char *) umountS, "r"); | 503 | fp = popen( (const char *) umountS, "r"); |
504 | // qDebug("%d", fp); | 504 | // qDebug("%d", fp); |
505 | if ( !fp ) { | 505 | if ( !fp ) { |
506 | qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); | 506 | qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); |
507 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); | 507 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); |
508 | pclose(fp); | 508 | pclose(fp); |
509 | return false; | 509 | return false; |
510 | } else { | 510 | } else { |
511 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); | 511 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); |
512 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 512 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
513 | while ( fgets( line, sizeof line, fp)) { | 513 | while ( fgets( line, sizeof line, fp)) { |
514 | if( ((QString)line).find("busy",0,TRUE) != -1) { | 514 | if( ((QString)line).find("busy",0,TRUE) != -1) { |
515 | qDebug("Could not find '" + umountS); | 515 | qDebug("Could not find '" + umountS); |
516 | QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); | 516 | QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); |
517 | pclose(fp); | 517 | pclose(fp); |
518 | return false; | 518 | return false; |
519 | } else { | 519 | } else { |
520 | QString lineStr = line; | 520 | QString lineStr = line; |
521 | lineStr=lineStr.left(lineStr.length()-1); | 521 | lineStr=lineStr.left(lineStr.length()-1); |
522 | outDlg->OutputEdit->append(lineStr); | 522 | outDlg->OutputEdit->append(lineStr); |
523 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 523 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
524 | } | 524 | } |
525 | } | 525 | } |
526 | } | 526 | } |
527 | pclose(fp); | 527 | pclose(fp); |
528 | ///////////////////////////////////// | 528 | ///////////////////////////////////// |
529 | fp = popen( (const char *) cmd, "r"); | 529 | fp = popen( (const char *) cmd, "r"); |
530 | while ( fgets( line, sizeof line, fp)) { | 530 | while ( fgets( line, sizeof line, fp)) { |
531 | if( ((QString)line).find("No such device",0,TRUE) != -1) { | 531 | if( ((QString)line).find("No such device",0,TRUE) != -1) { |