Subject: pkg/14431: KDE2 kfloppy doesn't work on NetBSD
To: None <gnats-bugs@gnats.netbsd.org>
From: Mark Davies <mark@mcs.vuw.ac.nz>
List: netbsd-bugs
Date: 11/02/2001 13:40:40
>Number:         14431
>Category:       pkg
>Synopsis:       KDE2 kfloppy doesn't work on NetBSD
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 01 16:41:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Mark Davies
>Release:        NetBSD 1.5Y 29/10/2001
>Organization:
Dept. of Comp. Sci., Victoria Uni. of Wellington, New Zealand.
>Environment:
	
	
System: NetBSD turakirae.mcs.vuw.ac.nz 1.5Y NetBSD 1.5Y (MCS_WORKSTATION) #1: Tue Oct 30 22:54:21 NZDT 2001 mark@turakirae.mcs.vuw.ac.nz:/src/work/src/sys/arch/i386/compile/MCS_WORKSTATION i386
Architecture: i386
Machine: i386
>Description:
	Following patch makes the KDE2 kfloppy (Floppy formatter)
	application work on NetBSD.

>How-To-Repeat:
	
>Fix:
	add the following as a patch in the kdeutils2 package


--- kfloppy/floppy.cpp~	Fri Jan 19 00:50:53 2001
+++ kfloppy/floppy.cpp	Thu Oct 25 00:14:21 2001
@@ -176,7 +176,9 @@
 	addDensity(i18n("HD"));	
 	addDensity(i18n("DD"));	
 	addFileSystem(i18n("Dos"));
+#ifndef __NetBSD__
 	addFileSystem(i18n("ext2fs"));
+#endif
 
 	readSettings();
 	setWidgets();
@@ -226,72 +228,120 @@
 {
   if( deviceComboBox->currentText() == FLOPPYA3 ){
     if( densityComboBox->currentText() == i18n( "HD")){
+#ifdef __NetBSD__
+      device = "/dev/rfd0b";
+      tracks = 160;
+#else
       device = "/dev/fd0H1440";
-      blocks = 1440;
       tracks = 80;
+#endif
+      blocks = 1440;
       //mdev = "/dev/fd0";
+#ifndef __NetBSD__
       if( access(QFile::encodeName(device),W_OK) < 0){
 	device = "/dev/fd0u1440";
       }
+#endif
     }
     else{
+#ifdef __NetBSD__
+      device = "/dev/rfd0f";
+      tracks = 160;
+#else
       device = "/dev/fd0D720";
-      blocks = 720;
       tracks = 80;
+#endif
+      blocks = 720;
       //mdev = "/dev/fd0";
+#ifndef __NetBSD__
       if( access(QFile::encodeName(device),W_OK) < 0){
 	device = "/dev/fd0u720";
       }
+#endif
     }
   }
 
   if( deviceComboBox->currentText() == FLOPPYA5){
     if( densityComboBox->currentText() == i18n( "HD")){
+#ifdef __NetBSD__
+      device = "/dev/rfd0c";
+      tracks = 160;
+#else
       device = "/dev/fd0h1200";
-      blocks = 1200;
       tracks = 80;
+#endif
+      blocks = 1200;
       //mdev = "/dev/fd0";
     }
     else{
+#ifdef __NetBSD__
+      device = "/dev/rfd0g";
+      tracks = 160;
+#else
       device = "/dev/fd0h360";
-      blocks = 720;
       tracks = 40;
+#endif
+      blocks = 720;
       //mdev = "/dev/fd0";
     }
   }
 
   if( deviceComboBox->currentText() == FLOPPYB3){
     if( densityComboBox->currentText() == i18n( "HD")){
+#ifdef __NetBSD__
+      device = "/dev/rfd1b";
+      tracks = 160;
+#else
       device = "/dev/fd1H1440";
-      blocks = 1400;
       tracks = 80;
+#endif
+      blocks = 1400;
       //mdev = "/dev/fd1";
+#ifndef __NetBSD__
       if(access(QFile::encodeName(device),W_OK) < 0){
 	device = "/dev/fd1u1440";
       }
+#endif
     }
     else{
+#ifdef __NetBSD__
+      device = "/dev/rfd1f";
+      tracks = 160;
+#else
       device = "/dev/fd1D720";
-      blocks = 720;
       tracks = 80;
+#endif
+      blocks = 720;
       //mdev = "/dev/fd1";
+#ifndef __NetBSD__
       if( access(QFile::encodeName(device),W_OK) < 0){
 	device = "/dev/fd1u720";
     }
+#endif
     }
   }
 
   if( deviceComboBox->currentText() == FLOPPYB5){
     if( densityComboBox->currentText() == i18n( "HD")){
+#ifdef __NetBSD__
+      device = "/dev/rfd1c";
+      tracks = 160;
+#else
       device = "/dev/fd1h1200";
-      blocks = 1200;
       tracks = 80;
+#endif
+      blocks = 1200;
       //mdev = "/dev/fd1";
     }
     else{
+#ifdef __NetBSD__
+      device = "/dev/rfd1g";
+      tracks = 160;
+#else
       device = "/dev/fd1h720";
-      blocks = 720;
       tracks = 80;
+#endif
+      blocks = 720;
       //mdev = "/dev/fd1";
     }
   }
@@ -318,16 +368,22 @@
   path.append(":/usr/sbin:/sbin");
  
   fdformat = KGlobal::dirs()->findExe("fdformat", path);
+#ifndef __NetBSD__
   mke2fs = KGlobal::dirs()->findExe("mke2fs", path);
   mkdosfs = KGlobal::dirs()->findExe("mkdosfs", path);
+#else
+  mkdosfs = KGlobal::dirs()->findExe("newfs_msdos", path);
+#endif
   QString str = "";
   if (fdformat.isEmpty()) {
     str = i18n("Cannot find fdformat.");
   }
 
+#ifndef __NetBSD__
   if (mke2fs.isEmpty()) {
     str = i18n("Cannot find mke2fs");
   }
+#endif
 
   if (mkdosfs.isEmpty()) {
     str = i18n("Cannot find mkdosfs");
@@ -406,6 +462,9 @@
   if (!verifylabel->isChecked()) {
     *proc << "-n";
   }
+#ifdef __NetBSD__
+  *proc << "-f";
+#endif
   *proc << device;
 
   connect(proc, SIGNAL(processExited(KProcess *)),this, SLOT(formatdone(KProcess*)));
@@ -423,6 +482,10 @@
     KMessageBox::error(this, str);
     reset();
   }
+
+#ifdef __NetBSD__
+  proc->writeStdin("y\n", 2);
+#endif
 }
 
 void FloppyData::formatdone(KProcess*){
@@ -728,12 +791,17 @@
 
         *proc << mkdosfs;
 	if(labellabel->isChecked())
+#ifdef __NetBSD__
+	  *proc << "-L" <<lineedit->text();
+#else
 	  *proc << "-n" <<lineedit->text();
         if (verifylabel->isChecked()) {
           *proc << "-c";
         }
+#endif
 	*proc << device;
   }
+#ifndef __NetBSD__
   else{
 
     *proc << mke2fs;
@@ -745,6 +813,7 @@
     }
     *proc << device;
   }
+#endif
 
 
 


cheers
mark
>Release-Note:
>Audit-Trail:
>Unformatted: