$NetBSD: patch-ah,v 1.1.1.1 2012/05/02 04:43:11 agc Exp $

portability patches

--- flutelib/fdt_gen.c	2011/12/21 19:05:12	1.1
+++ flutelib/fdt_gen.c	2011/12/21 19:09:05
@@ -35,6 +35,7 @@
 #include <sys/stat.h>
 #include <string.h>
 #include <sys/types.h>
+#include <sys/param.h>
 
 #ifdef _MSC_VER
 #include <windows.h>
@@ -142,6 +143,8 @@
 
 #ifdef _MSC_VER
 	struct __stat64 file_stats;
+#elif (defined(BSD) && BSD >= 199506)
+	struct stat file_stats;
 #else
 	struct stat64 file_stats;
 #endif
@@ -159,6 +162,8 @@
 
 #ifdef _MSC_VER
 	struct __stat64 enc_file_stats;
+#elif (defined(BSD) && BSD >= 199506)
+	struct stat enc_file_stats;
 #else
 	struct stat64 enc_file_stats;
 #endif
@@ -200,6 +205,8 @@
 
 #ifdef _MSC_VER
 	if(_stat64(fullpath, &file_stats) == -1) {
+#elif (defined(BSD) && BSD >= 199506)
+	if(stat(fullpath, &file_stats) == -1) {
 #else
 	if(stat64(fullpath, &file_stats) == -1) {
 #endif
@@ -307,6 +314,8 @@
                 	strcat(enc_fullpath, GZ_SUFFIX);
 #ifdef _MSC_VER                                                                                                                                                      
                 	if(_stat64(enc_fullpath, &enc_file_stats) == -1) {
+#elif (defined(BSD) && BSD >= 199506)
+                	if(stat(enc_fullpath, &enc_file_stats) == -1) {
 #else
                 	if(stat64(enc_fullpath, &enc_file_stats) == -1) {
 #endif
@@ -439,6 +448,8 @@
 
 #ifdef _MSC_VER
 	struct __stat64 file_stats;
+#elif (defined(BSD) && BSD >= 199506)
+	struct stat file_stats;
 #else
 	struct stat64 file_stats;
 #endif
@@ -453,6 +464,8 @@
 	char enc_fullpath[MAX_PATH_LENGTH];
 #ifdef _MSC_VER
 	struct __stat64 enc_file_stats;
+#elif (defined(BSD) && BSD >= 199506)
+	struct stat enc_file_stats;
 #else
 	struct stat64 enc_file_stats;
 #endif
@@ -549,6 +562,8 @@
 
 #ifdef _MSC_VER
 			if(_stat64(fullpath, &file_stats) == -1) {
+#elif (defined(BSD) && BSD >= 199506)
+			if(stat(fullpath, &file_stats) == -1) {
 #else
 			if(stat64(fullpath, &file_stats) == -1) {
 #endif
@@ -632,6 +647,8 @@
 					strcat(enc_fullpath, GZ_SUFFIX);
 #ifdef _MSC_VER
 					if(_stat64(enc_fullpath, &enc_file_stats) == -1) {
+#elif (defined(BSD) && BSD >= 199506)
+					if(stat(enc_fullpath, &enc_file_stats) == -1) {
 #else
 					if(stat64(enc_fullpath, &enc_file_stats) == -1) {
 #endif
@@ -765,6 +782,8 @@
 
 #ifdef _MSC_VER
 			if(_stat64(fullpath, &file_stats) == -1) {
+#elif (defined(BSD) && BSD >= 199506)
+			if(stat(fullpath, &file_stats) == -1) {
 #else
 			if(stat64(fullpath, &file_stats) == -1) {
 #endif
@@ -831,6 +850,8 @@
 
 #ifdef _MSC_VER
 					if(_stat64(enc_fullpath, &enc_file_stats) == -1) {
+#elif (defined(BSD) && BSD >= 199506)
+					if(stat(enc_fullpath, &enc_file_stats) == -1) {
 #else
 					if(stat64(enc_fullpath, &enc_file_stats) == -1) {
 #endif
@@ -973,7 +994,11 @@
 
 		strcat(fullpath, fullname);
 
+#if (defined(BSD) && BSD >= 199506)
+		if(stat(fullpath, &file_stats) == -1) {
+#else
 		if(stat64(fullpath, &file_stats) == -1) {
+#endif
 			printf("Error: %s is not valid file name\n", fullpath);
 			fflush(stdout);
 			entry = readdir(dirptr);
@@ -1046,7 +1071,11 @@
 					strcpy(enc_fullpath, fullpath);
 					strcat(enc_fullpath, GZ_SUFFIX);
                                                                                                                                       
+#if (defined(BSD) && BSD >= 199506)
+					if(stat(enc_fullpath, &enc_file_stats) == -1) {
+#else
 					if(stat64(enc_fullpath, &enc_file_stats) == -1) {
+#endif
 						printf("Error: %s is not valid file name\n", enc_fullpath);
 						fflush(stdout);
 						entry = readdir(dirptr);
@@ -1158,6 +1187,8 @@
   
 #ifdef _MSC_VER
   struct __stat64 file_stats;
+#elif (defined(BSD) && BSD >= 199506)
+  struct stat file_stats;
 #else
   struct stat64 file_stats;
 #endif
@@ -1263,6 +1294,8 @@
     strcat(fullpath, token);
 #ifdef _MSC_VER
     if(_stat64(fullpath, &file_stats) == -1) {
+#elif (defined(BSD) && BSD >= 199506)
+    if(stat(fullpath, &file_stats) == -1) {
 #else
     if(stat64(fullpath, &file_stats) == -1) {
 #endif
