$NetBSD: patch-ab,v 1.3 2006/05/07 03:16:48 dsainty Exp $

Purge the unnecessary complication of PID_FORMAT, and add NetBSD support.  Use
OSS for sound for NetBSD, because the Sun support is a bit too Sun-centric.

--- xbsndsrv.c.orig	2005-03-09 06:27:15.000000000 +1300
+++ xbsndsrv.c	2006-05-06 19:09:29.000000000 +1200
@@ -44,9 +44,7 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 
-#ifdef __sun__
-/* format for pids on sun */
-#define PID_FORMAT "%lu"
+#if defined(__sun__)
 /* needed for bzero(), open()*/
 #include <strings.h>
 #include <fcntl.h>
@@ -58,8 +56,6 @@
 #include <sys/stropts.h>
 #endif
 #else
-/* format for pids, non-sun */
-#define PID_FORMAT "%u"
 /* non-sun audio includes */
-#ifdef __FreeBSD__
-#include <machine/soundcard.h>
+#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__)
+#include <sys/soundcard.h>
@@ -499,18 +495,18 @@
   ptr=fopen(userPath ,"r+");
   if(ptr==NULL){
     ptr=fopen(userPath ,"w+");
-    sprintf(tmp, PID_FORMAT, getpid());
+    sprintf(tmp, "%u", (unsigned int)getpid());
     fwrite(tmp,1,strlen(tmp),ptr);
     fclose(ptr);
     return 0;
 
   }
-  fscanf(ptr, PID_FORMAT, &pid);
-  fprintf(stderr," "PID_FORMAT" \n",pid);
+  fscanf(ptr, "%u", &pid);
+  fprintf(stderr," %u \n", pid);
   if(kill(pid,0)==-1 || pid<=0)
     {
       fseek(ptr,0,SEEK_SET);
-      sprintf(tmp, PID_FORMAT, getpid());
+      sprintf(tmp, "%u", (unsigned int)getpid());
       fwrite(tmp,1,strlen(tmp),ptr);
       fclose(ptr);
       return 0;
