New release: 0.4.0

This version adds support for FreeBSD and big-endian systems. It also
adds support for BSD disklabels and an assortment of other changes,
improvements, and bug fixes.
diff --git a/support.cc b/support.cc
index 1cef7d6..7ebec9a 100644
--- a/support.cc
+++ b/support.cc
@@ -3,6 +3,9 @@
 // Primarily by Rod Smith, February 2009, but with a few functions
 // copied from other sources (see attributions below).
 
+/* This program is copyright (c) 2009 by Roderick W. Smith. It is distributed
+  under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
+
 #define __STDC_LIMIT_MACROS
 #define __STDC_CONSTANT_MACROS
 
@@ -177,8 +180,12 @@
 #ifdef __APPLE__
    err = ioctl(fd, DKIOCGETBLOCKSIZE, &result);
 #else
+#ifdef __FreeBSD__
+   err = ioctl(fd, DIOCGSECTORSIZE, &result);
+#else
    err = ioctl(fd, BLKSSZGET, &result);
 #endif
+#endif
 
    if (result != 512) {
       printf("\aWARNING! Sector size is not 512 bytes! This program is likely to ");
@@ -319,15 +326,17 @@
 } // IsLittleEndian()
 
 // Reverse the byte order of theValue; numBytes is number of bytes
-void ReverseBytes(char* theValue, int numBytes) {
+void ReverseBytes(void* theValue, int numBytes) {
+   char* origValue;
    char* tempValue;
    int i;
 
+   origValue = (char*) theValue;
    tempValue = (char*) malloc(numBytes);
    for (i = 0; i < numBytes; i++)
-      tempValue[i] = theValue[i];
+      tempValue[i] = origValue[i];
    for (i = 0; i < numBytes; i++)
-      theValue[i] = tempValue[numBytes - i - 1];
+      origValue[i] = tempValue[numBytes - i - 1];
    free(tempValue);
 } // ReverseBytes()
 
@@ -345,6 +354,7 @@
    return retval;
 } // PowerOf2()
 
+
 /**************************************************************************************
  *                                                                                    *
  * Below functions are lifted from various sources, as documented in comments before  *
@@ -367,6 +377,11 @@
 #ifdef __APPLE__
 	*err = ioctl(fd, DKIOCGETBLOCKCOUNT, &sectors);
 #else
+#ifdef __FreeBSD__
+        *err = ioctl(fd, DIOCGMEDIASIZE, &sz);
+        b = GetBlockSize(fd);
+        sectors = sz / b;
+#else
 	*err = ioctl(fd, BLKGETSIZE, &sz);
 	if (*err) {
 		sz = 0;
@@ -379,5 +394,6 @@
 	else
 		sectors = (b >> 9);
 #endif
+#endif
 	return sectors;
 }