$NetBSD: patch-as,v 1.5 2006/09/22 18:58:59 joerg Exp $

--- yatd/dfree.c.orig	2001-07-09 03:32:52.000000000 +0000
+++ yatd/dfree.c
@@ -39,6 +39,13 @@ typedef u_long quota_size_t;
 # include <sys/quota.h>
 #endif /* HAVE_SYS_QUOTA_H */
 
+#ifdef __DragonFly__
+#include <sys/param.h>
+#if __DragonFly_version >= 160000
+#define dqblk ufs_dqblk
+#endif
+#endif
+
 static int 
 quotactl_wrapper __P((const char *pPath, struct dqblk *quota_block));
 static int 
@@ -72,12 +79,6 @@ quota_get_inode_current __P(( struct dqb
 
 #define DEBUG_LOCAL
 
-#ifndef LONGLONG_OPTC 
-/* LONGLONG_OPTCƤʤˤ ơ
-   ƥθҤȤƻȤ */
-#define LONGLONG_OPTC /* */
-#endif
-
 int DFreeCheck(pPath, pSizFree, pNodFree)
      char   * pPath;    /* 桼Υۡǥ쥯ȥΰ */
      OFF_T  * pSizFree; /* ֥å */
@@ -99,7 +100,7 @@ int DFreeCheck(pPath, pSizFree, pNodFree
   nodLimit = *pNodFree; /* ߥåȤΥΡɿꤹ */
 
 #ifdef DEBUG_LOCAL
-  LogDEBUG("sizLimit:%" LONGLONG_OPTC  "d, nodLimit:%d, sizof(OFF_T):%d", 
+  LogDEBUG("sizLimit:%" LONGLONG_OPTC  "d, nodLimit:%ld, sizof(OFF_T):%d", 
 	   sizLimit, nodLimit, sizeof (OFF_T));
 #endif /* DEBUG_LOCAL */
 
@@ -122,23 +123,30 @@ int DFreeCheck(pPath, pSizFree, pNodFree
 #ifdef DEBUG_LOCAL
 # ifdef BSD44 
   LogDEBUG("statfs() returns:");
+#  ifdef HAVE_STATVFS
+  LogDEBUG("  flags: 0x%lx", statfsBuf.f_flag);
+#  else
   LogDEBUG("  type: %d", statfsBuf.f_type);
-  LogDEBUG("  flags: 0x%x", statfsBuf.f_flags);
-#  ifdef __NetBSD__
+  LogDEBUG("  flags: 0x%lx", statfsBuf.f_flags);
+#   ifdef __NetBSD__
   LogDEBUG("  oflags: 0x%x", statfsBuf.f_oflags);
-#  endif
+#   endif /* __NetBSD__ */
+#  endif /* HAVE_STATVFS */
 #  ifdef BSDOS1
   LogDEBUG("  fsize: %d", statfsBuf.f_fsize);
 #  endif
-  LogDEBUG("  bsize: %d", statfsBuf.f_bsize);
-  LogDEBUG("  iosize: %d", statfsBuf.f_iosize);
-  LogDEBUG("  blocks: %d", statfsBuf.f_blocks);
-  LogDEBUG("  bfree: %d", statfsBuf.f_bfree);
-  LogDEBUG("  bavail: %d", statfsBuf.f_bavail);
-  LogDEBUG("  files: %d", statfsBuf.f_files);
-  LogDEBUG("  ffree: %d", statfsBuf.f_ffree);
-  LogDEBUG("  fsid: %d", statfsBuf.f_fsid);
-  LogDEBUG("  owner %d", statfsBuf.f_owner);
+  LogDEBUG("  bsize: %ld", statfsBuf.f_bsize);
+  LogDEBUG("  iosize: %ld", statfsBuf.f_iosize);
+  LogDEBUG("  blocks: %ld", statfsBuf.f_blocks);
+  LogDEBUG("  bfree: %ld", statfsBuf.f_bfree);
+  LogDEBUG("  bavail: %ld", statfsBuf.f_bavail);
+  LogDEBUG("  files: %ld", statfsBuf.f_files);
+  LogDEBUG("  ffree: %ld", statfsBuf.f_ffree);
+#  ifdef HAVE_STATVFS
+  LogDEBUG("  fsid: %d-%d", statfsBuf.f_fsidx.__fsid_val[0], statfsBuf.f_fsidx.__fsid_val[1]);
+#  else
+  LogDEBUG("  fsid: %d-%d", statfsBuf.f_fsid.val[0], statfsBuf.f_fsid.val[1]);
+#  endif /* HAVE_STATVFS */
 #ifdef STRUCT_STATFS_HAVE_F_FSTYPENAME
   LogDEBUG("  fstypename: %.256s", statfsBuf.f_fstypename);
 #endif
@@ -311,7 +319,7 @@ int FuncDFree()
   nodFree = SysData.nodLimitFree;
 
 #ifdef DEBUG_LOCAL
-    LogDEBUG("FuncDFree(): sizFree:%" LONGLONG_OPTC "d, nodFree:%d",
+    LogDEBUG("FuncDFree(): sizFree:%" LONGLONG_OPTC "d, nodFree:%ld",
 	     sizFree, nodFree);
 #endif
     
@@ -325,7 +333,7 @@ int FuncDFree()
     if (DFreeCheck(SysData.szUserFldrDir, &sizFree, &nodFree)){
       return FAILURE;
     }
-    Msg2Cli(SUCCESS, "%" LONGLONG_OPTC "d %d", sizFree, nodFree);
+    Msg2Cli(SUCCESS, "%" LONGLONG_OPTC "d %ld", sizFree, nodFree);
 #endif /* DONT_CHECKDFREE */
   return SUCCESS;
 }
@@ -427,7 +435,7 @@ static inline quota_size_t quota_get_ino
 
 #ifdef STRUCT_DQBLK_CURRENT_FILES
   retval = (quota_size_t)quota_block->dqb_curfiles;
-#endif STRUCT_DQBLK_CURRENT_FILES
+#endif /* STRUCT_DQBLK_CURRENT_FILES */
 
   return retval;
 }
@@ -449,12 +457,12 @@ static int quotactl_wrapper(pPath,quota_
   switch( status ){
   case SUCCESS:
     LogDEBUG("quotactl() returns:");
-    LogDEBUG(" bhardlimit: %d",quota_get_block_hard_limit(quota_block));
-    LogDEBUG(" bsoftlimit: %d",quota_get_block_soft_limit(quota_block));
-    LogDEBUG(" curblocks : %d",quota_get_block_current(quota_block));
-    LogDEBUG(" ihardlimit: %d",quota_get_inode_hard_limit(quota_block));
-    LogDEBUG(" isoftlimit: %d",quota_get_inode_soft_limit(quota_block));
-    LogDEBUG(" curinodes : %d", quota_get_inode_current(quota_block));
+    LogDEBUG(" bhardlimit: %ld",quota_get_block_hard_limit(quota_block));
+    LogDEBUG(" bsoftlimit: %ld",quota_get_block_soft_limit(quota_block));
+    LogDEBUG(" curblocks : %ld",quota_get_block_current(quota_block));
+    LogDEBUG(" ihardlimit: %ld",quota_get_inode_hard_limit(quota_block));
+    LogDEBUG(" isoftlimit: %ld",quota_get_inode_soft_limit(quota_block));
+    LogDEBUG(" curinodes : %ld", quota_get_inode_current(quota_block));
     return SUCCESS;
   case FAILURE:
     return FAILURE;
@@ -494,7 +502,7 @@ static int quotactl_systemcall_support( 
   status = quotactl(QCMD(Q_GETQUOTA, USRQUOTA),SysData.szMntFrom,
 		    SysData.pPwd->pw_uid, (caddr_t)quota_block);
   
-#elif defined(__bsdi__) || defined(__FreeBSD__) || defined(__NetBSD__)
+#elif defined(__bsdi__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
 
   /* Get disk quota limits and current usage for the user or group
      (as determined by the command type) with identifier id.  addr
