bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Small patch for findutils 4.1 on RedHat 6.2 and 7.2


From: Petter Reinholdtsen
Subject: Small patch for findutils 4.1 on RedHat 6.2 and 7.2
Date: Tue, 17 Sep 2002 14:18:27 +0200

The following patch get rid of compile errors and warnings when
compiling findutils v4.1 on RedHat 6.2 and 7.2.  The patch fixes two
problems.

 - The email address in README is broken.  It bounces with "unknown
   user".  I guessed on a new address and try again.

 - Avoid prototyping strdup() and strstr() when they are macros.  This
   fixes a compile error.

 - Make sure FNM_CASEFOLD is defined when including <fnmatch.h>.  The
   relevant section of <fnmatch.h> looks like this:

    #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
    # define FNM_FILE_NAME   FNM_PATHNAME/* Preferred GNU name.  */
    # define FNM_LEADING_DIR (1 << 3)    /* Ignore `/...' after a match.  */
    # define FNM_CASEFOLD    (1 << 4)    /* Compare without regard to case.  */
    # define FNM_EXTMATCH    (1 << 5)    /* Use ksh-like extended matching. */
    #endif

 - Avoid warning about non-int return type for main.

With this patch the source compiles without warnings.

diff -ur src-4.1/README src-4.1-local/README
--- src-4.1/README      1994-11-02 22:00:50.000000000 +0100
+++ src-4.1-local/README        2002-09-17 14:17:08.000000000 +0200
@@ -44,4 +44,4 @@
 yet, so don't worry about them.

 Mail suggestions and bug reports for these programs to
address@hidden
address@hidden
diff -ru src-4.1/find/fstype.c src-4.1-local/find/fstype.c
--- src-4.1/find/fstype.c       1994-11-03 17:33:48.000000000 +0100
+++ src-4.1-local/find/fstype.c 2002-09-17 14:03:01.000000000 +0200
@@ -30,8 +30,14 @@
 extern int errno;
 #endif
 
+#if !defined(strdup)
+/* Avoid making prototype if strdup() is a macro */
 char *strdup ();
+#endif /* not strdup */
+#if !defined(strstr)
+/* Avoid making prototype if strstr() is a macro */
 char *strstr ();
+#endif /* not strstr */
 
 static char *filesystem_type_uncached P_((char *path, char *relpath, struct 
stat *statp));
 static int xatoi P_((char *cp));
diff -ru src-4.1/find/parser.c src-4.1-local/find/parser.c
--- src-4.1/find/parser.c       1994-11-02 21:59:19.000000000 +0100
+++ src-4.1-local/find/parser.c 2002-09-17 14:03:01.000000000 +0200
@@ -52,7 +52,10 @@
 #define lstat stat
 #endif
 
+#if !defined(strstr)
+/* Avoid prototype if strstr() is a macro */
 char *strstr ();
+#endif /* not strstr */
 int lstat ();
 int stat ();
 #ifndef atol /* for Linux */
diff -ru src-4.1/find/pred.c src-4.1-local/find/pred.c
--- src-4.1/find/pred.c 1994-11-02 21:59:23.000000000 +0100
+++ src-4.1-local/find/pred.c   2002-09-17 14:03:01.000000000 +0200
@@ -19,6 +19,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stdio.h>
+#define _GNU_SOURCE /* To get FNM_CASEFOLD on Linux */
 #include <fnmatch.h>
 #include <signal.h>
 #include <pwd.h>
diff -ru src-4.1/lib/nextelem.c src-4.1-local/lib/nextelem.c
--- src-4.1/lib/nextelem.c      1994-09-27 14:02:45.000000000 +0100
+++ src-4.1-local/lib/nextelem.c        2002-09-17 14:03:01.000000000 +0200
@@ -32,7 +32,10 @@
 #endif
 #endif
 
+#if !defined(strdup)
+/* Avoid prototype if strdup is a macro */
 char *strdup ();
+#endif /* not strdup */
 void free ();
 
 /* Return the next element of a colon-separated path.
diff -ru src-4.1/xargs/xargs.c src-4.1-local/xargs/xargs.c
--- src-4.1/xargs/xargs.c       1994-10-07 18:21:39.000000000 +0100
+++ src-4.1-local/xargs/xargs.c 2002-09-17 14:03:01.000000000 +0200
@@ -60,8 +60,14 @@
 #define memcpy(dest, source, count) (bcopy((source), (dest), (count)))
 #endif
 
+#if !defined(strstr)
+/* Avoid prototype if strstr is a macro */
 char *strstr ();
+#endif /* not strstr */
+#if !defined(strdup)
+/* Avoid prototype if strdup is a macro */
 char *strdup ();
+#endif /* not strdup */
 
 #ifndef _POSIX_SOURCE
 #include <sys/param.h>
@@ -248,7 +254,7 @@
 static long env_size P_ ((char **envp));
 static void usage P_ ((FILE * stream, int status));
 
-void
+int
 main (argc, argv)
      int argc;
      char **argv;
@@ -414,7 +420,7 @@
     }
 
   wait_for_proc (true);
-  exit (child_error);
+  return (child_error);
 }
 
 /* Read a line of arguments from stdin and add them to the list of
diff -ru src-4.1/find/find.c src-4.1-local/find/find.c
--- src-4.1/find/find.c 1994-10-12 22:21:11.000000000 +0100
+++ src-4.1-local/find/find.c   2002-09-17 14:04:29.000000000 +0200
@@ -131,7 +131,7 @@
 }
 #endif /* DEBUG_STAT */
 
-void
+int
 main (argc, argv)
      int argc;
      char *argv[];
@@ -253,7 +253,7 @@
   if (i == 1)
     process_top_path (".");
 
-  exit (exit_status);
+  return (exit_status);
 }
 
 /* Descend PATHNAME, which is a command-line argument.  */
diff -ru src-4.1/locate/bigram.c src-4.1-local/locate/bigram.c
--- src-4.1/locate/bigram.c     1994-10-07 18:21:35.000000000 +0100
+++ src-4.1-local/locate/bigram.c       2002-09-17 14:05:56.000000000 +0200
@@ -61,7 +61,7 @@
   return s1 - start;
 }
 
-void
+int
 main (argc, argv)
      int argc;
      char **argv;
@@ -111,5 +111,5 @@
   free (path);
   free (oldpath);
 
-  exit (0);
+  return (0);
 }
diff -ru src-4.1/locate/code.c src-4.1-local/locate/code.c
--- src-4.1/locate/code.c       1994-09-26 23:06:09.000000000 +0100
+++ src-4.1-local/locate/code.c 2002-09-17 14:05:45.000000000 +0200
@@ -102,7 +102,7 @@
   return s1 - start;
 }
 
-void
+int
 main (argc, argv)
      int argc;
      char **argv;
@@ -124,7 +124,7 @@
     {
       fprintf (stderr, "Usage: %s most_common_bigrams < list > coded_list\n",
               argv[0]);
-      exit (2);
+      return (2);
     }
 
   fp = fopen (argv[1], "r");
@@ -132,7 +132,7 @@
     {
       fprintf (stderr, "%s: ", argv[0]);
       perror (argv[1]);
-      exit (1);
+      return (1);
     }
 
   pathsize = oldpathsize = 1026; /* Increased as necessary by getstr.  */
@@ -210,5 +210,5 @@
   free (path);
   free (oldpath);
 
-  exit (0);
+  return (0);
 }
diff -ru src-4.1/locate/frcode.c src-4.1-local/locate/frcode.c
--- src-4.1/locate/frcode.c     1994-09-26 23:06:11.000000000 +0100
+++ src-4.1-local/locate/frcode.c       2002-09-17 14:05:28.000000000 +0200
@@ -106,7 +106,7 @@
   return s1 - start;
 }
 
-void
+int
 main (argc, argv)
      int argc;
      char **argv;
@@ -166,5 +166,5 @@
   free (path);
   free (oldpath);
 
-  exit (0);
+  return (0);
 }
diff -ru src-4.1/locate/locate.c src-4.1-local/locate/locate.c
--- src-4.1/locate/locate.c     1994-09-26 23:06:14.000000000 +0100
+++ src-4.1-local/locate/locate.c       2002-09-17 14:05:09.000000000 +0200
@@ -355,7 +355,7 @@
   {NULL, no_argument, NULL, 0}
 };
 
-void
+int
 main (argc, argv)
      int argc;
      char **argv;
@@ -381,7 +381,7 @@
 
       case 'v':
        printf ("GNU locate version %s\n", version_string);
-       exit (0);
+       return (0);
 
       default:
        usage (stderr, 1);
@@ -398,5 +398,5 @@
        found |= locate (argv[optind], e);
     }
 
-  exit (!found);
+  return (!found);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]