[PATCH] remove gnuisms from diff source

Rich Felker dalias at aerifal.cx
Thu May 18 17:50:11 PDT 2006


u_int is nonstandard bsd/gnuism and just shorthand
_PATH_DEVNULL is a gnuism and useless since /dev/null is the same
everywhere (and is required by posix)

both break compilation on my system. this patch fixes it and should
work everywhere.

rich

-------------- next part --------------
Index: coreutils/diff.c
===================================================================
--- coreutils/diff.c	(revision 15108)
+++ coreutils/diff.c	(working copy)
@@ -405,11 +405,11 @@
 {
         int i, k, y, j, l;
         int oldc, tc, oldl;
-        u_int numtries;
+        unsigned int numtries;
 #if ENABLE_FEATURE_DIFF_MINIMAL
-		const u_int bound = (cmd_flags & FLAG_d) ? UINT_MAX : MAX(256, isqrt(n));
+		const unsigned int bound = (cmd_flags & FLAG_d) ? UINT_MAX : MAX(256, isqrt(n));
 #else
-		const u_int bound = MAX(256, isqrt(n));
+		const unsigned int bound = MAX(256, isqrt(n));
 #endif
         k = 0;
         c[0] = newcand(0, 0, 0);
@@ -933,7 +933,7 @@
                 goto closem;
 
         if (flags & D_EMPTY1)
-                f1 = bb_xfopen(_PATH_DEVNULL, "r");
+                f1 = bb_xfopen("/dev/null", "r");
         else {
                 if (strcmp(file1, "-") == 0)
                         f1 = stdin;
@@ -942,7 +942,7 @@
         }
 
         if (flags & D_EMPTY2)
-                f2 = bb_xfopen(_PATH_DEVNULL, "r");
+                f2 = bb_xfopen("/dev/null", "r");
         else {
                 if (strcmp(file2, "-") == 0)
                         f2 = stdin;


More information about the busybox mailing list