bug-findutils
[Top][All Lists]
Advanced

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

[PATCH 2/3] Use a consistent order for header-file inclusion.


From: James Youngman
Subject: [PATCH 2/3] Use a consistent order for header-file inclusion.
Date: Mon, 20 Jun 2011 10:37:12 +0100

* find/exec.c: Include config.h, then system headers followed by
gnulib headers and last, find-specific headers.
* find/find.c: Likewise.
* find/finddata.c: Likewise.
* find/fstype.c: Likewise.
* find/ftsfind.c: Likewise.
* find/parser.c: Likewise.
* find/pred.c: Likewise.
* find/tree.c: Likewise.
* find/util.c: Likewise.
* lib/buildcmd.c: Likewise.
* lib/dircallback.c: Likewise.
* lib/extendbuf.c: Likewise.
* lib/fdleak.c: Likewise.
* lib/findutils-version.c: Likewise.
* lib/listfile.c: Likewise.
* lib/printquoted.c: Likewise.
* lib/qmark.c: Likewise.
* lib/regexprops.c: Likewise.
* lib/regextype.c: Likewise.
* lib/safe-atoi.c: Likewise.
* lib/savedirinfo.c: Likewise.
* lib/splitstring.c: Likewise.
* lib/test_splitstring.c: Likewise.
* lib/waitpid.c: Likewise.
* locate/bigram.c: Likewise.
* locate/code.c: Likewise.
* locate/frcode.c: Likewise.
* locate/locate.c: Likewise.
* locate/word_io.c: Likewise.
* xargs/xargs.c: Likewise.
---
 ChangeLog               |   33 +++++++++++++++++++++
 find/exec.c             |   15 +++++----
 find/find.c             |   40 +++++++++++++++-----------
 find/finddata.c         |    8 ++++-
 find/fstype.c           |   59 +++++++++++++------------------------
 find/ftsfind.c          |   33 +++++++++++---------
 find/parser.c           |   53 +++++++++++++++++----------------
 find/pred.c             |   45 ++++++++++++++++------------
 find/sharefile.c        |   16 ++++++----
 find/tree.c             |    8 ++++-
 find/util.c             |   31 +++++++++++--------
 lib/buildcmd.c          |   44 ++++++++++++----------------
 lib/dircallback.c       |   13 +++++---
 lib/extendbuf.c         |    8 ++++-
 lib/fdleak.c            |   33 ++++++++++++---------
 lib/findutils-version.c |    6 ++++
 lib/listfile.c          |   30 ++++++++++---------
 lib/printquoted.c       |   11 ++++---
 lib/qmark.c             |    8 ++++-
 lib/regexprops.c        |   11 ++++--
 lib/regextype.c         |   14 +++++----
 lib/safe-atoi.c         |   12 +++++--
 lib/savedirinfo.c       |   23 ++++++++------
 lib/splitstring.c       |    7 ++++-
 lib/test_splitstring.c  |    7 ++++
 lib/waitpid.c           |    8 ++--
 locate/bigram.c         |   13 ++++++--
 locate/code.c           |   29 ++++++++++--------
 locate/frcode.c         |   33 +++++++++++----------
 locate/locate.c         |   73 +++++++++++++++++++++-------------------------
 locate/word_io.c        |   13 ++++++--
 xargs/xargs.c           |   64 ++++++++++++++++------------------------
 32 files changed, 446 insertions(+), 355 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a5cb978..0bd0196 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,38 @@
 2011-06-20  James Youngman  <address@hidden>
 
+       Use a consistent order for header-file inclusion.
+       * find/exec.c: Include config.h, then system headers followed by
+       gnulib headers and last, find-specific headers.
+       * find/find.c: Likewise.
+       * find/finddata.c: Likewise.
+       * find/fstype.c: Likewise.
+       * find/ftsfind.c: Likewise.
+       * find/parser.c: Likewise.
+       * find/pred.c: Likewise.
+       * find/tree.c: Likewise.
+       * find/util.c: Likewise.
+       * lib/buildcmd.c: Likewise.
+       * lib/dircallback.c: Likewise.
+       * lib/extendbuf.c: Likewise.
+       * lib/fdleak.c: Likewise.
+       * lib/findutils-version.c: Likewise.
+       * lib/listfile.c: Likewise.
+       * lib/printquoted.c: Likewise.
+       * lib/qmark.c: Likewise.
+       * lib/regexprops.c: Likewise.
+       * lib/regextype.c: Likewise.
+       * lib/safe-atoi.c: Likewise.
+       * lib/savedirinfo.c: Likewise.
+       * lib/splitstring.c: Likewise.
+       * lib/test_splitstring.c: Likewise.
+       * lib/waitpid.c: Likewise.
+       * locate/bigram.c: Likewise.
+       * locate/code.c: Likewise.
+       * locate/frcode.c: Likewise.
+       * locate/locate.c: Likewise.
+       * locate/word_io.c: Likewise.
+       * xargs/xargs.c: Likewise.
+
        Take gnulib-tool's advice about which header files to include.
        * locate/locate.c: Include <regex.h> instead of "regex.h".
        Include "fnmatch.h" instead of <fnmatch.h> (because we use
diff --git a/find/exec.c b/find/exec.c
index 927081a..b83131d 100644
--- a/find/exec.c
+++ b/find/exec.c
@@ -17,28 +17,29 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/* config.h must be included first. */
 #include <config.h>
 
-/* Normal POSIX headers (some of which are replaced by gnulib) */
-#include <fcntl.h>
-#include <errno.h>
+/* system headers. */
 #include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
 #include <signal.h>
 #include <sys/wait.h>
 
 
 /* gnulib headers */
-#include "error.h"
+#include "cloexec.h"
 #include "dirname.h"
+#include "error.h"
 #include "gettext.h"
-#include "xalloc.h"
-#include "cloexec.h"
 #include "save-cwd.h"
+#include "xalloc.h"
 
 /* findutils headers */
 #include "buildcmd.h"
-#include "fdleak.h"
 #include "defs.h"
+#include "fdleak.h"
 
 #if ENABLE_NLS
 # include <libintl.h>
diff --git a/find/find.c b/find/find.c
index c3e05c5..c34bd0e 100644
--- a/find/find.c
+++ b/find/find.c
@@ -24,35 +24,41 @@
    Improvements have been made by James Youngman <address@hidden>.
 */
 
-
+/* config.h must be included first. */
 #include <config.h>
-#include "defs.h"
-
-#undef  STAT_MOUNTPOINTS
-
 
-#include <errno.h>
+/* system headers. */
 #include <assert.h>
-
-#include <sys/stat.h>
+#include <errno.h>
 #include <fcntl.h>
 #include <locale.h>
+#include <sys/stat.h>
 
-#include "fcntl--.h"
-#include "xalloc.h"
-#include "human.h"
+/* gnulib headers. */
 #include "canonicalize.h"
-
 #include "closein.h"
-#include "savedirinfo.h"
-#include "buildcmd.h"
 #include "dirname.h"
-#include "gettext.h"
-#include "xgetcwd.h"
 #include "error.h"
-#include "fdleak.h"
+#include "fcntl--.h"
+#include "gettext.h"
+#include "human.h"
 #include "progname.h"
 #include "save-cwd.h"
+#include "xalloc.h"
+#include "xgetcwd.h"
+
+
+/* find headers. */
+#include "buildcmd.h"
+#include "defs.h"
+#include "fdleak.h"
+#include "savedirinfo.h"
+
+#undef  STAT_MOUNTPOINTS
+
+
+
+
 
 #if ENABLE_NLS
 # include <libintl.h>
diff --git a/find/finddata.c b/find/finddata.c
index b21a0b6..6ef91c6 100644
--- a/find/finddata.c
+++ b/find/finddata.c
@@ -16,11 +16,17 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/* config.h must be included first. */
 #include <config.h>
 
-#include "defs.h"
+/* system headers would go here, but we include none. */
+
+/* gnulib headers. */
 #include "save-cwd.h"
 
+/* find headers. */
+#include "defs.h"
+
 
 struct options options;
 struct state state;
diff --git a/find/fstype.c b/find/fstype.c
index 32a557a..a47b6d3 100644
--- a/find/fstype.c
+++ b/find/fstype.c
@@ -22,46 +22,42 @@
  * of manual hacking of configure.in).
  */
 
-
+/* config.h must be included first. */
 #include <config.h>
-#include <errno.h>
-#include <stdbool.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-/* The presence of unistd.h is assumed by gnulib these days, so we
- * might as well assume it too.
- */
-#include <unistd.h>
 
+/* system headers. */
+#include <errno.h>
 #include <fcntl.h>
-#ifdef HAVE_SYS_MNTIO_H
-#include <sys/mntio.h>
+#if HAVE_MNTENT_H
+# include <mntent.h>
 #endif
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
 #ifdef HAVE_SYS_MKDEV_H
-#include <sys/mkdev.h>
+# include <sys/mkdev.h>
 #endif
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#else
-extern int errno;
+#ifdef HAVE_SYS_MNTIO_H
+# include <sys/mntio.h>
+#endif
+#if HAVE_SYS_MNTTAB_H
+# include <sys/mnttab.h>
 #endif
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
 
-#include "defs.h"
+/* gnulib headers. */
 #include "dirname.h"
 #include "xalloc.h"
-
-/* Need declaration of function `xstrtoumax' */
 #include "xstrtol.h"
-
-#include "extendbuf.h"
 #include "mountlist.h"
 #include "error.h"
 #include "gettext.h"
 
-
+/* find headers. */
+#include "defs.h"
+#include "extendbuf.h"
 
 #if ENABLE_NLS
 # include <libintl.h>
@@ -79,19 +75,6 @@ extern int errno;
 static char *file_system_type_uncached (const struct stat *statp, const char 
*path);
 
 
-/* Get MNTTYPE_IGNORE if it is available. */
-#if HAVE_MNTENT_H
-# include <mntent.h>
-#endif
-#if HAVE_SYS_MNTTAB_H
-# include <stdio.h>
-# include <sys/mnttab.h>
-#endif
-
-
-
-
-
 static void
 free_file_system_list (struct mount_entry *p)
 {
diff --git a/find/ftsfind.c b/find/ftsfind.c
index dcb81ca..cce2f40 100644
--- a/find/ftsfind.c
+++ b/find/ftsfind.c
@@ -26,37 +26,40 @@
    Dan Bernstein <address@hidden>.
 */
 
-
+/* config.h must always be included first. */
 #include <config.h>
-#include "defs.h"
-
-
-#define USE_SAFE_CHDIR 1
-#undef  STAT_MOUNTPOINTS
 
 
-#include <errno.h>
+/* system headers. */
 #include <assert.h>
-#include <locale.h>
-#include <inttypes.h>
-
+#include <errno.h>
 #include <fcntl.h>
+#include <inttypes.h>
+#include <locale.h>
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "progname.h"
+/* gnulib headers. */
+#include "cloexec.h"
 #include "closeout.h"
-#include "quotearg.h"
+#include "error.h"
 #include "fts_.h"
+#include "gettext.h"
+#include "progname.h"
+#include "quotearg.h"
 #include "save-cwd.h"
 #include "xgetcwd.h"
-#include "error.h"
+
+/* find headers. */
+#include "defs.h"
 #include "dircallback.h"
-#include "cloexec.h"
 #include "fdleak.h"
-#include "gettext.h"
 #include "unused-result.h"
 
+#define USE_SAFE_CHDIR 1
+#undef  STAT_MOUNTPOINTS
+
+
 #if ENABLE_NLS
 # include <libintl.h>
 # define _(Text) gettext (Text)
diff --git a/find/parser.c b/find/parser.c
index 6a04e51..184e4e6 100644
--- a/find/parser.c
+++ b/find/parser.c
@@ -17,48 +17,49 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/* config.h must always come first. */
 #include <config.h>
 
-#include "defs.h"
-#include <ctype.h>
-#include <math.h>
+/* system headers. */
 #include <assert.h>
-#include <pwd.h>
+#include <ctype.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <grp.h>
-#include <sys/stat.h>
+#include <math.h>
+#include <pwd.h>
 #include <regex.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+
+/* gnulib headers. */
+#include "error.h"
 #include "fnmatch.h"
-#include "mountlist.h"
+#include "fts_.h"
+#include "gettext.h"
 #include "modechange.h"
-#include "xstrtol.h"
-#include "xalloc.h"
+#include "mountlist.h"
+#include "parse-datetime.h"
+#include "print.h"
 #include "quotearg.h"
-#include "buildcmd.h"
 #include "regextype.h"
-#include "stat-time.h"
-#include "xstrtod.h"
-#include "fts_.h"
-#include "parse-datetime.h"
-#include "error.h"
-#include "gettext.h"
-#include "findutils-version.h"
 #include "safe-atoi.h"
-#include "fdleak.h"
+#include "selinux-at.h"
 #include "splitstring.h"
-#include "print.h"
+#include "stat-time.h"
+#include "xalloc.h"
+#include "xstrtod.h"
+#include "xstrtol.h"
 
-#include <fcntl.h>
+/* find headers. */
+#include "buildcmd.h"
+#include "defs.h"
+#include "fdleak.h"
+#include "findutils-version.h"
 
 
-/* The presence of unistd.h is assumed by gnulib these days, so we
- * might as well assume it too.
- */
-/* We need <unistd.h> for isatty(). */
-#include <unistd.h>
-#include <sys/stat.h>
 
-#include "selinux-at.h"
 
 #if ENABLE_NLS
 # include <libintl.h>
diff --git a/find/pred.c b/find/pred.c
index 9f5b8a4..88dacd9 100644
--- a/find/pred.c
+++ b/find/pred.c
@@ -16,36 +16,43 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/* config.h always comes first. */
 #include <config.h>
-#include "defs.h"
 
-#include <math.h>
-#include <pwd.h>
-#include <grp.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
+/* system headers. */
 #include <assert.h>
-#include <stdarg.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <errno.h>
 #include <fcntl.h>
+#include <grp.h>
 #include <locale.h>
-#include <ctype.h>
-#include <unistd.h> /* for unlinkat() */
+#include <math.h>
+#include <pwd.h>
+#include <selinux/selinux.h>
+#include <stdarg.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 #include <sys/wait.h>
-#include <dirent.h>
+#include <unistd.h> /* for unlinkat() */
+
+/* gnulib headers. */
+#include "areadlink.h"
 #include "dirname.h"
-#include "printquoted.h"
-#include "yesno.h"
-#include "listfile.h"
-#include "stat-time.h"
-#include "stat-size.h"
-#include "dircallback.h"
 #include "error.h"
 #include "fnmatch.h"
 #include "gettext.h"
-#include "areadlink.h"
+#include "stat-size.h"
+#include "stat-time.h"
+#include "yesno.h"
+
+/* find headers. */
+#include "defs.h"
+#include "dircallback.h"
+#include "listfile.h"
+#include "printquoted.h"
+
 
-#include <selinux/selinux.h>
 
 #if ENABLE_NLS
 # include <libintl.h>
diff --git a/find/sharefile.c b/find/sharefile.c
index 890a0c2..8120dff 100644
--- a/find/sharefile.c
+++ b/find/sharefile.c
@@ -15,20 +15,24 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-
+/* config.h always comes first. */
 #include <config.h>
 
+/* system headers. */
+#include <assert.h>
 #include <errno.h>
-#include <string.h>
 #include <stdlib.h>
-#include <assert.h>
-#include <sys/types.h>
+#include <string.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 
-#include "stdio-safer.h"
+/* gnulib headers. */
+#include "cloexec.h"
 #include "hash.h"
+#include "stdio-safer.h"
+
+/* find headers. */
 #include "sharefile.h"
-#include "cloexec.h"
 #include "defs.h"
 
 
diff --git a/find/tree.c b/find/tree.c
index d525b31..7502fd5 100644
--- a/find/tree.c
+++ b/find/tree.c
@@ -16,17 +16,21 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/* config.h must always come first. */
 #include <config.h>
-#include "defs.h"
 
+/* system headers. */
 #include <assert.h>
 #include <stdlib.h>
 
-#include "xalloc.h"
+/* gnulib headers. */
 #include "error.h"
 #include "fnmatch.h"
 #include "gettext.h"
+#include "xalloc.h"
 
+/* find headers. */
+#include "defs.h"
 
 #if ENABLE_NLS
 # include <libintl.h>
diff --git a/find/util.c b/find/util.c
index b59e703..94e9549 100644
--- a/find/util.c
+++ b/find/util.c
@@ -16,29 +16,34 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/* config.h must always come first. */
 #include <config.h>
-#include "defs.h"
 
-#include <fcntl.h>
-#include <sys/utsname.h>
-#include <sys/time.h>
-#include <sys/stat.h> /* for fstatat() */
+/* system headers. */
+#include <assert.h>
 #include <ctype.h>
-#include <string.h>
-#include <limits.h>
 #include <errno.h>
-#include <assert.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <string.h>
+#include <sys/stat.h> /* for fstatat() */
+#include <sys/time.h>
+#include <sys/utsname.h>
 
+/* gnulib headers. */
+#include "error.h"
+#include "fdleak.h"
+#include "gettext.h"
 #include "progname.h"
 #include "quotearg.h"
+#include "save-cwd.h"
 #include "timespec.h"
-#include "error.h"
-#include "gettext.h"
 #include "verify.h"
-#include "fdleak.h"
-#include "dircallback.h"
 #include "xalloc.h"
-#include "save-cwd.h"
+
+/* find headers. */
+#include "defs.h"
+#include "dircallback.h"
 
 
 #if ENABLE_NLS
diff --git a/lib/buildcmd.c b/lib/buildcmd.c
index 15bb91f..eb46486 100644
--- a/lib/buildcmd.c
+++ b/lib/buildcmd.c
@@ -15,17 +15,32 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
-
+/* config.h must be included first. */
 #include <config.h>
 
+/* system headers. */
+#include <assert.h>
+#include <errno.h>
+#include <error.h>
+#include <limits.h>
+#include <locale.h>
+#include <openat.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
+#ifndef _POSIX_SOURCE
+# include <sys/param.h>
+#endif
+#include <unistd.h>
 #include <wchar.h>
-#include <locale.h>
-#include <stdbool.h>
-#include <limits.h>
+#include <xalloc.h>
 
+/* gnulib headers. */
 #include "gettext.h"
+#include "xstrtol.h"
+
+/* find headers. */
+#include "buildcmd.h"
 
 #if ENABLE_NLS
 # include <libintl.h>
@@ -42,20 +57,8 @@
 # define N_(String) String
 #endif
 
-/* The presence of unistd.h is assumed by gnulib these days, so we
- * might as well assume it too.
- */
-/* for sysconf() */
-#include <unistd.h>
-#include <assert.h>
-
 /* COMPAT:  SYSV version defaults size (and has a max value of) to 470.
    We try to make it as large as possible.  See bc_get_arg_max() below. */
-
-
-#ifndef _POSIX_SOURCE
-#include <sys/param.h>
-#endif
 #if defined NCARGS && !defined ARG_MAX
 /* We include sys/param.h in order to detect this case. */
 #error "You have an unusual system.  Once you remove this error message from 
buildcmd.c, it should work, but please make sure that DejaGnu is installed on 
your system and that 'make check' passes before using the findutils programs.  
Please mail address@hidden to tell us about your system."
@@ -63,15 +66,6 @@
 #endif
 
 
-#include <xalloc.h>
-#include <errno.h>
-#include <error.h>
-#include <openat.h>
-
-#include "xstrtol.h"
-#include "buildcmd.h"
-
-
 static const char *special_terminating_arg = "do_not_care";
 
 
diff --git a/lib/dircallback.c b/lib/dircallback.c
index bc9d6b9..c982a0a 100644
--- a/lib/dircallback.c
+++ b/lib/dircallback.c
@@ -19,19 +19,22 @@
 /* This file was written by James Youngman, based on gnulib'c at-func.c.
  */
 
-
+/* config.h must be included first. */
 #include <config.h>
 
-#include "dircallback.h"
-#include "openat.h"
-#include <stdarg.h>
+/* system headers. */
 #include <errno.h>
-#include <sys/stat.h>
 #include <locale.h>
+#include <stdarg.h>
+#include <sys/stat.h>
 
+/* gnulib headers. */
 #include "fcntl--.h"
+#include "openat.h"
 #include "save-cwd.h"
 
+/* find headers. */
+#include "dircallback.h"
 
 int
 run_in_dir (const struct saved_cwd *there,
diff --git a/lib/extendbuf.c b/lib/extendbuf.c
index df9c6c1..f9ece71 100644
--- a/lib/extendbuf.c
+++ b/lib/extendbuf.c
@@ -17,14 +17,18 @@
 */
 /* Written by James Yougnman <address@hidden>. */
 
+/* config.h must be included first. */
 #include <config.h>
 
-
-#include <stdlib.h>
+/* system headers. */
 #include <assert.h>
 #include <errno.h>
+#include <stdlib.h>
 
+/* gnulib headers. */
 #include "xalloc.h"
+
+/* find headers. */
 #include "extendbuf.h"
 
 
diff --git a/lib/fdleak.c b/lib/fdleak.c
index 42ee7c2..c22d299 100644
--- a/lib/fdleak.c
+++ b/lib/fdleak.c
@@ -14,29 +14,34 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
-
+/* config.h must be included first. */
 #include <config.h>
-#include <unistd.h>
-#include <poll.h>
+
+/* system headers. */
+#include <assert.h>
 #include <fcntl.h>
-#if defined HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
 #include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include <poll.h>
 #include <stdarg.h>
-#include <assert.h>
 #include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#if defined HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+#include <unistd.h>
 
-#include "fcntl--.h"
-#include "dirent-safer.h"
-#include "extendbuf.h"
+/* gnulib headers. */
 #include "cloexec.h"
+#include "dirent-safer.h"
+#include "error.h"
+#include "fcntl--.h"
 #include "gettext.h"
-#include "safe-atoi.h"
+
+/* find headers. */
+#include "extendbuf.h"
 #include "fdleak.h"
-#include "error.h"
+#include "safe-atoi.h"
 
 #if ENABLE_NLS
 # include <libintl.h>
diff --git a/lib/findutils-version.c b/lib/findutils-version.c
index d37b247..9704f95 100644
--- a/lib/findutils-version.c
+++ b/lib/findutils-version.c
@@ -15,10 +15,16 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/* config.h must be included first. */
 #include <config.h>
 
+/* system headers would go here if we needed any. */
+
+/* gnulib headers. */
 #include "gettext.h"
 #include "version-etc.h"
+
+/* find headers. */
 #include "findutils-version.h"
 
 #if ENABLE_NLS
diff --git a/lib/listfile.c b/lib/listfile.c
index 48d8cb2..a548bc5 100644
--- a/lib/listfile.c
+++ b/lib/listfile.c
@@ -15,33 +15,35 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
-
+/* config.h must be included first. */
 #include <config.h>
 
+/* system headers. */
 #include <alloca.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <pwd.h>
-#include <grp.h>
-#include <time.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <grp.h>
+#include <locale.h>
+#include <openat.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <time.h>
 #include <unistd.h> /* for readlink() */
-#include <openat.h>
-#include <locale.h>
 
-#include "human.h"
-#include "pathmax.h"
+/* gnulib headers. */
+#include "areadlink.h"
 #include "error.h"
 #include "filemode.h"
+#include "human.h"
 #include "idcache.h"
-#include "areadlink.h"
+#include "pathmax.h"
 #include "stat-size.h"
 
+/* find headers. */
 #include "listfile.h"
 
 /* Since major is a function on SVR4, we can't use `ifndef major'.  */
diff --git a/lib/printquoted.c b/lib/printquoted.c
index fb1f5b1..ddc09e4 100644
--- a/lib/printquoted.c
+++ b/lib/printquoted.c
@@ -16,17 +16,18 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
-
+/* config.h must be included first. */
 #include <config.h>
 
-
-#include <stdlib.h>
+/* system headers. */
 #include <stdio.h>
+#include <stdlib.h>
 
-
+/* gnulib headers. */
 #include "xalloc.h"
-#include "printquoted.h"
 
+/* find headers. */
+#include "printquoted.h"
 
 /*
  * Print S according to the format FORMAT, but if the destination is a tty,
diff --git a/lib/qmark.c b/lib/qmark.c
index d7d567c..2e7cd89 100644
--- a/lib/qmark.c
+++ b/lib/qmark.c
@@ -18,14 +18,18 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
-
+/* config.h must be included first. */
 #include <config.h>
 
-#include <stdlib.h>
+/* system headers. */
 #include <ctype.h>
+#include <stdlib.h>
 #include <string.h>
 #include <wchar.h>
 
+/* gnulib headers would go here if any needed to be included. */
+
+/* find headers. */
 #include "printquoted.h"
 
 
diff --git a/lib/regexprops.c b/lib/regexprops.c
index c0a8e0c..6270403 100644
--- a/lib/regexprops.c
+++ b/lib/regexprops.c
@@ -26,18 +26,21 @@
 
 /* Written by James Youngman, <address@hidden>. */
 
+/* config.h must be included first. */
 #include <config.h>
 
-
+/* system headers */
+#include <errno.h>
+#include <regex.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
-#include <errno.h>
-#include <regex.h>
 
-#include "regextype.h"
+/* gnulib headers */
 #include "progname.h"
 
+/* find headers */
+#include "regextype.h"
 
 static void
 output (const char *s, int escape)
diff --git a/lib/regextype.c b/lib/regextype.c
index 35106e5..352ffd4 100644
--- a/lib/regextype.c
+++ b/lib/regextype.c
@@ -19,19 +19,21 @@
 */
 /* Written by James Youngman, <address@hidden>. */
 
-# include <config.h>
+/* config.h must be included first. */
+#include <config.h>
 
+/* system headers. */
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
 
+/* gnulib headers. */
+#include "error.h"
 #include "gettext.h"
-#include "regextype.h"
-#include "regex.h"
 #include "quote.h"
+#include "regex.h"
+#include "regextype.h"
 #include "xalloc.h"
-#include "error.h"
 
 
 #if ENABLE_NLS
diff --git a/lib/safe-atoi.c b/lib/safe-atoi.c
index 9e08ab2..45e64e9 100644
--- a/lib/safe-atoi.c
+++ b/lib/safe-atoi.c
@@ -14,17 +14,21 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
-
+/* config.h must be included first. */
 #include <config.h>
+
+/* system headers. */
+#include <errno.h>
 #include <limits.h>
 #include <stdlib.h>
-#include <errno.h>
 
+/* gnulib headers. */
+#include "error.h"
 #include "gettext.h"
-#include "safe-atoi.h"
 #include "quotearg.h"
-#include "error.h"
 
+/* find headers. */
+#include "safe-atoi.h"
 
 #if ENABLE_NLS
 # include <libintl.h>
diff --git a/lib/savedirinfo.c b/lib/savedirinfo.c
index 505276a..0d4b346 100644
--- a/lib/savedirinfo.c
+++ b/lib/savedirinfo.c
@@ -19,14 +19,25 @@
 /* Written by James Youngman, <address@hidden>. */
 /* Derived from savedir.c, written by David MacKenzie <address@hidden>. */
 
+/* config.h must be included first. */
 #include <config.h>
 
+/* system headers. */
+#include <dirent.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <errno.h>
-#include <dirent.h>
 
+/* gnulib headers. */
+#include "dirent-safer.h"
+#include "xalloc.h"
+
+/* find headers. */
+#include "extendbuf.h"
+#include "savedirinfo.h"
 
 #ifdef CLOSEDIR_VOID
 /* Fake a return value. */
@@ -35,14 +46,6 @@
 # define CLOSEDIR(d) closedir (d)
 #endif
 
-#include <stdlib.h>
-#include <string.h>
-
-#include "xalloc.h"
-#include "extendbuf.h"
-#include "dirent-safer.h"
-#include "savedirinfo.h"
-
 #if defined HAVE_STRUCT_DIRENT_D_TYPE
 /* Convert the value of struct dirent.d_type into a value for
  * struct stat.st_mode (at least the file type bits), or zero
diff --git a/lib/splitstring.c b/lib/splitstring.c
index e706d9c..6874b33 100644
--- a/lib/splitstring.c
+++ b/lib/splitstring.c
@@ -17,11 +17,16 @@
 /*
  * Written by James Youngman.
  */
-
+/* config.h must be included first. */
 #include <config.h>
+
+/* system headers. */
 #include <stdbool.h>
 #include <string.h>
 
+/* gnulib headers would go here. */
+
+/* find headers. */
 #include "splitstring.h"
 
 static size_t
diff --git a/lib/test_splitstring.c b/lib/test_splitstring.c
index 9dedb7c..639a5bf 100644
--- a/lib/test_splitstring.c
+++ b/lib/test_splitstring.c
@@ -14,10 +14,17 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/* config.h must always be included first. */
 #include <config.h>
+
+/* system headers. */
 #include <stdio.h>
 #include <assert.h>
 
+/* gnulib headers would go here. */
+
+/* find headers. */
 #include "splitstring.h"
 
 static void
diff --git a/lib/waitpid.c b/lib/waitpid.c
index 4a4625f..1d63fbd 100644
--- a/lib/waitpid.c
+++ b/lib/waitpid.c
@@ -15,15 +15,15 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
-#include <config.h>
 
+/* config.h must always be included first. */
+#include <config.h>
 
+/* system headers. */
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 
+/* TODO: replace this with gnulib's waitpid. */
 #if defined _MSC_VER || defined __MINGW32__
 /* Native Woe32 API.  */
 #include <process.h>
diff --git a/locate/bigram.c b/locate/bigram.c
index 03bc47b..f60903f 100644
--- a/locate/bigram.c
+++ b/locate/bigram.c
@@ -30,19 +30,24 @@
    Written by James A. Woods <address@hidden>.
    Modified by David MacKenzie <address@hidden>.  */
 
+/* config.h must always be included first. */
 #include <config.h>
+
+/* system headers. */
 #include <stdio.h>
 #include <locale.h>
-
 #include <string.h>
 #include <stdlib.h>
-
 #include <sys/types.h>
 
-#include <xalloc.h>
+/* gnulib headers. */
+#include "closeout.h"
 #include "gettext.h"
 #include "progname.h"
-#include "closeout.h"
+#include "xalloc.h"
+
+/* find headers would go here but we don't need any. */
+
 
 /* We use gettext because for example xmalloc may issue an error message. */
 #if ENABLE_NLS
diff --git a/locate/code.c b/locate/code.c
index 48cc581..6588d5e 100644
--- a/locate/code.c
+++ b/locate/code.c
@@ -44,17 +44,27 @@
    Written by James A. Woods <address@hidden>.
    Modified by David MacKenzie <address@hidden>.  */
 
+/* config.h should always be included first. */
 #include <config.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <string.h>
+
+/* system headers. */
 #include <errno.h>
 #include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
 
+/* gnulib headers. */
+#include "closeout.h"
+#include "error.h"
+#include "gettext.h"
+#include "progname.h"
+#include "xalloc.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
+/* find headers. */
+#include "findutils-version.h"
+#include "locatedb.h"
 
 #if ENABLE_NLS
 # include <libintl.h>
@@ -71,13 +81,6 @@
 # define N_(String) String
 #endif
 
-#include "locatedb.h"
-#include "closeout.h"
-#include "gettext.h"
-#include "xalloc.h"
-#include "progname.h"
-#include "error.h"
-#include "findutils-version.h"
 
 #ifndef ATTRIBUTE_NORETURN
 # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
diff --git a/locate/frcode.c b/locate/frcode.c
index 0cca9db..35075c7 100644
--- a/locate/frcode.c
+++ b/locate/frcode.c
@@ -63,18 +63,30 @@
    Modified by James Youngman <address@hidden>.
 */
 
+/* config.h must be included first. */
 #include <config.h>
 
-
-#include <stdio.h>
-#include <limits.h>
+/* system headers. */
 #include <assert.h>
 #include <errno.h>
-#include <sys/types.h>
+#include <getopt.h>
+#include <limits.h>
 #include <stdbool.h>
-#include <string.h>
+#include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
 
+/* gnulib headers. */
+#include "closeout.h"
+#include "error.h"
+#include "gettext.h"
+#include "progname.h"
+#include "xalloc.h"
+
+/* find headers. */
+#include "findutils-version.h"
+#include "locatedb.h"
 
 #if ENABLE_NLS
 # include <libintl.h>
@@ -98,17 +110,6 @@
 #endif
 
 
-#include "gettext.h"
-#include "locatedb.h"
-#include <getopt.h>
-#include "error.h"
-#include "closeout.h"
-#include "findutils-version.h"
-#include "xalloc.h"
-#include "progname.h"
-
-
-
 /* Write out a 16-bit int, high byte first (network byte order).
  * Return true iff all went well.
  */
diff --git a/locate/locate.c b/locate/locate.c
index a1a0078..db90ce2 100644
--- a/locate/locate.c
+++ b/locate/locate.c
@@ -58,40 +58,48 @@
    Additional work by James Youngman and Bas van Gompel.
 */
 
+/* config.h must be included first. */
 #include <config.h>
 
-#include <stdio.h>
-#include <signal.h>
+#define NDEBUG
+
+/* system headers. */
+#include <assert.h>
 #include <ctype.h>
-#include <sys/types.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
 #include <grp.h>                /* for setgroups() */
+#include <locale.h>
+#include <regex.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 #include <time.h>
-#include <getopt.h>
-#include <xstrtol.h>
-
-#include <stdbool.h>
-
-/* The presence of unistd.h is assumed by gnulib these days, so we
- * might as well assume it too.
- */
-/* We need <unistd.h> for isatty(). */
 #include <unistd.h>
+#include <xstrtol.h>
 
-#include <fcntl.h>
-
-#define NDEBUG
-#include <assert.h>
-#include <string.h>
-
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
+/* gnulib headers. */
+#include "fnmatch.h"
+#include "gettext.h"
+#include "progname.h"
+#include "xalloc.h"
+#include "error.h"
+#include "human.h"
+#include "dirname.h"
+#include "closeout.h"
+#include "quotearg.h"
+#include "regextype.h"
 
-#include <errno.h>
-#include <locale.h>
-#include <regex.h>
+/* find headers. */
+#include "findutils-version.h"
+#include "locatedb.h"
+#include "printquoted.h"
+#include "splitstring.h"
 
 
 #if ENABLE_NLS
@@ -116,21 +124,6 @@
 # define N_(String) String
 #endif
 
-#include "fnmatch.h"
-#include "gettext.h"
-#include "locatedb.h"
-#include "progname.h"
-#include "xalloc.h"
-#include "error.h"
-#include "human.h"
-#include "dirname.h"
-#include "closeout.h"
-#include "quotearg.h"
-#include "printquoted.h"
-#include "regextype.h"
-#include "splitstring.h"
-#include "findutils-version.h"
-
 /* Note that this evaluates Ch many times.  */
 #ifdef _LIBC
 # define TOUPPER(Ch) toupper (Ch)
diff --git a/locate/word_io.c b/locate/word_io.c
index 4bb297c..6e92f01 100644
--- a/locate/word_io.c
+++ b/locate/word_io.c
@@ -15,19 +15,24 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/* config.h must be included first. */
 #include <config.h>
 
-#include <string.h>
-#include <stdio.h>
+/* system headers. */
+#include <assert.h>
 #include <errno.h>
 #include <stdbool.h>           /* for bool */
-#include <assert.h>
+#include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
+/* gnulib headers. */
+#include "byteswap.h"
 #include "error.h"
 #include "gettext.h"
 #include "quotearg.h"
-#include "byteswap.h"
+
+/* find headers. */
 #include "locatedb.h"
 
 #if ENABLE_NLS
diff --git a/xargs/xargs.c b/xargs/xargs.c
index 0c59c6d..fbdde6e 100644
--- a/xargs/xargs.c
+++ b/xargs/xargs.c
@@ -23,46 +23,40 @@
        Dmitry V. Levin
 */
 
+/* config.h must be included first. */
 #include <config.h>
 
+/* system headers. */
+#include <assert.h>
 #include <ctype.h>
-#include <stdio.h>
 #include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <inttypes.h>
 #include <limits.h>
+#include <locale.h>
+#include <signal.h>
 #include <stdint.h>
-#include <inttypes.h>
-
-#include <sys/types.h>
-#include <getopt.h>
-#include <fcntl.h>
-#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
-
-#ifndef LONG_MAX
-#define LONG_MAX (~(1 << (sizeof (long) * 8 - 1)))
-#endif
-
-#define ISBLANK(c) (isascii (c) && isblank (c))
-#define ISSPACE(c) (ISBLANK (c) || (c) == '\n' || (c) == '\r' \
-                   || (c) == '\f' || (c) == '\v')
-
-/* The presence of unistd.h is assumed by gnulib these days, so we
- * might as well assume it too.
- */
-#include <unistd.h>
-#include <signal.h>
+#include <sys/types.h>
 #include <sys/wait.h>
-#include <stdlib.h>
-#include <locale.h>
+#include <unistd.h>
 #include <wchar.h>
-#include <stdint.h>
 
+/* gnulib headers. */
+#include "closein.h"
+#include "error.h"
 #include "gettext.h"
-#include "verify.h"
 #include "progname.h"
 #include "quotearg.h"
-#include "findutils-version.h"
+#include "verify.h"
+#include "xalloc.h"
 
+/* find headers. */
+#include "buildcmd.h"
+#include "findutils-version.h"
 
 #if ENABLE_NLS
 # include <libintl.h>
@@ -79,23 +73,17 @@
 # define N_(String) String
 #endif
 
-#include "buildcmd.h"
+#ifndef LONG_MAX
+#define LONG_MAX (~(1 << (sizeof (long) * 8 - 1)))
+#endif
 
+#define ISBLANK(c) (isascii (c) && isblank (c))
+#define ISSPACE(c) (ISBLANK (c) || (c) == '\n' || (c) == '\r' \
+                   || (c) == '\f' || (c) == '\v')
 
 /* Return nonzero if S is the EOF string.  */
 #define EOF_STR(s) (eof_str && *eof_str == *s && !strcmp (eof_str, s))
 
-#if __STDC__
-#define VOID void
-#else
-#define VOID char
-#endif
-
-#include <xalloc.h>
-#include "closein.h"
-
-void error (int status, int errnum, char *message,...);
-
 extern char *version_string;
 
 static FILE *input_stream;
-- 
1.7.2.5




reply via email to

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