Subject: cdparanoia update for default device
To: None <tech-pkg@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-pkg
Date: 06/25/2001 17:18:10
Anyone have any problems with the trailing patch for cdparanoia? The
reason I'm using the KERN_RAWPARTITION sysctl and not getrawpartition()
is laziness - I didn't want to figure out the makefile magic to add
-lutil.
Is that package meant to run on Solaris? If so, I'll change the last
part to something like:
#ifndef __linux__
#ifdef __NetBSD__
sysctl stuff
#else
if (!force_generic_device)
errx(1, "-g option is currently required by NetBSD version");
#endif
#endif
I also haven't looked to see if any doco needs changing.
Also note that this patch won't apply cleanly - I've deleted all the
diffs that only changed the offset of the existing changes to make
this email much shorter.
Simon.
--
Simon Burge <simonb@wasabisystems.com>
NetBSD CDs, Support and Service: http://www.wasabisystems.com/
Index: patches/patch-ae
===================================================================
RCS file: /cvsroot/pkgsrc/audio/cdparanoia/patches/patch-ae,v
retrieving revision 1.2
diff -d -p -u -r1.2 patch-ae
--- patches/patch-ae 2000/05/02 11:37:06 1.2
+++ patches/patch-ae 2001/06/25 07:12:24
@@ -1,8 +1,18 @@
-$NetBSD: patch-ae,v 1.2 2000/05/02 11:37:06 hubertf Exp $
+$NetBSD$
---- main.c.orig Tue Dec 14 17:18:44 1999
-+++ main.c Mon Jan 17 23:12:58 2000
-@@ -49,7 +49,9 @@
+--- main.c.orig Tue Dec 14 19:18:44 1999
++++ main.c Mon Jun 25 17:10:10 2001
+@@ -43,13 +43,19 @@
+ * Changes are becoming TNTC. Will resume the log at beta.
+ */
+
++#ifdef __NetBSD__
++#include <sys/param.h>
++#include <sys/sysctl.h>
++#endif
+ #include <stdio.h>
+ #include <stdarg.h>
+ #include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
@@ -106,14 +116,26 @@ $NetBSD: patch-ae,v 1.2 2000/05/02 11:37
switch(c){
case 'B':
batch=1;
-@@ -797,6 +847,13 @@
+@@ -797,6 +851,25 @@
report(VERSION);
/* Query the cdrom/disc; we may need to override some settings */
+
-+#ifndef __linux__ /* XXX */
-+ if (!force_generic_device)
-+ errx(1, "-g option is currently required by NetBSD version");
++#ifndef __linux__ /* XXX - ifdef __NetBSD__ ??? */
++ if (!force_generic_device) {
++ static char devstring[16];
++ int mib[2];
++ int part;
++ size_t size;
++
++ mib[0] = CTL_KERN;
++ mib[1] = KERN_RAWPARTITION;
++ size = sizeof(part);
++ if (sysctl(mib, 2, &part, &size, NULL, 0) < 0)
++ err(1, "Can't determine raw partition");
++ snprintf(devstring, sizeof(devstring), "/dev/rcd0%c", part + 'a');
++ force_generic_device=devstring;
++ }
+ if (!force_cdrom_device)
+ force_cdrom_device=copystring(force_generic_device);
+#endif