[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Coding style fixes: space after function names.
From: |
James Youngman |
Subject: |
[PATCH] Coding style fixes: space after function names. |
Date: |
Wed, 31 Mar 2010 23:46:36 +0100 |
* find/util.c: Insert a space between function name and open parenthesis.
* find/ftsfind.c: Likewise.
* find/fstype.c: Likewise.
* find/util.c: Likewise.
* find/tree.c: Likewise.
* find/sharefile.c: Likewise.
* find/pred.c: Likewise.
* find/parser.c: Likewise.
Signed-off-by: James Youngman <address@hidden>
---
ChangeLog | 11 +
find/find.c | 361 ++++++++++++++++++------------------
find/fstype.c | 58 +++---
find/ftsfind.c | 205 +++++++++++----------
find/parser.c | 532 +++++++++++++++++++++++++++---------------------------
find/pred.c | 378 +++++++++++++++++++-------------------
find/sharefile.c | 2 +-
find/tree.c | 278 ++++++++++++++--------------
find/util.c | 234 ++++++++++++------------
9 files changed, 1037 insertions(+), 1022 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9314bb7..948e4a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2010-03-31 James Youngman <address@hidden>
+ Coding style fixes: space after function names.
+ * find/util.c: Insert a space between function name and open
+ parenthesis.
+ * find/ftsfind.c: Likewise.
+ * find/fstype.c: Likewise.
+ * find/util.c: Likewise.
+ * find/tree.c: Likewise.
+ * find/sharefile.c: Likewise.
+ * find/pred.c: Likewise.
+ * find/parser.c: Likewise.
+
Move version number on to 4.5.7-git, so that we can make test
releases.
* configure.ac: Update version number.
diff --git a/find/find.c b/find/find.c
index 6f3a024..2ef95ac 100644
--- a/find/find.c
+++ b/find/find.c
@@ -74,7 +74,7 @@
#endif
#ifdef STAT_MOUNTPOINTS
-static void init_mounted_dev_list(int mandatory);
+static void init_mounted_dev_list (int mandatory);
#endif
static void process_top_path PARAMS((char *pathname, mode_t mode));
@@ -115,7 +115,7 @@ enum WdSanityCheckFatality
};
-int get_current_dirfd(void)
+int get_current_dirfd (void)
{
return AT_FDCWD;
}
@@ -136,17 +136,17 @@ main (int argc, char **argv)
remember_non_cloexec_fds ();
}
- state.shared_files = sharefile_init("w");
+ state.shared_files = sharefile_init ("w");
if (NULL == state.shared_files)
{
error (1, errno, _("Failed initialise shared-file hash table"));
}
/* Set the option defaults before we do the locale
- * initialisation as check_nofollow() needs to be executed in the
+ * initialisation as check_nofollow () needs to be executed in the
* POSIX locale.
*/
- set_option_defaults(&options);
+ set_option_defaults (&options);
#ifdef HAVE_SETLOCALE
setlocale (LC_ALL, "");
@@ -156,7 +156,7 @@ main (int argc, char **argv)
atexit (close_stdin);
/* Check for -P, -H or -L options. */
- end_of_leading_options = process_leading_options(argc, argv);
+ end_of_leading_options = process_leading_options (argc, argv);
if (options.debug_options & DebugStat)
options.xstat = debug_stat;
@@ -165,7 +165,7 @@ main (int argc, char **argv)
fprintf (stderr, "cur_day_start = %s", ctime (&options.cur_day_start));
#endif /* DEBUG */
- /* state.cwd_dir_fd has to be initialised before we call
build_expression_tree()
+ /* state.cwd_dir_fd has to be initialised before we call
build_expression_tree ()
* because command-line parsing may lead us to stat some files.
*/
state.cwd_dir_fd = AT_FDCWD;
@@ -173,23 +173,23 @@ main (int argc, char **argv)
/* We are now processing the part of the "find" command line
* after the -H/-L options (if any).
*/
- eval_tree = build_expression_tree(argc, argv, end_of_leading_options);
+ eval_tree = build_expression_tree (argc, argv, end_of_leading_options);
- /* safely_chdir() needs to check that it has ended up in the right place.
+ /* safely_chdir () needs to check that it has ended up in the right place.
* To avoid bailing out when something gets automounted, it checks if
* the target directory appears to have had a directory mounted on it as
- * we chdir()ed. The problem with this is that in order to notice that
- * a file system was mounted, we would need to lstat() all the mount points.
+ * we chdir ()ed. The problem with this is that in order to notice that
+ * a file system was mounted, we would need to lstat () all the mount points.
* That strategy loses if our machine is a client of a dead NFS server.
*
- * Hence if safely_chdir() and wd_sanity_check() can manage without needing
+ * Hence if safely_chdir () and wd_sanity_check () can manage without needing
* to know the mounted device list, we do that.
*/
if (!options.open_nofollow_available)
{
#ifdef STAT_MOUNTPOINTS
- init_mounted_dev_list(0);
+ init_mounted_dev_list (0);
#endif
}
@@ -212,12 +212,12 @@ main (int argc, char **argv)
error (1, errno, _("cannot get current directory"));
}
- set_stat_placeholders(&starting_stat_buf);
+ set_stat_placeholders (&starting_stat_buf);
if ((*options.xstat) (".", &starting_stat_buf) != 0)
error (1, errno, _("cannot stat current directory"));
/* If no paths are given, default to ".". */
- for (i = end_of_leading_options; i < argc && !looks_like_expression(argv[i],
true); i++)
+ for (i = end_of_leading_options; i < argc && !looks_like_expression
(argv[i], true); i++)
{
process_top_path (argv[i], 0);
}
@@ -239,41 +239,41 @@ main (int argc, char **argv)
* partially-full command lines which have been built,
* but which are not yet complete. Execute those now.
*/
- show_success_rates(eval_tree);
- cleanup();
+ show_success_rates (eval_tree);
+ cleanup ();
return state.exit_status;
}
-boolean is_fts_enabled(int *ftsoptions)
+boolean is_fts_enabled (int *ftsoptions)
{
- /* this version of find (i.e. this main()) does not use fts. */
+ /* this version of find (i.e. this main ()) does not use fts. */
*ftsoptions = 0;
return false;
}
static char *
-specific_dirname(const char *dir)
+specific_dirname (const char *dir)
{
char dirbuf[1024];
- if (0 == strcmp(".", dir))
+ if (0 == strcmp (".", dir))
{
/* OK, what's '.'? */
- if (NULL != getcwd(dirbuf, sizeof(dirbuf)))
+ if (NULL != getcwd (dirbuf, sizeof (dirbuf)))
{
- return strdup(dirbuf);
+ return strdup (dirbuf);
}
else
{
- return strdup(dir);
+ return strdup (dir);
}
}
else
{
- char *result = canonicalize_filename_mode(dir, CAN_EXISTING);
+ char *result = canonicalize_filename_mode (dir, CAN_EXISTING);
if (NULL == result)
- return strdup(dir);
+ return strdup (dir);
else
return result;
}
@@ -285,9 +285,9 @@ specific_dirname(const char *dir)
* be automounted
*/
static int
-fs_likely_to_be_automounted(const char *fs)
+fs_likely_to_be_automounted (const char *fs)
{
- return ( (0==strcmp(fs, "nfs")) || (0==strcmp(fs, "autofs")) ||
(0==strcmp(fs, "subfs")));
+ return ( (0==strcmp (fs, "nfs")) || (0==strcmp (fs, "autofs")) || (0==strcmp
(fs, "subfs")));
}
@@ -298,33 +298,33 @@ static size_t num_mounted_devices = 0u;
static void
-init_mounted_dev_list(int mandatory)
+init_mounted_dev_list (int mandatory)
{
assert (NULL == mounted_devices);
assert (0 == num_mounted_devices);
- mounted_devices = get_mounted_devices(&num_mounted_devices);
+ mounted_devices = get_mounted_devices (&num_mounted_devices);
if (mandatory && (NULL == mounted_devices))
{
- error(1, 0, _("Cannot read list of mounted devices."));
+ error (1, 0, _("Cannot read list of mounted devices."));
}
}
static void
-refresh_mounted_dev_list(void)
+refresh_mounted_dev_list (void)
{
if (mounted_devices)
{
- free(mounted_devices);
+ free (mounted_devices);
mounted_devices = 0;
}
num_mounted_devices = 0u;
- init_mounted_dev_list(1);
+ init_mounted_dev_list (1);
}
/* Search for device DEV in the array LIST, which is of size N. */
static int
-dev_present(dev_t dev, const dev_t *list, size_t n)
+dev_present (dev_t dev, const dev_t *list, size_t n)
{
if (list)
{
@@ -347,13 +347,13 @@ enum MountPointStateChange
static enum MountPointStateChange
-get_mount_state(dev_t newdev)
+get_mount_state (dev_t newdev)
{
int new_is_present, new_was_present;
- new_was_present = dev_present(newdev, mounted_devices, num_mounted_devices);
- refresh_mounted_dev_list();
- new_is_present = dev_present(newdev, mounted_devices, num_mounted_devices);
+ new_was_present = dev_present (newdev, mounted_devices, num_mounted_devices);
+ refresh_mounted_dev_list ();
+ new_is_present = dev_present (newdev, mounted_devices, num_mounted_devices);
if (new_was_present == new_is_present)
return MountPointStateUnchanged;
@@ -381,12 +381,12 @@ get_mount_state(dev_t newdev)
* occurring at exactly the wrong moment.
*/
static enum WdSanityCheckFatality
-dirchange_is_fatal(const char *specific_what,
- enum WdSanityCheckFatality isfatal,
- int silent,
- struct stat *newinfo)
+dirchange_is_fatal (const char *specific_what,
+ enum WdSanityCheckFatality isfatal,
+ int silent,
+ struct stat *newinfo)
{
- enum MountPointStateChange transition = get_mount_state(newinfo->st_dev);
+ enum MountPointStateChange transition = get_mount_state (newinfo->st_dev);
switch (transition)
{
case MountPointRecentlyUnmounted:
@@ -395,7 +395,7 @@ dirchange_is_fatal(const char *specific_what,
{
error (0, 0,
_("Warning: file system %s has recently been unmounted."),
- safely_quote_err_filename(0, specific_what));
+ safely_quote_err_filename (0, specific_what));
}
break;
@@ -405,7 +405,7 @@ dirchange_is_fatal(const char *specific_what,
{
error (0, 0,
_("Warning: file system %s has recently been mounted."),
- safely_quote_err_filename(0, specific_what));
+ safely_quote_err_filename (0, specific_what));
}
break;
@@ -451,7 +451,7 @@ dirchange_is_fatal(const char *specific_what,
* might be inconsistent due to the change in the file system.
*/
static boolean
-wd_sanity_check(const char *thing_to_stat,
+wd_sanity_check (const char *thing_to_stat,
const char *progname,
const char *what,
dev_t old_dev,
@@ -470,16 +470,16 @@ wd_sanity_check(const char *thing_to_stat,
*changed = false;
- set_stat_placeholders(newinfo);
+ set_stat_placeholders (newinfo);
if ((*options.xstat) (current_dir, newinfo) != 0)
- fatal_file_error(thing_to_stat);
+ fatal_file_error (thing_to_stat);
if (old_dev != newinfo->st_dev)
{
*changed = true;
- specific_what = specific_dirname(what);
- fstype = filesystem_type(newinfo, current_dir);
- silent = fs_likely_to_be_automounted(fstype);
+ specific_what = specific_dirname (what);
+ fstype = filesystem_type (newinfo, current_dir);
+ silent = fs_likely_to_be_automounted (fstype);
/* This condition is rare, so once we are here it is
* reasonable to perform an expensive computation to
@@ -488,7 +488,7 @@ wd_sanity_check(const char *thing_to_stat,
if (TraversingDown == direction)
{
#ifdef STAT_MOUNTPOINTS
- isfatal = dirchange_is_fatal(specific_what,isfatal,silent,newinfo);
+ isfatal = dirchange_is_fatal (specific_what,isfatal,silent,newinfo);
#else
isfatal = RETRY_IF_SANITY_CHECK_FAILS;
#endif
@@ -498,12 +498,12 @@ wd_sanity_check(const char *thing_to_stat,
{
case FATAL_IF_SANITY_CHECK_FAILS:
{
- fstype = filesystem_type(newinfo, current_dir);
+ fstype = filesystem_type (newinfo, current_dir);
error (1, 0,
_("%s%s changed during execution of %s (old device number
%ld, new device number %ld, file system type is %s) [ref %ld]"),
- safely_quote_err_filename(0, specific_what),
+ safely_quote_err_filename (0, specific_what),
parent ? "/.." : "",
- safely_quote_err_filename(1, progname),
+ safely_quote_err_filename (1, progname),
(long) old_dev,
(long) newinfo->st_dev,
fstype,
@@ -519,7 +519,7 @@ wd_sanity_check(const char *thing_to_stat,
* already decided that this is not a problem. Hence we return
* without checking the inode number.
*/
- free(specific_what);
+ free (specific_what);
return true;
}
@@ -532,22 +532,22 @@ wd_sanity_check(const char *thing_to_stat,
if (old_ino != newinfo->st_ino)
{
*changed = true;
- specific_what = specific_dirname(what);
- fstype = filesystem_type(newinfo, current_dir);
+ specific_what = specific_dirname (what);
+ fstype = filesystem_type (newinfo, current_dir);
error ((isfatal == FATAL_IF_SANITY_CHECK_FAILS) ? 1 : 0,
0, /* no relevant errno value */
_("%s%s changed during execution of %s "
"(old inode number %" PRIuMAX ", new inode number %" PRIuMAX
", file system type is %s) [ref %ld]"),
- safely_quote_err_filename(0, specific_what),
+ safely_quote_err_filename (0, specific_what),
parent ? "/.." : "",
- safely_quote_err_filename(1, progname),
+ safely_quote_err_filename (1, progname),
(uintmax_t) old_ino,
(uintmax_t) newinfo->st_ino,
fstype,
(long)line_no);
- free(specific_what);
+ free (specific_what);
return false;
}
@@ -574,11 +574,11 @@ enum SafeChdirStatus
* If following_links() is true, we do follow symbolic links.
*/
static enum SafeChdirStatus
-safely_chdir_lstat(const char *dest,
- enum TraversalDirection direction,
- struct stat *statbuf_dest,
- enum ChdirSymlinkHandling symlink_follow_option,
- boolean *did_stat)
+safely_chdir_lstat (const char *dest,
+ enum TraversalDirection direction,
+ struct stat *statbuf_dest,
+ enum ChdirSymlinkHandling symlink_follow_option,
+ boolean *did_stat)
{
struct stat statbuf_arrived;
int rv, dotfd=-1;
@@ -605,8 +605,8 @@ safely_chdir_lstat(const char *dest,
if (dotfd >= 0)
{
/* Stat the directory we're going to. */
- set_stat_placeholders(statbuf_dest);
- if (0 == options.xstat(dest, statbuf_dest))
+ set_stat_placeholders (statbuf_dest);
+ if (0 == options.xstat (dest, statbuf_dest))
{
statflag = true;
@@ -621,7 +621,7 @@ safely_chdir_lstat(const char *dest,
* is a symlink, it _should_ be followed. Hence we need the
* ability to override the policy set by following_links().
*/
- if (!following_links() && S_ISLNK(statbuf_dest->st_mode))
+ if (!following_links () && S_ISLNK(statbuf_dest->st_mode))
{
/* We're not supposed to be following links, but this is
* a link. Check symlink_follow_option to see if we should
@@ -632,7 +632,7 @@ safely_chdir_lstat(const char *dest,
/* We need to re-stat() the file so that the
* sanity check can pass.
*/
- if (0 != stat(dest, statbuf_dest))
+ if (0 != stat (dest, statbuf_dest))
{
rv = SafeChdirFailNonexistent;
rv_set = true;
@@ -670,24 +670,24 @@ safely_chdir_lstat(const char *dest,
#endif
if (options.debug_options & DebugSearch)
- fprintf(stderr, "safely_chdir(): chdir(\"%s\")\n", dest);
+ fprintf (stderr, "safely_chdir(): chdir(\"%s\")\n", dest);
- if (0 == chdir(dest))
+ if (0 == chdir (dest))
{
/* check we ended up where we wanted to go */
boolean changed = false;
- if (!wd_sanity_check(".", program_name, ".",
- statbuf_dest->st_dev,
- statbuf_dest->st_ino,
- &statbuf_arrived,
- 0, __LINE__, direction,
- isfatal,
- &changed))
+ if (!wd_sanity_check (".", program_name, ".",
+ statbuf_dest->st_dev,
+ statbuf_dest->st_ino,
+ &statbuf_arrived,
+ 0, __LINE__, direction,
+ isfatal,
+ &changed))
{
/* Only allow one failure. */
if (RETRY_IF_SANITY_CHECK_FAILS == isfatal)
{
- if (0 == fchdir(dotfd))
+ if (0 == fchdir (dotfd))
{
isfatal = FATAL_IF_SANITY_CHECK_FAILS;
goto retry;
@@ -701,8 +701,8 @@ safely_chdir_lstat(const char *dest,
* can't recover from this and so this error
* is fatal.
*/
- error(1, errno,
- _("failed to return to parent directory"));
+ error (1, errno,
+ _("failed to return to parent directory"));
}
}
else
@@ -715,7 +715,7 @@ safely_chdir_lstat(const char *dest,
}
}
- close(dotfd);
+ close (dotfd);
return SafeChdirOK;
}
else
@@ -782,7 +782,7 @@ safely_chdir_lstat(const char *dest,
if (dotfd >= 0)
{
- close(dotfd);
+ close (dotfd);
dotfd = -1;
}
@@ -799,11 +799,11 @@ safely_chdir_lstat(const char *dest,
* option is in effect).
*/
static enum SafeChdirStatus
-safely_chdir_nofollow(const char *dest,
- enum TraversalDirection direction,
- struct stat *statbuf_dest,
- enum ChdirSymlinkHandling symlink_follow_option,
- boolean *did_stat)
+safely_chdir_nofollow (const char *dest,
+ enum TraversalDirection direction,
+ struct stat *statbuf_dest,
+ enum ChdirSymlinkHandling symlink_follow_option,
+ boolean *did_stat)
{
int extraflags, fd;
@@ -820,7 +820,7 @@ safely_chdir_nofollow(const char *dest,
break;
case SymlinkHandleDefault:
- if (following_links())
+ if (following_links ())
extraflags = 0;
else
extraflags = O_NOFOLLOW;
@@ -828,7 +828,7 @@ safely_chdir_nofollow(const char *dest,
}
errno = 0;
- fd = open(dest, O_RDONLY
+ fd = open (dest, O_RDONLY
#if defined O_LARGEFILE
|O_LARGEFILE
#endif
@@ -850,15 +850,15 @@ safely_chdir_nofollow(const char *dest,
}
errno = 0;
- if (0 == fchdir(fd))
+ if (0 == fchdir (fd))
{
- close(fd);
+ close (fd);
return SafeChdirOK;
}
else
{
int saved_errno = errno;
- close(fd);
+ close (fd);
errno = saved_errno;
switch (errno)
@@ -878,11 +878,11 @@ safely_chdir_nofollow(const char *dest,
#endif
static enum SafeChdirStatus
-safely_chdir(const char *dest,
- enum TraversalDirection direction,
- struct stat *statbuf_dest,
- enum ChdirSymlinkHandling symlink_follow_option,
- boolean *did_stat)
+safely_chdir (const char *dest,
+ enum TraversalDirection direction,
+ struct stat *statbuf_dest,
+ enum ChdirSymlinkHandling symlink_follow_option,
+ boolean *did_stat)
{
enum SafeChdirStatus result;
@@ -891,14 +891,14 @@ safely_chdir(const char *dest,
* processed, do them now because they must be done in the same
* directory.
*/
- complete_pending_execdirs(get_current_dirfd());
+ complete_pending_execdirs (get_current_dirfd ());
#if !defined(O_NOFOLLOW)
options.open_nofollow_available = false;
#endif
if (options.open_nofollow_available)
{
- result = safely_chdir_nofollow(dest, direction, statbuf_dest,
+ result = safely_chdir_nofollow (dest, direction, statbuf_dest,
symlink_follow_option, did_stat);
if (SafeChdirFailDestUnreadable != result)
{
@@ -916,8 +916,8 @@ safely_chdir(const char *dest,
* method, since parent of the start point may be executable but not
* readable.
*/
- return safely_chdir_lstat(dest, direction, statbuf_dest,
- symlink_follow_option, did_stat);
+ return safely_chdir_lstat (dest, direction, statbuf_dest,
+ symlink_follow_option, did_stat);
}
@@ -932,37 +932,37 @@ chdir_back (void)
if (starting_desc < 0)
{
if (options.debug_options & DebugSearch)
- fprintf(stderr, "chdir_back(): chdir(\"%s\")\n", starting_dir);
+ fprintf (stderr, "chdir_back(): chdir(\"%s\")\n", starting_dir);
#ifdef STAT_MOUNTPOINTS
/* We will need the mounted device list. Get it now if we don't
* already have it.
*/
if (NULL == mounted_devices)
- init_mounted_dev_list(1);
+ init_mounted_dev_list (1);
#endif
if (chdir (starting_dir) != 0)
- fatal_file_error(starting_dir);
-
- wd_sanity_check(starting_dir,
- program_name,
- starting_dir,
- starting_stat_buf.st_dev,
- starting_stat_buf.st_ino,
- &stat_buf, 0, __LINE__,
- TraversingUp,
- FATAL_IF_SANITY_CHECK_FAILS,
- &dummy);
+ fatal_file_error (starting_dir);
+
+ wd_sanity_check (starting_dir,
+ program_name,
+ starting_dir,
+ starting_stat_buf.st_dev,
+ starting_stat_buf.st_ino,
+ &stat_buf, 0, __LINE__,
+ TraversingUp,
+ FATAL_IF_SANITY_CHECK_FAILS,
+ &dummy);
}
else
{
if (options.debug_options & DebugSearch)
- fprintf(stderr, "chdir_back(): chdir(<starting-point>)\n");
+ fprintf (stderr, "chdir_back(): chdir(<starting-point>)\n");
if (fchdir (starting_desc) != 0)
{
- fatal_file_error(starting_dir);
+ fatal_file_error (starting_dir);
}
}
}
@@ -988,7 +988,7 @@ at_top (char *pathname,
state.starting_path_length = strlen (pathname);
if (0 == *base
- || 0 == strcmp(parent_dir, "."))
+ || 0 == strcmp (parent_dir, "."))
{
dirchange = 0;
base = pathname;
@@ -1001,7 +1001,7 @@ at_top (char *pathname,
boolean did_stat = false;
dirchange = 1;
- if (0 == strcmp(base, ".."))
+ if (0 == strcmp (base, ".."))
direction = TraversingUp;
else
direction = TraversingDown;
@@ -1016,16 +1016,16 @@ at_top (char *pathname,
* Hence we need the ability to override the policy set by
* following_links().
*/
- chdir_status = safely_chdir(parent_dir, direction, &st, SymlinkFollowOk,
&did_stat);
+ chdir_status = safely_chdir (parent_dir, direction, &st,
SymlinkFollowOk, &did_stat);
if (SafeChdirOK != chdir_status)
{
const char *what = (SafeChdirFailWouldBeUnableToReturn ==
chdir_status) ? "." : parent_dir;
if (errno)
error (0, errno, "%s",
- safely_quote_err_filename(0, what));
+ safely_quote_err_filename (0, what));
else
error (0, 0, _("Failed to safely change directory into %s"),
- safely_quote_err_filename(0, parent_dir));
+ safely_quote_err_filename (0, parent_dir));
/* We can't process this command-line argument. */
state.exit_status = 1;
@@ -1036,35 +1036,36 @@ at_top (char *pathname,
free (parent_dir);
parent_dir = NULL;
- action(pathname, base, mode, pstat);
+ action (pathname, base, mode, pstat);
if (dirchange)
{
- chdir_back();
+ chdir_back ();
}
}
-static void do_process_top_dir(char *pathname,
- char *base,
- int mode,
- struct stat *pstat)
+static void do_process_top_dir (char *pathname,
+ char *base,
+ int mode,
+ struct stat *pstat)
{
(void) pstat;
process_path (pathname, base, false, ".", mode);
- complete_pending_execdirs(get_current_dirfd());
+ complete_pending_execdirs (get_current_dirfd ());
}
-static void do_process_predicate(char *pathname,
- char *base,
- int mode,
- struct stat *pstat)
+static void
+do_process_predicate (char *pathname,
+ char *base,
+ int mode,
+ struct stat *pstat)
{
(void) mode;
state.rel_pathname = base; /* cwd_dir_fd was already set by safely_chdir */
- apply_predicate (pathname, pstat, get_eval_tree());
+ apply_predicate (pathname, pstat, get_eval_tree ());
}
@@ -1083,7 +1084,7 @@ static void do_process_predicate(char *pathname,
static void
process_top_path (char *pathname, mode_t mode)
{
- at_top(pathname, mode, NULL, do_process_top_dir);
+ at_top (pathname, mode, NULL, do_process_top_dir);
}
@@ -1112,17 +1113,17 @@ static int dir_curr = -1;
* skip that directory entry.
*/
static void
-issue_loop_warning(const char *name, const char *pathname, int level)
+issue_loop_warning (const char *name, const char *pathname, int level)
{
struct stat stbuf_link;
- if (lstat(name, &stbuf_link) != 0)
+ if (lstat (name, &stbuf_link) != 0)
stbuf_link.st_mode = S_IFREG;
if (S_ISLNK(stbuf_link.st_mode))
{
- error(0, 0,
- _("Symbolic link %s is part of a loop in the directory hierarchy;
we have already visited the directory to which it points."),
- safely_quote_err_filename(0, pathname));
+ error (0, 0,
+ _("Symbolic link %s is part of a loop in the directory hierarchy;
we have already visited the directory to which it points."),
+ safely_quote_err_filename (0, pathname));
/* XXX: POSIX appears to require that the exit status be non-zero if a
* diagnostic is issued.
*/
@@ -1138,15 +1139,15 @@ issue_loop_warning(const char *name, const char
*pathname, int level)
* because the ".." entry of /b/b/c/d points to /a, not
* to /a/b/c.
*/
- error(0, 0,
- ngettext(
- "Filesystem loop detected; %s has the same device number
and inode as "
- "a directory which is %d level higher in the file system
hierarchy",
- "Filesystem loop detected; %s has the same device number
and inode as "
- "a directory which is %d levels higher in the file system
hierarchy",
- (long)distance),
- safely_quote_err_filename(0, pathname),
- distance);
+ error (0, 0,
+ ngettext (
+ "Filesystem loop detected; %s has the same device number
and inode as "
+ "a directory which is %d level higher in the file system
hierarchy",
+ "Filesystem loop detected; %s has the same device number
and inode as "
+ "a directory which is %d levels higher in the file
system hierarchy",
+ (long)distance),
+ safely_quote_err_filename (0, pathname),
+ distance);
}
}
@@ -1175,7 +1176,7 @@ process_path (char *pathname, char *name, boolean leaf,
char *parent,
int i;
struct predicate *eval_tree;
- eval_tree = get_eval_tree();
+ eval_tree = get_eval_tree ();
/* Assume it is a non-directory initially. */
stat_buf.st_mode = 0;
state.rel_pathname = name;
@@ -1183,7 +1184,7 @@ process_path (char *pathname, char *name, boolean leaf,
char *parent,
state.have_stat = false;
state.have_type = false;
- if (!digest_mode(&mode, pathname, name, &stat_buf, leaf))
+ if (!digest_mode (&mode, pathname, name, &stat_buf, leaf))
return 0;
if (!S_ISDIR (state.type))
@@ -1199,7 +1200,7 @@ process_path (char *pathname, char *name, boolean leaf,
char *parent,
/* Now we really need to stat the directory, even if we know the
* type, because we need information like struct stat.st_rdev.
*/
- if (get_statinfo(pathname, name, &stat_buf) != 0)
+ if (get_statinfo (pathname, name, &stat_buf) != 0)
return 0;
state.have_stat = true;
@@ -1215,7 +1216,7 @@ process_path (char *pathname, char *name, boolean leaf,
char *parent,
stat_buf.st_dev == dir_ids[i].dev)
{
state.stop_at_current_level = true;
- issue_loop_warning(name, pathname, i);
+ issue_loop_warning (name, pathname, i);
}
if (dir_alloc <= ++dir_curr)
@@ -1239,8 +1240,8 @@ process_path (char *pathname, char *name, boolean leaf,
char *parent,
apply_predicate (pathname, &stat_buf, eval_tree);
if (options.debug_options & DebugSearch)
- fprintf(stderr, "pathname = %s, stop_at_current_level = %d\n",
- pathname, state.stop_at_current_level);
+ fprintf (stderr, "pathname = %s, stop_at_current_level = %d\n",
+ pathname, state.stop_at_current_level);
if (state.stop_at_current_level == false)
{
@@ -1252,16 +1253,16 @@ process_path (char *pathname, char *name, boolean leaf,
char *parent,
{
/* The fields in 'state' are now out of date. Correct them.
*/
- if (!digest_mode(&mode, pathname, name, &stat_buf, leaf))
+ if (!digest_mode (&mode, pathname, name, &stat_buf, leaf))
return 0;
if (0 == dir_curr)
{
- at_top(pathname, mode, &stat_buf, do_process_predicate);
+ at_top (pathname, mode, &stat_buf, do_process_predicate);
}
else
{
- do_process_predicate(pathname, name, mode, &stat_buf);
+ do_process_predicate (pathname, name, mode, &stat_buf);
}
}
@@ -1292,11 +1293,11 @@ process_dir (char *pathname, char *name, int pathlen,
const struct stat *statp,
size_t dircount = 0u;
struct savedir_dirinfo *dirinfo;
#if 0
- printf("process_dir: pathname=%s name=%s statp->st_nlink=%d st_ino=%d\n",
- pathname,
- name,
- (int)statp->st_nlink,
- (int)statp->st_ino);
+ printf ("process_dir: pathname=%s name=%s statp->st_nlink=%d st_ino=%d\n",
+ pathname,
+ name,
+ (int)statp->st_nlink,
+ (int)statp->st_ino);
#endif
if (statp->st_nlink < 2)
{
@@ -1310,13 +1311,13 @@ process_dir (char *pathname, char *name, int pathlen,
const struct stat *statp,
}
errno = 0;
- dirinfo = xsavedir(name, 0);
+ dirinfo = xsavedir (name, 0);
if (dirinfo == NULL)
{
assert (errno != 0);
- error (0, errno, "%s", safely_quote_err_filename(0, pathname));
+ error (0, errno, "%s", safely_quote_err_filename (0, pathname));
state.exit_status = 1;
}
else
@@ -1341,7 +1342,7 @@ process_dir (char *pathname, char *name, int pathlen,
const struct stat *statp,
* yet been processed, do them now because they must be done in
* the same directory.
*/
- complete_pending_execdirs(get_current_dirfd());
+ complete_pending_execdirs (get_current_dirfd ());
if (strcmp (name, "."))
{
@@ -1365,8 +1366,8 @@ process_dir (char *pathname, char *name, int pathlen,
const struct stat *statp,
/* If there is a link we need to follow it. Hence
* the direct call to stat() not through (options.xstat)
*/
- set_stat_placeholders(&stat_buf);
- if (0 != stat(".", &stat_buf))
+ set_stat_placeholders (&stat_buf);
+ if (0 != stat (".", &stat_buf))
break; /* skip the assignment. */
}
dir_ids[dir_curr].dev = stat_buf.st_dev;
@@ -1385,14 +1386,14 @@ process_dir (char *pathname, char *name, int pathlen,
const struct stat *statp,
case SafeChdirFailNotDir:
case SafeChdirFailChdirFailed:
error (0, errno, "%s",
- safely_quote_err_filename(0, pathname));
+ safely_quote_err_filename (0, pathname));
state.exit_status = 1;
return;
case SafeChdirFailSymlink:
error (0, 0,
_("warning: not following the symbolic link %s"),
- safely_quote_err_filename(0, pathname));
+ safely_quote_err_filename (0, pathname));
state.exit_status = 1;
return;
}
@@ -1435,10 +1436,10 @@ process_dir (char *pathname, char *name, int pathlen,
const struct stat *statp,
* doesn't really handle hard links with Unix semantics.
* In the latter case, -noleaf should be used routinely.
*/
- error(0, 0, _("WARNING: Hard link count is wrong for %s (saw
only st_nlink=%" PRIuMAX " but we already saw %" PRIuMAX " subdirectories):
this may be a bug in your file system driver. Automatically turning on find's
-noleaf option. Earlier results may have failed to include directories that
should have been searched."),
- safely_quote_err_filename(0, pathname),
- (uintmax_t) statp->st_nlink,
- (uintmax_t) dircount);
+ error (0, 0, _("WARNING: Hard link count is wrong for %s (saw
only st_nlink=%" PRIuMAX " but we already saw %" PRIuMAX " subdirectories):
this may be a bug in your file system driver. Automatically turning on find's
-noleaf option. Earlier results may have failed to include directories that
should have been searched."),
+ safely_quote_err_filename(0, pathname),
+ (uintmax_t) statp->st_nlink,
+ (uintmax_t) dircount);
state.exit_status = 1; /* We know the result is wrong, now */
options.no_leaf_check = true; /* Don't make same
mistake again */
@@ -1479,7 +1480,7 @@ process_dir (char *pathname, char *name, int pathlen,
const struct stat *statp,
* yet been processed, do them now because they must be done in
* the same directory.
*/
- complete_pending_execdirs(get_current_dirfd());
+ complete_pending_execdirs (get_current_dirfd ());
if (strcmp (name, "."))
{
@@ -1489,7 +1490,7 @@ process_dir (char *pathname, char *name, int pathlen,
const struct stat *statp,
/* We could go back and do the next command-line arg
instead, maybe using longjmp. */
char const *dir;
- boolean deref = following_links() ? true : false;
+ boolean deref = following_links () ? true : false;
if ( (state.curdepth>0) && !deref)
dir = "..";
@@ -1516,7 +1517,7 @@ process_dir (char *pathname, char *name, int pathlen,
const struct stat *statp,
case SafeChdirFailSymlink:
case SafeChdirFailNotDir:
case SafeChdirFailChdirFailed:
- error (1, errno, "%s", safely_quote_err_filename(0, pathname));
+ error (1, errno, "%s", safely_quote_err_filename (0, pathname));
return;
}
@@ -1534,7 +1535,7 @@ process_dir (char *pathname, char *name, int pathlen,
const struct stat *statp,
if (cur_path)
free (cur_path);
- free_dirinfo(dirinfo);
+ free_dirinfo (dirinfo);
}
if (subdirs_unreliable)
diff --git a/find/fstype.c b/find/fstype.c
index 001e009..8dd10cc 100644
--- a/find/fstype.c
+++ b/find/fstype.c
@@ -94,19 +94,19 @@ static char *file_system_type_uncached PARAMS((const struct
stat *statp, const c
static void
-free_file_system_list(struct mount_entry *p)
+free_file_system_list (struct mount_entry *p)
{
while (p)
{
struct mount_entry *pnext = p->me_next;
- free(p->me_devname);
- free(p->me_mountdir);
+ free (p->me_devname);
+ free (p->me_mountdir);
- if(p->me_type_malloced)
- free(p->me_type);
+ if (p->me_type_malloced)
+ free (p->me_type);
p->me_next = NULL;
- free(p);
+ free (p);
p = pnext;
}
}
@@ -170,13 +170,13 @@ filesystem_type (const struct stat *statp, const char
*path)
}
static int
-set_fstype_devno(struct mount_entry *p)
+set_fstype_devno (struct mount_entry *p)
{
struct stat stbuf;
if (p->me_dev == (dev_t)-1)
{
- set_stat_placeholders(&stbuf);
+ set_stat_placeholders (&stbuf);
if (0 == (options.xstat)(p->me_mountdir, &stbuf))
{
p->me_dev = stbuf.st_dev;
@@ -191,16 +191,16 @@ set_fstype_devno(struct mount_entry *p)
}
static struct mount_entry *
-must_read_fs_list(bool need_fs_type)
+must_read_fs_list (bool need_fs_type)
{
- struct mount_entry *entries = read_file_system_list(need_fs_type);
+ struct mount_entry *entries = read_file_system_list (need_fs_type);
if (NULL == entries)
{
/* We cannot determine for sure which file we were trying to
* use because gnulib has abstracted all that stuff away.
* Hence we cannot issue a specific error message here.
*/
- error(1, 0, _("Cannot read mounted file system list"));
+ error (1, 0, _("Cannot read mounted file system list"));
}
return entries;
}
@@ -221,33 +221,33 @@ file_system_type_uncached (const struct stat *statp,
const char *path)
(void) path;
#ifdef AFS
- if (in_afs(path))
+ if (in_afs (path))
{
fstype_known = 1;
- return xstrdup("afs");
+ return xstrdup ("afs");
}
#endif
- entries = must_read_fs_list(true);
+ entries = must_read_fs_list (true);
for (type=NULL, entry=entries; entry; entry=entry->me_next)
{
#ifdef MNTTYPE_IGNORE
if (!strcmp (entry->me_type, MNTTYPE_IGNORE))
continue;
#endif
- set_fstype_devno(entry);
+ set_fstype_devno (entry);
if (entry->me_dev == statp->st_dev)
{
- type = xstrdup(entry->me_type);
+ type = xstrdup (entry->me_type);
break;
}
}
- free_file_system_list(entries);
+ free_file_system_list (entries);
/* Don't cache unknown values. */
fstype_known = (type != NULL);
- return type ? type : xstrdup(_("unknown"));
+ return type ? type : xstrdup (_("unknown"));
}
@@ -259,7 +259,7 @@ get_mounted_filesystems (void)
size_t used = 0u;
struct mount_entry *entries, *entry;
- entries = must_read_fs_list(false);
+ entries = must_read_fs_list (false);
for (entry=entries; entry; entry=entry->me_next)
{
size_t len;
@@ -268,15 +268,15 @@ get_mounted_filesystems (void)
if (!strcmp (entry->me_type, MNTTYPE_IGNORE))
continue;
#endif
- set_fstype_devno(entry);
+ set_fstype_devno (entry);
- len = strlen(entry->me_mountdir) + 1;
- result = extendbuf(result, used+len, &alloc_size);
- strcpy(&result[used], entry->me_mountdir);
+ len = strlen (entry->me_mountdir) + 1;
+ result = extendbuf (result, used+len, &alloc_size);
+ strcpy (&result[used], entry->me_mountdir);
used += len; /* len already includes one for the \0 */
}
- free_file_system_list(entries);
+ free_file_system_list (entries);
return result;
}
@@ -289,22 +289,22 @@ get_mounted_devices (size_t *n)
struct mount_entry *entries, *entry;
dev_t *result = NULL;
- /* Use read_file_system_list() rather than must_read_fs_list()
+ /* Use read_file_system_list () rather than must_read_fs_list()
* because on some system this is always called at startup,
* and find should only exit fatally if it needs to use the
* result of this operation. If we can't get the fs list
* but we never need the information, there is no need to fail.
*/
- for (entry = entries = read_file_system_list(false);
+ for (entry = entries = read_file_system_list (false);
entry;
entry = entry->me_next)
{
- result = extendbuf(result, sizeof(dev_t)*(used+1), &alloc_size);
- set_fstype_devno(entry);
+ result = extendbuf (result, sizeof(dev_t)*(used+1), &alloc_size);
+ set_fstype_devno (entry);
result[used] = entry->me_dev;
++used;
}
- free_file_system_list(entries);
+ free_file_system_list (entries);
*n = used;
return result;
}
diff --git a/find/ftsfind.c b/find/ftsfind.c
index 26c232a..6e0950f 100644
--- a/find/ftsfind.c
+++ b/find/ftsfind.c
@@ -84,7 +84,8 @@ static int ftsoptions =
FTS_NOSTAT|FTS_TIGHT_CYCLE_CHECK|FTS_CWDFD;
static int prev_depth = INT_MIN; /* fts_level can be < 0 */
static int curr_fd = -1;
-int get_current_dirfd(void)
+int
+get_current_dirfd (void)
{
if (ftsoptions & FTS_CWDFD)
{
@@ -102,13 +103,14 @@ int get_current_dirfd(void)
}
}
-static void left_dir(void)
+static void
+left_dir (void)
{
if (ftsoptions & FTS_CWDFD)
{
if (curr_fd >= 0)
{
- close(curr_fd);
+ close (curr_fd);
curr_fd = -1;
}
}
@@ -123,7 +125,8 @@ static void left_dir(void)
* The caller can't tell if this is the first time this happens, so
* we have to be careful not to call dup() more than once
*/
-static void inside_dir(int dir_fd)
+static void
+inside_dir (int dir_fd)
{
if (ftsoptions & FTS_CWDFD)
{
@@ -162,7 +165,7 @@ static void inside_dir(int dir_fd)
#ifdef STAT_MOUNTPOINTS
-static void init_mounted_dev_list(void);
+static void init_mounted_dev_list (void);
#endif
/* We have encountered an error which should affect the exit status.
@@ -171,7 +174,7 @@ static void init_mounted_dev_list(void);
* reduce it to 1.
*/
static void
-error_severity(int level)
+error_severity (int level)
{
if (state.exit_status < level)
state.exit_status = level;
@@ -182,7 +185,7 @@ error_severity(int level)
#define HANDLECASE(N) case N: return #N;
static char *
-get_fts_info_name(int info)
+get_fts_info_name (int info)
{
static char buf[10];
switch (info)
@@ -202,13 +205,13 @@ get_fts_info_name(int info)
HANDLECASE(FTS_SLNONE);
HANDLECASE(FTS_W);
default:
- sprintf(buf, "[%d]", info);
+ sprintf (buf, "[%d]", info);
return buf;
}
}
static void
-visit(FTS *p, FTSENT *ent, struct stat *pstat)
+visit (FTS *p, FTSENT *ent, struct stat *pstat)
{
struct predicate *eval_tree;
@@ -217,22 +220,22 @@ visit(FTS *p, FTSENT *ent, struct stat *pstat)
state.cwd_dir_fd = p->fts_cwd_fd;
/* Apply the predicates to this path. */
- eval_tree = get_eval_tree();
- apply_predicate(ent->fts_path, pstat, eval_tree);
+ eval_tree = get_eval_tree ();
+ apply_predicate (ent->fts_path, pstat, eval_tree);
/* Deal with any side effects of applying the predicates. */
if (state.stop_at_current_level)
{
- fts_set(p, ent, FTS_SKIP);
+ fts_set (p, ent, FTS_SKIP);
}
}
static const char*
-partial_quotearg_n(int n, char *s, size_t len, enum quoting_style style)
+partial_quotearg_n (int n, char *s, size_t len, enum quoting_style style)
{
if (0 == len)
{
- return quotearg_n_style(n, style, "");
+ return quotearg_n_style (n, style, "");
}
else
{
@@ -241,7 +244,7 @@ partial_quotearg_n(int n, char *s, size_t len, enum
quoting_style style)
saved = s[len];
s[len] = 0;
- result = quotearg_n_style(n, style, s);
+ result = quotearg_n_style (n, style, s);
s[len] = saved;
return result;
}
@@ -260,13 +263,13 @@ partial_quotearg_n(int n, char *s, size_t len, enum
quoting_style style)
* skip that directory entry.
*/
static void
-issue_loop_warning(FTSENT * ent)
+issue_loop_warning (FTSENT * ent)
{
if (S_ISLNK(ent->fts_statp->st_mode))
{
- error(0, 0,
- _("Symbolic link %s is part of a loop in the directory hierarchy;
we have already visited the directory to which it points."),
- safely_quote_err_filename(0, ent->fts_path));
+ error (0, 0,
+ _("Symbolic link %s is part of a loop in the directory hierarchy;
we have already visited the directory to which it points."),
+ safely_quote_err_filename (0, ent->fts_path));
}
else
{
@@ -278,14 +281,14 @@ issue_loop_warning(FTSENT * ent)
* because the ".." entry of /a/b/c/d points to /a, not
* to /a/b/c.
*/
- error(0, 0,
- _("File system loop detected; "
- "%s is part of the same file system loop as %s."),
- safely_quote_err_filename(0, ent->fts_path),
- partial_quotearg_n(1,
- ent->fts_cycle->fts_path,
- ent->fts_cycle->fts_pathlen,
- options.err_quoting_style));
+ error (0, 0,
+ _("File system loop detected; "
+ "%s is part of the same file system loop as %s."),
+ safely_quote_err_filename (0, ent->fts_path),
+ partial_quotearg_n (1,
+ ent->fts_cycle->fts_path,
+ ent->fts_cycle->fts_pathlen,
+ options.err_quoting_style));
}
}
@@ -296,44 +299,44 @@ issue_loop_warning(FTSENT * ent)
* produces such a loop.
*/
static boolean
-symlink_loop(const char *name)
+symlink_loop (const char *name)
{
struct stat stbuf;
int rv;
- if (following_links())
- rv = stat(name, &stbuf);
+ if (following_links ())
+ rv = stat (name, &stbuf);
else
- rv = lstat(name, &stbuf);
+ rv = lstat (name, &stbuf);
return (0 != rv) && (ELOOP == errno);
}
static int
-complete_execdirs_cb(void *context)
+complete_execdirs_cb (void *context)
{
(void) context;
/* By the tme this callback is called, the current directory is correct. */
- complete_pending_execdirs(AT_FDCWD);
+ complete_pending_execdirs (AT_FDCWD);
return 0;
}
static void
-show_outstanding_execdirs(FILE *fp)
+show_outstanding_execdirs (FILE *fp)
{
if (options.debug_options & DebugExec)
{
int seen=0;
struct predicate *p;
- p = get_eval_tree();
- fprintf(fp, "Outstanding execdirs:");
+ p = get_eval_tree ();
+ fprintf (fp, "Outstanding execdirs:");
while (p)
{
const char *pfx;
- if (pred_is(p, pred_execdir))
+ if (pred_is (p, pred_execdir))
pfx = "-execdir";
- else if (pred_is(p, pred_okdir))
+ else if (pred_is (p, pred_okdir))
pfx = "-okdir";
else
pfx = NULL;
@@ -343,20 +346,20 @@ show_outstanding_execdirs(FILE *fp)
const struct exec_val *execp = &p->args.exec_vec;
++seen;
- fprintf(fp, "%s ", pfx);
+ fprintf (fp, "%s ", pfx);
if (execp->multiple)
- fprintf(fp, "multiple ");
- fprintf(fp, "%d args: ", execp->state.cmd_argc);
+ fprintf (fp, "multiple ");
+ fprintf (fp, "%d args: ", execp->state.cmd_argc);
for (i=0; i<execp->state.cmd_argc; ++i)
{
- fprintf(fp, "%s ", execp->state.cmd_argv[i]);
+ fprintf (fp, "%s ", execp->state.cmd_argv[i]);
}
- fprintf(fp, "\n");
+ fprintf (fp, "\n");
}
p = p->pred_next;
}
if (!seen)
- fprintf(fp, " none\n");
+ fprintf (fp, " none\n");
}
else
{
@@ -368,32 +371,32 @@ show_outstanding_execdirs(FILE *fp)
static void
-consider_visiting(FTS *p, FTSENT *ent)
+consider_visiting (FTS *p, FTSENT *ent)
{
struct stat statbuf;
mode_t mode;
int ignore, isdir;
if (options.debug_options & DebugSearch)
- fprintf(stderr,
- "consider_visiting (early): %s: "
- "fts_info=%-6s, fts_level=%2d, prev_depth=%d "
- "fts_path=%s, fts_accpath=%s\n",
- quotearg_n_style(0, options.err_quoting_style, ent->fts_path),
- get_fts_info_name(ent->fts_info),
- (int)ent->fts_level, prev_depth,
- quotearg_n_style(1, options.err_quoting_style, ent->fts_path),
- quotearg_n_style(2, options.err_quoting_style, ent->fts_accpath));
+ fprintf (stderr,
+ "consider_visiting (early): %s: "
+ "fts_info=%-6s, fts_level=%2d, prev_depth=%d "
+ "fts_path=%s, fts_accpath=%s\n",
+ quotearg_n_style (0, options.err_quoting_style, ent->fts_path),
+ get_fts_info_name (ent->fts_info),
+ (int)ent->fts_level, prev_depth,
+ quotearg_n_style (1, options.err_quoting_style, ent->fts_path),
+ quotearg_n_style (2, options.err_quoting_style, ent->fts_accpath));
if (ent->fts_info == FTS_DP)
{
- left_dir();
+ left_dir ();
}
else if (ent->fts_level > prev_depth || ent->fts_level==0)
{
- left_dir();
+ left_dir ();
}
- inside_dir(p->fts_cwd_fd);
+ inside_dir (p->fts_cwd_fd);
prev_depth = ent->fts_level;
statbuf.st_ino = ent->fts_statp->st_ino;
@@ -402,15 +405,15 @@ consider_visiting(FTS *p, FTSENT *ent)
if (ent->fts_info == FTS_ERR
|| ent->fts_info == FTS_DNR)
{
- error(0, ent->fts_errno, "%s",
- safely_quote_err_filename(0, ent->fts_path));
- error_severity(1);
+ error (0, ent->fts_errno, "%s",
+ safely_quote_err_filename (0, ent->fts_path));
+ error_severity (1);
return;
}
else if (ent->fts_info == FTS_DC)
{
- issue_loop_warning(ent);
- error_severity(1);
+ issue_loop_warning (ent);
+ error_severity (1);
return;
}
else if (ent->fts_info == FTS_SLNONE)
@@ -422,10 +425,10 @@ consider_visiting(FTS *p, FTSENT *ent)
* we stat is local (fts_accpath), we print the full path name
* of the file (fts_path) in the error message.
*/
- if (symlink_loop(ent->fts_accpath))
+ if (symlink_loop (ent->fts_accpath))
{
- error(0, ELOOP, "%s", safely_quote_err_filename(0, ent->fts_path));
- error_severity(1);
+ error (0, ELOOP, "%s", safely_quote_err_filename (0, ent->fts_path));
+ error_severity (1);
return;
}
}
@@ -434,9 +437,9 @@ consider_visiting(FTS *p, FTSENT *ent)
if (ent->fts_level == 0)
{
/* e.g., nonexistent starting point */
- error(0, ent->fts_errno, "%s",
- safely_quote_err_filename(0, ent->fts_path));
- error_severity(1); /* remember problem */
+ error (0, ent->fts_errno, "%s",
+ safely_quote_err_filename (0, ent->fts_path));
+ error_severity (1); /* remember problem */
return;
}
else
@@ -444,11 +447,11 @@ consider_visiting(FTS *p, FTSENT *ent)
/* The following if statement fixes Savannah bug #19605
* (failure to diagnose a symbolic link loop)
*/
- if (symlink_loop(ent->fts_accpath))
+ if (symlink_loop (ent->fts_accpath))
{
- error(0, ELOOP, "%s",
- safely_quote_err_filename(0, ent->fts_path));
- error_severity(1);
+ error (0, ELOOP, "%s",
+ safely_quote_err_filename (0, ent->fts_path));
+ error_severity (1);
return;
}
}
@@ -472,8 +475,8 @@ consider_visiting(FTS *p, FTSENT *ent)
if (00000 == mode)
{
/* Savannah bug #16378. */
- error(0, 0, _("Warning: file %s appears to have mode 0000"),
- quotearg_n_style(0, options.err_quoting_style, ent->fts_path));
+ error (0, 0, _("Warning: file %s appears to have mode 0000"),
+ quotearg_n_style (0, options.err_quoting_style,
ent->fts_path));
}
}
@@ -483,7 +486,7 @@ consider_visiting(FTS *p, FTSENT *ent)
state.curdepth = ent->fts_level;
if (mode)
{
- if (!digest_mode(&mode, ent->fts_path, ent->fts_name, &statbuf, 0))
+ if (!digest_mode (&mode, ent->fts_path, ent->fts_name, &statbuf, 0))
return;
}
@@ -501,7 +504,7 @@ consider_visiting(FTS *p, FTSENT *ent)
* children. Force a stat of the file so that the
* children can be checked.
*/
- fts_set(p, ent, FTS_AGAIN);
+ fts_set (p, ent, FTS_AGAIN);
return;
}
@@ -509,7 +512,7 @@ consider_visiting(FTS *p, FTSENT *ent)
{
if (ent->fts_level >= options.maxdepth)
{
- fts_set(p, ent, FTS_SKIP); /* descend no further */
+ fts_set (p, ent, FTS_SKIP); /* descend no further */
if (ent->fts_level > options.maxdepth)
ignore = 1; /* don't even look at this one */
@@ -535,13 +538,13 @@ consider_visiting(FTS *p, FTSENT *ent)
fprintf (stderr,
"consider_visiting (late): %s: "
"fts_info=%-6s, isdir=%d ignore=%d have_stat=%d have_type=%d \n",
- quotearg_n_style(0, options.err_quoting_style, ent->fts_path),
- get_fts_info_name(ent->fts_info),
+ quotearg_n_style (0, options.err_quoting_style, ent->fts_path),
+ get_fts_info_name (ent->fts_info),
isdir, ignore, state.have_stat, state.have_type);
if (!ignore)
{
- visit(p, ent, &statbuf);
+ visit (p, ent, &statbuf);
}
/* XXX: if we allow a build-up of pending arguments for "-execdir foo {} +"
@@ -558,8 +561,8 @@ consider_visiting(FTS *p, FTSENT *ent)
*/
if (state.execdirs_outstanding)
{
- show_outstanding_execdirs(stderr);
- run_in_dir(p->fts_cwd_fd, complete_execdirs_cb, NULL);
+ show_outstanding_execdirs (stderr);
+ run_in_dir (p->fts_cwd_fd, complete_execdirs_cb, NULL);
}
if (ent->fts_info == FTS_DP)
@@ -578,8 +581,8 @@ find (char *arg)
FTS *p;
FTSENT *ent;
- state.starting_path_length = strlen(arg);
- inside_dir(AT_FDCWD);
+ state.starting_path_length = strlen (arg);
+ inside_dir (AT_FDCWD);
arglist[0] = arg;
arglist[1] = NULL;
@@ -606,32 +609,32 @@ find (char *arg)
if (NULL == p)
{
error (0, errno, _("cannot search %s"),
- safely_quote_err_filename(0, arg));
+ safely_quote_err_filename (0, arg));
}
else
{
- while ( (ent=fts_read(p)) != NULL )
+ while ( (ent=fts_read (p)) != NULL )
{
state.have_stat = false;
state.have_type = !!ent->fts_statp->st_mode;
state.type = state.have_type ? ent->fts_statp->st_mode : 0;
- consider_visiting(p, ent);
+ consider_visiting (p, ent);
}
- fts_close(p);
+ fts_close (p);
p = NULL;
}
}
static void
-process_all_startpoints(int argc, char *argv[])
+process_all_startpoints (int argc, char *argv[])
{
int i;
/* figure out how many start points there are */
- for (i = 0; i < argc && !looks_like_expression(argv[i], true); i++)
+ for (i = 0; i < argc && !looks_like_expression (argv[i], true); i++)
{
- state.starting_path_length = strlen(argv[i]); /* TODO: is this
redundant? */
+ state.starting_path_length = strlen (argv[i]); /* TODO: is this
redundant? */
find (argv[i]);
}
@@ -644,7 +647,7 @@ process_all_startpoints(int argc, char *argv[])
* "find -printf %H" (note, not "find . -printf %H").
*/
char defaultpath[2] = ".";
- find(defaultpath);
+ find (defaultpath);
}
}
@@ -667,7 +670,7 @@ main (int argc, char **argv)
remember_non_cloexec_fds ();
}
- state.shared_files = sharefile_init("w");
+ state.shared_files = sharefile_init ("w");
if (NULL == state.shared_files)
{
error (1, errno, _("Failed initialise shared-file hash table"));
@@ -676,7 +679,7 @@ main (int argc, char **argv)
/* Set the option defaults before we do the locale initialisation as
* check_nofollow() needs to be executed in the POSIX locale.
*/
- set_option_defaults(&options);
+ set_option_defaults (&options);
#ifdef HAVE_SETLOCALE
setlocale (LC_ALL, "");
@@ -689,7 +692,7 @@ main (int argc, char **argv)
/* Check for -P, -H or -L options. Also -D and -O, which are
* both GNU extensions.
*/
- end_of_leading_options = process_leading_options(argc, argv);
+ end_of_leading_options = process_leading_options (argc, argv);
if (options.debug_options & DebugStat)
options.xstat = debug_stat;
@@ -702,7 +705,7 @@ main (int argc, char **argv)
/* We are now processing the part of the "find" command line
* after the -H/-L options (if any).
*/
- eval_tree = build_expression_tree(argc, argv, end_of_leading_options);
+ eval_tree = build_expression_tree (argc, argv, end_of_leading_options);
/* safely_chdir() needs to check that it has ended up in the right place.
* To avoid bailing out when something gets automounted, it checks if
@@ -717,7 +720,7 @@ main (int argc, char **argv)
if (!options.open_nofollow_available)
{
#ifdef STAT_MOUNTPOINTS
- init_mounted_dev_list();
+ init_mounted_dev_list ();
#endif
}
@@ -739,19 +742,19 @@ main (int argc, char **argv)
error (1, errno, _("cannot get current directory"));
}
- process_all_startpoints(argc-end_of_leading_options,
argv+end_of_leading_options);
+ process_all_startpoints (argc-end_of_leading_options,
argv+end_of_leading_options);
/* If "-exec ... {} +" has been used, there may be some
* partially-full command lines which have been built,
* but which are not yet complete. Execute those now.
*/
- show_success_rates(eval_tree);
- cleanup();
+ show_success_rates (eval_tree);
+ cleanup ();
return state.exit_status;
}
boolean
-is_fts_enabled(int *fts_options)
+is_fts_enabled (int *fts_options)
{
/* this version of find (i.e. this main()) uses fts. */
*fts_options = ftsoptions;
diff --git a/find/parser.c b/find/parser.c
index 787d523..ddfaa1b 100644
--- a/find/parser.c
+++ b/find/parser.c
@@ -78,10 +78,10 @@
#define ISDIGIT(c) (isascii ((unsigned char)c) && isdigit ((unsigned char)c))
#ifndef HAVE_ENDGRENT
-#define endgrent()
+#define endgrent ()
#endif
#ifndef HAVE_ENDPWENT
-#define endpwent()
+#define endpwent ()
#endif
static boolean parse_accesscheck PARAMS((const struct parser_table* entry,
char **argv, int *arg_ptr));
@@ -433,7 +433,7 @@ optionp_getfilecon (int fd, const char *name,
security_context_t *p)
}
void
-check_option_combinations(const struct predicate *p)
+check_option_combinations (const struct predicate *p)
{
enum { seen_delete=1u, seen_prune=2u };
unsigned int predicates = 0u;
@@ -476,7 +476,7 @@ check_option_combinations(const struct predicate *p)
static const struct parser_table*
-get_noop(void)
+get_noop (void)
{
int i;
if (NULL == noop)
@@ -494,32 +494,32 @@ get_noop(void)
}
static int
-get_stat_Ytime(const struct stat *p,
- char what,
- struct timespec *ret)
+get_stat_Ytime (const struct stat *p,
+ char what,
+ struct timespec *ret)
{
switch (what)
{
case 'a':
- *ret = get_stat_atime(p);
+ *ret = get_stat_atime (p);
return 1;
case 'B':
- *ret = get_stat_birthtime(p);
+ *ret = get_stat_birthtime (p);
return (ret->tv_nsec >= 0);
case 'c':
- *ret = get_stat_ctime(p);
+ *ret = get_stat_ctime (p);
return 1;
case 'm':
- *ret = get_stat_mtime(p);
+ *ret = get_stat_mtime (p);
return 1;
default:
assert (0);
- abort();
+ abort ();
}
}
void
-set_follow_state(enum SymlinkOption opt)
+set_follow_state (enum SymlinkOption opt)
{
if (options.debug_options & DebugStat)
{
@@ -585,7 +585,7 @@ parse_end_user_args (char **args, int argno,
* position and return it.
*/
const struct parser_table*
-found_parser(const char *original_arg, const struct parser_table *entry)
+found_parser (const char *original_arg, const struct parser_table *entry)
{
/* If this is an option, but we have already had a
* non-option argument, the user may be under the
@@ -652,10 +652,10 @@ find_parser (char *search_name)
const char *original_arg = search_name;
/* Ugh. Special case -newerXY. */
- if (0 == strncmp("-newer", search_name, 6)
- && (8 == strlen(search_name)))
+ if (0 == strncmp ("-newer", search_name, 6)
+ && (8 == strlen (search_name)))
{
- return found_parser(original_arg, &parse_entry_newerXY);
+ return found_parser (original_arg, &parse_entry_newerXY);
}
if (*search_name == '-')
@@ -665,14 +665,14 @@ find_parser (char *search_name)
{
if (strcmp (parse_table[i].parser_name, search_name) == 0)
{
- return found_parser(original_arg, &parse_table[i]);
+ return found_parser (original_arg, &parse_table[i]);
}
}
return NULL;
}
static float
-estimate_file_age_success_rate(float num_days)
+estimate_file_age_success_rate (float num_days)
{
if (num_days < 0.1)
{
@@ -697,21 +697,21 @@ estimate_file_age_success_rate(float num_days)
}
static float
-estimate_timestamp_success_rate(time_t when)
+estimate_timestamp_success_rate (time_t when)
{
/* This calculation ignores the nanoseconds field of the
* origin, but I don't think that makes much difference
* to our estimate.
*/
int num_days = (options.cur_day_start.tv_sec - when) / 86400;
- return estimate_file_age_success_rate(num_days);
+ return estimate_file_age_success_rate (num_days);
}
/* Collect an argument from the argument list, or
* return false.
*/
static boolean
-collect_arg(char **argv, int *arg_ptr, const char **collected_arg)
+collect_arg (char **argv, int *arg_ptr, const char **collected_arg)
{
if ((argv == NULL) || (argv[*arg_ptr] == NULL))
{
@@ -727,11 +727,11 @@ collect_arg(char **argv, int *arg_ptr, const char
**collected_arg)
}
static boolean
-collect_arg_stat_info(char **argv, int *arg_ptr, struct stat *p,
- const char **argument)
+collect_arg_stat_info (char **argv, int *arg_ptr, struct stat *p,
+ const char **argument)
{
const char *filename;
- if (collect_arg(argv, arg_ptr, &filename))
+ if (collect_arg (argv, arg_ptr, &filename))
{
*argument = filename;
if (0 == (options.xstat)(filename, p))
@@ -740,7 +740,7 @@ collect_arg_stat_info(char **argv, int *arg_ptr, struct
stat *p,
}
else
{
- fatal_file_error(filename);
+ fatal_file_error (filename);
}
}
else
@@ -783,14 +783,14 @@ parse_anewer (const struct parser_table* entry, char
**argv, int *arg_ptr)
struct stat stat_newer;
const char *arg;
- set_stat_placeholders(&stat_newer);
- if (collect_arg_stat_info(argv, arg_ptr, &stat_newer, &arg))
+ set_stat_placeholders (&stat_newer);
+ if (collect_arg_stat_info (argv, arg_ptr, &stat_newer, &arg))
{
struct predicate *our_pred = insert_primary (entry, arg);
our_pred->args.reftime.xval = XVAL_ATIME;
- our_pred->args.reftime.ts = get_stat_mtime(&stat_newer);
+ our_pred->args.reftime.ts = get_stat_mtime (&stat_newer);
our_pred->args.reftime.kind = COMP_GT;
- our_pred->est_success_rate =
estimate_timestamp_success_rate(stat_newer.st_mtime);
+ our_pred->est_success_rate = estimate_timestamp_success_rate
(stat_newer.st_mtime);
return true;
}
return false;
@@ -818,14 +818,14 @@ parse_cnewer (const struct parser_table* entry, char
**argv, int *arg_ptr)
struct stat stat_newer;
const char *arg;
- set_stat_placeholders(&stat_newer);
- if (collect_arg_stat_info(argv, arg_ptr, &stat_newer, &arg))
+ set_stat_placeholders (&stat_newer);
+ if (collect_arg_stat_info (argv, arg_ptr, &stat_newer, &arg))
{
struct predicate *our_pred = insert_primary (entry, arg);
our_pred->args.reftime.xval = XVAL_CTIME; /* like -newercm */
- our_pred->args.reftime.ts = get_stat_mtime(&stat_newer);
+ our_pred->args.reftime.ts = get_stat_mtime (&stat_newer);
our_pred->args.reftime.kind = COMP_GT;
- our_pred->est_success_rate =
estimate_timestamp_success_rate(stat_newer.st_mtime);
+ our_pred->est_success_rate = estimate_timestamp_success_rate
(stat_newer.st_mtime);
return true;
}
return false;
@@ -900,7 +900,7 @@ parse_depth (const struct parser_table* entry, char **argv,
int *arg_ptr)
options.do_dir_first = false;
options.explicit_depth = true;
- return parse_noop(entry, argv, arg_ptr);
+ return parse_noop (entry, argv, arg_ptr);
}
static boolean
@@ -913,7 +913,7 @@ parse_d (const struct parser_table* entry, char **argv, int
*arg_ptr)
"-depth instead, because the latter is a "
"POSIX-compliant feature."));
}
- return parse_depth(entry, argv, arg_ptr);
+ return parse_depth (entry, argv, arg_ptr);
}
static boolean
@@ -931,7 +931,7 @@ parse_empty (const struct parser_table* entry, char **argv,
int *arg_ptr)
static boolean
parse_exec (const struct parser_table* entry, char **argv, int *arg_ptr)
{
- return insert_exec_ok ("-exec", entry, get_start_dirfd(), argv, arg_ptr);
+ return insert_exec_ok ("-exec", entry, get_start_dirfd (), argv, arg_ptr);
}
static boolean
@@ -973,9 +973,9 @@ static boolean
parse_fls (const struct parser_table* entry, char **argv, int *arg_ptr)
{
const char *filename;
- if (collect_arg(argv, arg_ptr, &filename))
+ if (collect_arg (argv, arg_ptr, &filename))
{
- if (insert_fls(entry, filename))
+ if (insert_fls (entry, filename))
return true;
else
--*arg_ptr; /* don't consume the invalid arg. */
@@ -986,8 +986,8 @@ parse_fls (const struct parser_table* entry, char **argv,
int *arg_ptr)
static boolean
parse_follow (const struct parser_table* entry, char **argv, int *arg_ptr)
{
- set_follow_state(SYMLINK_ALWAYS_DEREF);
- return parse_noop(entry, argv, arg_ptr);
+ set_follow_state (SYMLINK_ALWAYS_DEREF);
+ return parse_noop (entry, argv, arg_ptr);
}
static boolean
@@ -995,7 +995,7 @@ parse_fprint (const struct parser_table* entry, char
**argv, int *arg_ptr)
{
struct predicate *our_pred;
const char *filename;
- if (collect_arg(argv, arg_ptr, &filename))
+ if (collect_arg (argv, arg_ptr, &filename))
{
our_pred = insert_primary (entry, filename);
open_output_file (filename, &our_pred->args.printf_vec);
@@ -1011,7 +1011,7 @@ parse_fprint (const struct parser_table* entry, char
**argv, int *arg_ptr)
}
static boolean
-insert_fprint(const struct parser_table* entry, const char *filename)
+insert_fprint (const struct parser_table* entry, const char *filename)
{
struct predicate *our_pred = insert_primary (entry, filename);
if (filename)
@@ -1029,9 +1029,9 @@ static boolean
parse_fprint0 (const struct parser_table* entry, char **argv, int *arg_ptr)
{
const char *filename;
- if (collect_arg(argv, arg_ptr, &filename))
+ if (collect_arg (argv, arg_ptr, &filename))
{
- if (insert_fprint(entry, filename))
+ if (insert_fprint (entry, filename))
return true;
else
--*arg_ptr; /* don't consume the bad arg. */
@@ -1039,15 +1039,15 @@ parse_fprint0 (const struct parser_table* entry, char
**argv, int *arg_ptr)
return false;
}
-static float estimate_fstype_success_rate(const char *fsname)
+static float estimate_fstype_success_rate (const char *fsname)
{
struct stat dir_stat;
const char *dir = "/";
- if (0 == stat(dir, &dir_stat))
+ if (0 == stat (dir, &dir_stat))
{
- const char *fstype = filesystem_type(&dir_stat, dir);
+ const char *fstype = filesystem_type (&dir_stat, dir);
/* Assume most files are on the same file system type as the root fs. */
- if (0 == strcmp(fsname, fstype))
+ if (0 == strcmp (fsname, fstype))
return 0.7f;
else
return 0.3f;
@@ -1060,7 +1060,7 @@ static boolean
parse_fstype (const struct parser_table* entry, char **argv, int *arg_ptr)
{
const char *typename;
- if (collect_arg(argv, arg_ptr, &typename))
+ if (collect_arg (argv, arg_ptr, &typename))
{
struct predicate *our_pred = insert_primary (entry, typename);
our_pred->args.str = typename;
@@ -1070,7 +1070,7 @@ parse_fstype (const struct parser_table* entry, char
**argv, int *arg_ptr)
* because we probably don't want to promote this test to the
* front anyway.
*/
- our_pred->est_success_rate = estimate_fstype_success_rate(typename);
+ our_pred->est_success_rate = estimate_fstype_success_rate (typename);
return true;
}
else
@@ -1103,19 +1103,19 @@ safe_atoi (const char *s)
char *end;
errno = 0;
- lval = strtol(s, &end, 10);
+ lval = strtol (s, &end, 10);
if ( (LONG_MAX == lval) || (LONG_MIN == lval) )
{
/* max/min possible value, or an error. */
if (errno == ERANGE)
{
/* too big, or too small. */
- error(1, errno, "%s", s);
+ error (1, errno, "%s", s);
}
else
{
/* not a valid number */
- error(1, errno, "%s", s);
+ error (1, errno, "%s", s);
}
/* Otherwise, we do a range chack against INT_MAX and INT_MIN
* below.
@@ -1126,18 +1126,18 @@ safe_atoi (const char *s)
{
/* The number was in range for long, but not int. */
errno = ERANGE;
- error(1, errno, "%s", s);
+ error (1, errno, "%s", s);
}
else if (*end)
{
- error(1, errno, _("Unexpected suffix %s on %s"),
- quotearg_n_style(0, options.err_quoting_style, end),
- quotearg_n_style(1, options.err_quoting_style, s));
+ error (1, errno, _("Unexpected suffix %s on %s"),
+ quotearg_n_style (0, options.err_quoting_style, end),
+ quotearg_n_style (1, options.err_quoting_style, s));
}
else if (end == s)
{
- error(1, errno, "Expected an integer: %s",
- quotearg_n_style(0, options.err_quoting_style, s));
+ error (1, errno, "Expected an integer: %s",
+ quotearg_n_style (0, options.err_quoting_style, s));
}
return (int)lval;
}
@@ -1149,12 +1149,12 @@ parse_group (const struct parser_table* entry, char
**argv, int *arg_ptr)
const char *groupname;
const int saved_argc = *arg_ptr;
- if (collect_arg(argv, arg_ptr, &groupname))
+ if (collect_arg (argv, arg_ptr, &groupname))
{
gid_t gid;
struct predicate *our_pred;
- struct group *cur_gr = getgrnam(groupname);
- endgrent();
+ struct group *cur_gr = getgrnam (groupname);
+ endgrent ();
if (cur_gr)
{
gid = cur_gr->gr_gid;
@@ -1171,11 +1171,11 @@ parse_group (const struct parser_table* entry, char
**argv, int *arg_ptr)
else
{
/* XXX: no test in test suite for this */
- error(1, 0, _("%s is not the name of an existing group and"
- " it does not look like a numeric group ID "
- "because it has the unexpected suffix %s"),
- quotearg_n_style(0, options.err_quoting_style,
groupname),
- quotearg_n_style(1, options.err_quoting_style,
groupname+gid_len));
+ error (1, 0, _("%s is not the name of an existing group and"
+ " it does not look like a numeric group ID "
+ "because it has the unexpected suffix %s"),
+ quotearg_n_style (0, options.err_quoting_style,
groupname),
+ quotearg_n_style (1, options.err_quoting_style,
groupname+gid_len));
*arg_ptr = saved_argc; /* don't consume the invalid argument.
*/
return false;
}
@@ -1185,12 +1185,12 @@ parse_group (const struct parser_table* entry, char
**argv, int *arg_ptr)
if (*groupname)
{
/* XXX: no test in test suite for this */
- error(1, 0, _("%s is not the name of an existing group"),
- quotearg_n_style(0, options.err_quoting_style,
groupname));
+ error (1, 0, _("%s is not the name of an existing group"),
+ quotearg_n_style (0, options.err_quoting_style,
groupname));
}
else
{
- error(1, 0, _("argument to -group is empty, but should be a
group name"));
+ error (1, 0, _("argument to -group is empty, but should be a
group name"));
}
*arg_ptr = saved_argc; /* don't consume the invalid argument. */
return false;
@@ -1211,7 +1211,7 @@ parse_help (const struct parser_table* entry, char
**argv, int *arg_ptr)
(void) argv;
(void) arg_ptr;
- usage(stdout, 0, NULL);
+ usage (stdout, 0, NULL);
puts (_("\n\
default path is the current directory; default expression is -print\n\
expression may consist of: operators, options, tests, and actions:\n"));
@@ -1249,9 +1249,9 @@ email to <address@hidden>."));
}
static float
-estimate_pattern_match_rate(const char *pattern, int is_regex)
+estimate_pattern_match_rate (const char *pattern, int is_regex)
{
- if (strpbrk(pattern, "*?[") || (is_regex && strpbrk(pattern, ".")))
+ if (strpbrk (pattern, "*?[") || (is_regex && strpbrk(pattern, ".")))
{
/* A wildcard; assume the pattern matches most files. */
return 0.8f;
@@ -1266,14 +1266,14 @@ static boolean
parse_ilname (const struct parser_table* entry, char **argv, int *arg_ptr)
{
const char *name;
- if (collect_arg(argv, arg_ptr, &name))
+ if (collect_arg (argv, arg_ptr, &name))
{
struct predicate *our_pred = insert_primary (entry, name);
our_pred->args.str = name;
/* Use the generic glob pattern estimator to figure out how many
* links will match, but bear in mind that most files won't be links.
*/
- our_pred->est_success_rate = 0.1 * estimate_pattern_match_rate(name, 0);
+ our_pred->est_success_rate = 0.1 * estimate_pattern_match_rate (name, 0);
return true;
}
else
@@ -1287,14 +1287,14 @@ parse_ilname (const struct parser_table* entry, char
**argv, int *arg_ptr)
* is supported (as opposed to just having the flag ignored).
*/
static boolean
-fnmatch_sanitycheck(void)
+fnmatch_sanitycheck (void)
{
static boolean checked = false;
if (!checked)
{
- if (0 != fnmatch("foo", "foo", 0)
- || 0 == fnmatch("Foo", "foo", 0)
- || 0 != fnmatch("Foo", "foo", FNM_CASEFOLD))
+ if (0 != fnmatch ("foo", "foo", 0)
+ || 0 == fnmatch ("Foo", "foo", 0)
+ || 0 != fnmatch ("Foo", "foo", FNM_CASEFOLD))
{
error (1, 0, _("sanity check of the fnmatch() library function
failed."));
return false;
@@ -1306,20 +1306,20 @@ fnmatch_sanitycheck(void)
static boolean
-check_name_arg(const char *pred, const char *arg)
+check_name_arg (const char *pred, const char *arg)
{
- if (options.warnings && strchr(arg, '/'))
+ if (options.warnings && strchr (arg, '/'))
{
- error(0, 0,_("warning: Unix filenames usually don't contain slashes "
- "(though pathnames do). That means that '%s %s' will "
- "probably evaluate to false all the time on this system. "
- "You might find the '-wholename' test more useful, or "
- "perhaps '-samefile'. Alternatively, if you are using "
- "GNU grep, you could "
- "use 'find ... -print0 | grep -FzZ %s'."),
+ error (0, 0,_("warning: Unix filenames usually don't contain slashes "
+ "(though pathnames do). That means that '%s %s' will "
+ "probably evaluate to false all the time on this system. "
+ "You might find the '-wholename' test more useful, or "
+ "perhaps '-samefile'. Alternatively, if you are using "
+ "GNU grep, you could "
+ "use 'find ... -print0 | grep -FzZ %s'."),
pred,
- safely_quote_err_filename(0, arg),
- safely_quote_err_filename(1, arg));
+ safely_quote_err_filename (0, arg),
+ safely_quote_err_filename (1, arg));
}
return true; /* allow it anyway */
}
@@ -1330,15 +1330,15 @@ static boolean
parse_iname (const struct parser_table* entry, char **argv, int *arg_ptr)
{
const char *name;
- fnmatch_sanitycheck();
- if (collect_arg(argv, arg_ptr, &name))
+ fnmatch_sanitycheck ();
+ if (collect_arg (argv, arg_ptr, &name))
{
- if (check_name_arg("-iname", name))
+ if (check_name_arg ("-iname", name))
{
struct predicate *our_pred = insert_primary (entry, name);
our_pred->need_stat = our_pred->need_type = false;
our_pred->args.str = name;
- our_pred->est_success_rate = estimate_pattern_match_rate(name, 0);
+ our_pred->est_success_rate = estimate_pattern_match_rate (name, 0);
return true;
}
}
@@ -1398,12 +1398,12 @@ static boolean
parse_lname (const struct parser_table* entry, char **argv, int *arg_ptr)
{
const char *name;
- fnmatch_sanitycheck();
- if (collect_arg(argv, arg_ptr, &name))
+ fnmatch_sanitycheck ();
+ if (collect_arg (argv, arg_ptr, &name))
{
struct predicate *our_pred = insert_primary (entry, name);
our_pred->args.str = name;
- our_pred->est_success_rate = 0.1 * estimate_pattern_match_rate(name, 0);
+ our_pred->est_success_rate = 0.1 * estimate_pattern_match_rate (name, 0);
return true;
}
return false;
@@ -1414,17 +1414,17 @@ parse_ls (const struct parser_table* entry, char
**argv, int *arg_ptr)
{
(void) &argv;
(void) &arg_ptr;
- return insert_fls(entry, NULL);
+ return insert_fls (entry, NULL);
}
static boolean
-insert_depthspec(const struct parser_table* entry, char **argv, int *arg_ptr,
- int *limitptr)
+insert_depthspec (const struct parser_table* entry, char **argv, int *arg_ptr,
+ int *limitptr)
{
const char *depthstr;
int depth_len;
const char *predicate = argv[(*arg_ptr)-1];
- if (collect_arg(argv, arg_ptr, &depthstr))
+ if (collect_arg (argv, arg_ptr, &depthstr))
{
depth_len = strspn (depthstr, "0123456789");
if ((depth_len > 0) && (depthstr[depth_len] == 0))
@@ -1432,12 +1432,12 @@ insert_depthspec(const struct parser_table* entry, char
**argv, int *arg_ptr,
(*limitptr) = safe_atoi (depthstr);
if (*limitptr >= 0)
{
- return parse_noop(entry, argv, arg_ptr);
+ return parse_noop (entry, argv, arg_ptr);
}
}
- error(1, 0, _("Expected a positive decimal integer argument to %s, but
got %s"),
- predicate,
- quotearg_n_style(0, options.err_quoting_style, depthstr));
+ error (1, 0, _("Expected a positive decimal integer argument to %s, but
got %s"),
+ predicate,
+ quotearg_n_style (0, options.err_quoting_style, depthstr));
/* NOTREACHED */
return false;
}
@@ -1449,13 +1449,13 @@ insert_depthspec(const struct parser_table* entry, char
**argv, int *arg_ptr,
static boolean
parse_maxdepth (const struct parser_table* entry, char **argv, int *arg_ptr)
{
- return insert_depthspec(entry, argv, arg_ptr, &options.maxdepth);
+ return insert_depthspec (entry, argv, arg_ptr, &options.maxdepth);
}
static boolean
parse_mindepth (const struct parser_table* entry, char **argv, int *arg_ptr)
{
- return insert_depthspec(entry, argv, arg_ptr, &options.mindepth);
+ return insert_depthspec (entry, argv, arg_ptr, &options.mindepth);
}
@@ -1468,19 +1468,19 @@ do_parse_xmin (const struct parser_table* entry,
const char *minutes;
const int saved_argc = *arg_ptr;
- if (collect_arg(argv, arg_ptr, &minutes))
+ if (collect_arg (argv, arg_ptr, &minutes))
{
struct time_val tval;
struct timespec origin = options.cur_day_start;
tval.xval = xv;
origin.tv_sec += DAYSECS;
- if (get_relative_timestamp(minutes, &tval, origin, 60,
- "arithmetic overflow while converting %s "
- "minutes to a number of seconds"))
+ if (get_relative_timestamp (minutes, &tval, origin, 60,
+ "arithmetic overflow while converting %s "
+ "minutes to a number of seconds"))
{
struct predicate *our_pred = insert_primary (entry, minutes);
our_pred->args.reftime = tval;
- our_pred->est_success_rate =
estimate_timestamp_success_rate(tval.ts.tv_sec);
+ our_pred->est_success_rate = estimate_timestamp_success_rate
(tval.ts.tv_sec);
return true;
}
else
@@ -1494,20 +1494,20 @@ do_parse_xmin (const struct parser_table* entry,
static boolean
parse_amin (const struct parser_table* entry, char **argv, int *arg_ptr)
{
- return do_parse_xmin(entry, argv, arg_ptr, XVAL_ATIME);
+ return do_parse_xmin (entry, argv, arg_ptr, XVAL_ATIME);
}
static boolean
parse_cmin (const struct parser_table* entry, char **argv, int *arg_ptr)
{
- return do_parse_xmin(entry, argv, arg_ptr, XVAL_CTIME);
+ return do_parse_xmin (entry, argv, arg_ptr, XVAL_CTIME);
}
static boolean
parse_mmin (const struct parser_table* entry, char **argv, int *arg_ptr)
{
- return do_parse_xmin(entry, argv, arg_ptr, XVAL_MTIME);
+ return do_parse_xmin (entry, argv, arg_ptr, XVAL_MTIME);
}
static boolean
@@ -1516,15 +1516,15 @@ parse_name (const struct parser_table* entry, char
**argv, int *arg_ptr)
const char *name;
const int saved_argc = *arg_ptr;
- if (collect_arg(argv, arg_ptr, &name))
+ if (collect_arg (argv, arg_ptr, &name))
{
- fnmatch_sanitycheck();
- if (check_name_arg("-name", name))
+ fnmatch_sanitycheck ();
+ if (check_name_arg ("-name", name))
{
struct predicate *our_pred = insert_primary (entry, name);
our_pred->need_stat = our_pred->need_type = false;
our_pred->args.str = name;
- our_pred->est_success_rate = estimate_pattern_match_rate(name, 0);
+ our_pred->est_success_rate = estimate_pattern_match_rate (name, 0);
return true;
}
else
@@ -1558,14 +1558,14 @@ parse_newer (const struct parser_table* entry, char
**argv, int *arg_ptr)
struct stat stat_newer;
const char *arg;
- set_stat_placeholders(&stat_newer);
- if (collect_arg_stat_info(argv, arg_ptr, &stat_newer, &arg))
+ set_stat_placeholders (&stat_newer);
+ if (collect_arg_stat_info (argv, arg_ptr, &stat_newer, &arg))
{
our_pred = insert_primary (entry, arg);
- our_pred->args.reftime.ts = get_stat_mtime(&stat_newer);
+ our_pred->args.reftime.ts = get_stat_mtime (&stat_newer);
our_pred->args.reftime.xval = XVAL_MTIME;
our_pred->args.reftime.kind = COMP_GT;
- our_pred->est_success_rate =
estimate_timestamp_success_rate(stat_newer.st_mtime);
+ our_pred->est_success_rate = estimate_timestamp_success_rate
(stat_newer.st_mtime);
return true;
}
return false;
@@ -1582,7 +1582,7 @@ parse_newerXY (const struct parser_table* entry, char
**argv, int *arg_ptr)
{
return false;
}
- else if (8u != strlen(argv[*arg_ptr]))
+ else if (8u != strlen (argv[*arg_ptr]))
{
return false;
}
@@ -1591,7 +1591,7 @@ parse_newerXY (const struct parser_table* entry, char
**argv, int *arg_ptr)
char x, y;
const char validchars[] = "aBcmt";
- assert (0 == strncmp("-newer", argv[*arg_ptr], 6));
+ assert (0 == strncmp ("-newer", argv[*arg_ptr], 6));
x = argv[*arg_ptr][6];
y = argv[*arg_ptr][7];
@@ -1599,16 +1599,16 @@ parse_newerXY (const struct parser_table* entry, char
**argv, int *arg_ptr)
#if !defined(HAVE_STRUCT_STAT_ST_BIRTHTIME) &&
!defined(HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC) &&
!defined(HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC) && !defined
HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC
if ('B' == x || 'B' == y)
{
- error(0, 0,
- _("This system does not provide a way to find the birth time of
a file."));
+ error (0, 0,
+ _("This system does not provide a way to find the birth time
of a file."));
return false;
}
#endif
/* -newertY (for any Y) is invalid. */
if (x == 't'
- || 0 == strchr(validchars, x)
- || 0 == strchr( validchars, y))
+ || 0 == strchr (validchars, x)
+ || 0 == strchr ( validchars, y))
{
return false;
}
@@ -1621,8 +1621,8 @@ parse_newerXY (const struct parser_table* entry, char
**argv, int *arg_ptr)
*/
if (argv[1+*arg_ptr] == NULL)
{
- error(1, 0, _("The %s test needs an argument"),
- quotearg_n_style(0, options.err_quoting_style,
argv[*arg_ptr]));
+ error (1, 0, _("The %s test needs an argument"),
+ quotearg_n_style (0, options.err_quoting_style,
argv[*arg_ptr]));
}
else
{
@@ -1647,19 +1647,19 @@ parse_newerXY (const struct parser_table* entry, char
**argv, int *arg_ptr)
our_pred->args.reftime.xval = XVAL_MTIME;
break;
default:
- assert (strchr(validchars, x));
+ assert (strchr (validchars, x));
assert (0);
}
if ('t' == y)
{
- if (!get_date(&our_pred->args.reftime.ts,
+ if (!get_date (&our_pred->args.reftime.ts,
argv[*arg_ptr],
&options.start_time))
{
- error(1, 0,
- _("I cannot figure out how to interpret %s as a date or
time"),
- quotearg_n_style(0, options.err_quoting_style,
argv[*arg_ptr]));
+ error (1, 0,
+ _("I cannot figure out how to interpret %s as a date
or time"),
+ quotearg_n_style (0, options.err_quoting_style,
argv[*arg_ptr]));
}
}
else
@@ -1667,19 +1667,19 @@ parse_newerXY (const struct parser_table* entry, char
**argv, int *arg_ptr)
struct stat stat_newer;
/* Stat the named file. */
- set_stat_placeholders(&stat_newer);
+ set_stat_placeholders (&stat_newer);
if ((*options.xstat) (argv[*arg_ptr], &stat_newer))
- fatal_file_error(argv[*arg_ptr]);
+ fatal_file_error (argv[*arg_ptr]);
- if (!get_stat_Ytime(&stat_newer, y, &our_pred->args.reftime.ts))
+ if (!get_stat_Ytime (&stat_newer, y, &our_pred->args.reftime.ts))
{
/* We cannot extract a timestamp from the struct stat. */
- error(1, 0, _("Cannot obtain birth time of file %s"),
- safely_quote_err_filename(0, argv[*arg_ptr]));
+ error (1, 0, _("Cannot obtain birth time of file %s"),
+ safely_quote_err_filename (0, argv[*arg_ptr]));
}
}
our_pred->args.reftime.kind = COMP_GT;
- our_pred->est_success_rate =
estimate_timestamp_success_rate(our_pred->args.reftime.ts.tv_sec);
+ our_pred->est_success_rate = estimate_timestamp_success_rate
(our_pred->args.reftime.ts.tv_sec);
(*arg_ptr)++;
assert (our_pred->pred_func != NULL);
@@ -1695,7 +1695,7 @@ static boolean
parse_noleaf (const struct parser_table* entry, char **argv, int *arg_ptr)
{
options.no_leaf_check = true;
- return parse_noop(entry, argv, arg_ptr);
+ return parse_noop (entry, argv, arg_ptr);
}
#ifdef CACHE_IDS
@@ -1792,13 +1792,13 @@ static boolean
parse_nowarn (const struct parser_table* entry, char **argv, int *arg_ptr)
{
options.warnings = false;
- return parse_noop(entry, argv, arg_ptr);
+ return parse_noop (entry, argv, arg_ptr);
}
static boolean
parse_ok (const struct parser_table* entry, char **argv, int *arg_ptr)
{
- return insert_exec_ok ("-ok", entry, get_start_dirfd(), argv, arg_ptr);
+ return insert_exec_ok ("-ok", entry, get_start_dirfd (), argv, arg_ptr);
}
static boolean
@@ -1840,7 +1840,7 @@ parse_or (const struct parser_table* entry, char **argv,
int *arg_ptr)
}
static boolean
-is_feasible_path_argument(const char *arg, boolean foldcase)
+is_feasible_path_argument (const char *arg, boolean foldcase)
{
const char *last = strrchr (arg, '/');
if (last && !last[1])
@@ -1880,7 +1880,7 @@ insert_path_check (const struct parser_table* entry, char
**argv, int *arg_ptr,
our_pred->est_success_rate = estimate_pattern_match_rate (name, 0);
if (!options.posixly_correct
- && !is_feasible_path_argument(name, foldcase))
+ && !is_feasible_path_argument (name, foldcase))
{
error (0, 0, _("warning: -%s %s will not match anything "
"because it ends with /."),
@@ -1933,12 +1933,12 @@ parse_iwholename (const struct parser_table* entry,
char **argv, int *arg_ptr)
}
static void
-non_posix_mode(const char *mode)
+non_posix_mode (const char *mode)
{
if (options.posixly_correct)
{
error (1, 0, _("Mode %s is not valid when POSIXLY_CORRECT is on."),
- quotearg_n_style(0, options.err_quoting_style, mode));
+ quotearg_n_style (0, options.err_quoting_style, mode));
}
}
@@ -1955,7 +1955,7 @@ parse_perm (const struct parser_table* entry, char
**argv, int *arg_ptr)
struct predicate *our_pred;
const char *perm_expr;
- if (!collect_arg(argv, arg_ptr, &perm_expr))
+ if (!collect_arg (argv, arg_ptr, &perm_expr))
return false;
switch (perm_expr[0])
@@ -1980,7 +1980,7 @@ parse_perm (const struct parser_table* entry, char
**argv, int *arg_ptr)
*
* Example: POSIXLY_CORRECT=y find -perm +a+x
*/
- non_posix_mode(perm_expr);
+ non_posix_mode (perm_expr);
/* support the previous behaviour. */
mode_start = 1;
@@ -1998,7 +1998,7 @@ parse_perm (const struct parser_table* entry, char
**argv, int *arg_ptr)
break;
case '/': /* GNU extension */
- non_posix_mode(perm_expr);
+ non_posix_mode (perm_expr);
mode_start = 1;
kind = PERM_ANY;
havekind = true;
@@ -2021,7 +2021,7 @@ parse_perm (const struct parser_table* entry, char
**argv, int *arg_ptr)
change = mode_compile (perm_expr + mode_start);
if (NULL == change)
error (1, 0, _("invalid mode %s"),
- quotearg_n_style(0, options.err_quoting_style, perm_expr));
+ quotearg_n_style (0, options.err_quoting_style, perm_expr));
}
perm_val[0] = mode_adjust (0, false, 0, change, NULL);
perm_val[1] = mode_adjust (0, true, 0, change, NULL);
@@ -2095,14 +2095,14 @@ parse_print (const struct parser_table* entry, char
**argv, int *arg_ptr)
already specified -print. */
our_pred->side_effects = our_pred->no_default_print = true;
our_pred->need_stat = our_pred->need_type = false;
- open_stdout(&our_pred->args.printf_vec);
+ open_stdout (&our_pred->args.printf_vec);
return true;
}
static boolean
parse_print0 (const struct parser_table* entry, char **argv, int *arg_ptr)
{
- return insert_fprint(entry, NULL);
+ return insert_fprint (entry, NULL);
}
static boolean
@@ -2111,10 +2111,10 @@ parse_printf (const struct parser_table* entry, char
**argv, int *arg_ptr)
const char *format;
const int saved_argc = *arg_ptr;
- if (collect_arg(argv, arg_ptr, &format))
+ if (collect_arg (argv, arg_ptr, &format))
{
struct format_val fmt;
- open_stdout(&fmt);
+ open_stdout (&fmt);
if (insert_fprintf (&fmt, entry, pred_fprintf, format))
{
return true;
@@ -2134,9 +2134,9 @@ parse_fprintf (const struct parser_table* entry, char
**argv, int *arg_ptr)
const char *format, *filename;
int saved_argc = *arg_ptr;
- if (collect_arg(argv, arg_ptr, &filename))
+ if (collect_arg (argv, arg_ptr, &filename))
{
- if (collect_arg(argv, arg_ptr, &format))
+ if (collect_arg (argv, arg_ptr, &format))
{
struct format_val fmt;
open_output_file (filename, &fmt);
@@ -2186,11 +2186,11 @@ static boolean
parse_regextype (const struct parser_table* entry, char **argv, int *arg_ptr)
{
const char *type_name;
- if (collect_arg(argv, arg_ptr, &type_name))
+ if (collect_arg (argv, arg_ptr, &type_name))
{
/* collect the regex type name */
- options.regex_options = get_regex_type(type_name);
- return parse_noop(entry, argv, arg_ptr);
+ options.regex_options = get_regex_type (type_name);
+ return parse_noop (entry, argv, arg_ptr);
}
return false;
}
@@ -2209,7 +2209,7 @@ insert_regex (char **argv,
int regex_options)
{
const char *rx;
- if (collect_arg(argv, arg_ptr, &rx))
+ if (collect_arg (argv, arg_ptr, &rx))
{
struct re_pattern_buffer *re;
const char *error_message;
@@ -2221,14 +2221,14 @@ insert_regex (char **argv,
re->buffer = xmalloc (re->allocated);
re->fastmap = NULL;
- re_set_syntax(regex_options);
+ re_set_syntax (regex_options);
re->syntax = regex_options;
re->translate = NULL;
- error_message = re_compile_pattern (rx, strlen(rx), re);
+ error_message = re_compile_pattern (rx, strlen (rx), re);
if (error_message)
error (1, 0, "%s", error_message);
- our_pred->est_success_rate = estimate_pattern_match_rate(rx, 1);
+ our_pred->est_success_rate = estimate_pattern_match_rate (rx, 1);
return true;
}
return false;
@@ -2308,9 +2308,9 @@ parse_size (const struct parser_table* entry, char
**argv, int *arg_ptr)
/* TODO: accept fractional megabytes etc. ? */
if (!get_num (arg, &num, &c_type))
{
- error(1, 0,
- _("Invalid argument `%s%c' to -size"),
- arg, (int)suffix);
+ error (1, 0,
+ _("Invalid argument `%s%c' to -size"),
+ arg, (int)suffix);
return false;
}
our_pred = insert_primary (entry, arg);
@@ -2343,11 +2343,11 @@ parse_samefile (const struct parser_table* entry, char
**argv, int *arg_ptr)
int fd, openflags;
const char *filename;
- set_stat_placeholders(&st);
- if (!collect_arg_stat_info(argv, arg_ptr, &st, &filename))
+ set_stat_placeholders (&st);
+ if (!collect_arg_stat_info (argv, arg_ptr, &st, &filename))
return false;
- set_stat_placeholders(&fst);
+ set_stat_placeholders (&fst);
/* POSIX systems are free to re-use the inode number of a deleted
* file. To ensure that we are not fooled by inode reuse, we hold
* the file open if we can. This would prevent the system reusing
@@ -2397,16 +2397,16 @@ parse_samefile (const struct parser_table* entry, char
**argv, int *arg_ptr)
* symbolic link in between out call to stat and
* the call to open.
*/
- fd = open(argv[*arg_ptr], openflags);
+ fd = open (argv[*arg_ptr], openflags);
if (fd >= 0)
{
/* We stat the file again here to prevent a race condition
* between the first stat and the call to open(2).
*/
- if (0 != fstat(fd, &fst))
+ if (0 != fstat (fd, &fst))
{
- fatal_file_error(argv[*arg_ptr]);
+ fatal_file_error (argv[*arg_ptr]);
}
else
{
@@ -2416,7 +2416,7 @@ parse_samefile (const struct parser_table* entry, char
**argv, int *arg_ptr)
* destination of the link, not the link itself.
*/
if ((*options.xstat) (argv[*arg_ptr], &st))
- fatal_file_error(argv[*arg_ptr]);
+ fatal_file_error (argv[*arg_ptr]);
if ((options.symlink_handling == SYMLINK_NEVER_DEREF)
&& (!options.open_nofollow_available))
@@ -2426,7 +2426,7 @@ parse_samefile (const struct parser_table* entry, char
**argv, int *arg_ptr)
/* We lost the race. Leave the data in st. The
* file descriptor points to the wrong thing.
*/
- close(fd);
+ close (fd);
fd = -1;
}
else
@@ -2456,7 +2456,7 @@ parse_samefile (const struct parser_table* entry, char
**argv, int *arg_ptr)
/* We lost the race. Leave the data in st. The
* file descriptor points to the wrong thing.
*/
- close(fd);
+ close (fd);
fd = -1;
}
}
@@ -2504,11 +2504,11 @@ parse_show_control_chars (const struct parser_table*
entry,
{
arg = argv[*arg_ptr];
- if (0 == strcmp("literal", arg))
+ if (0 == strcmp ("literal", arg))
{
options.literal_control_chars = true;
}
- else if (0 == strcmp("safe", arg))
+ else if (0 == strcmp ("safe", arg))
{
options.literal_control_chars = false;
}
@@ -2542,7 +2542,7 @@ static boolean
parse_noop (const struct parser_table* entry, char **argv, int *arg_ptr)
{
(void) entry;
- return parse_true(get_noop(), argv, arg_ptr);
+ return parse_true (get_noop (), argv, arg_ptr);
}
static boolean
@@ -2591,20 +2591,20 @@ parse_used (const struct parser_table* entry, char
**argv, int *arg_ptr)
const char *offset_str;
const char *errmsg = "arithmetic overflow while converting %s days to a
number of seconds";
- if (collect_arg(argv, arg_ptr, &offset_str))
+ if (collect_arg (argv, arg_ptr, &offset_str))
{
/* The timespec is actually a delta value, so we use an origin of 0. */
struct timespec zero = {0,0};
- if (get_relative_timestamp(offset_str, &tval, zero, DAYSECS, errmsg))
+ if (get_relative_timestamp (offset_str, &tval, zero, DAYSECS, errmsg))
{
our_pred = insert_primary (entry, offset_str);
our_pred->args.reftime = tval;
- our_pred->est_success_rate =
estimate_file_age_success_rate(tval.ts.tv_sec / DAYSECS);
+ our_pred->est_success_rate = estimate_file_age_success_rate
(tval.ts.tv_sec / DAYSECS);
return true;
}
else
{
- error(1, 0, _("Invalid argument %s to -used"), offset_str);
+ error (1, 0, _("Invalid argument %s to -used"), offset_str);
/*NOTREACHED*/
return false;
}
@@ -2620,12 +2620,12 @@ parse_user (const struct parser_table* entry, char
**argv, int *arg_ptr)
{
const char *username;
- if (collect_arg(argv, arg_ptr, &username))
+ if (collect_arg (argv, arg_ptr, &username))
{
struct predicate *our_pred;
uid_t uid;
- struct passwd *cur_pwd = getpwnam(username);
- endpwent();
+ struct passwd *cur_pwd = getpwnam (username);
+ endpwent ();
if (cur_pwd != NULL)
{
uid = cur_pwd->pw_uid;
@@ -2674,32 +2674,32 @@ parse_version (const struct parser_table* entry, char
**argv, int *arg_ptr)
(void) arg_ptr;
(void) entry;
- display_findutils_version("find");
+ display_findutils_version ("find");
printf (_("Features enabled: "));
#if CACHE_IDS
- printf("CACHE_IDS ");
+ printf ("CACHE_IDS ");
++features;
#endif
#if DEBUG
- printf("DEBUG ");
+ printf ("DEBUG ");
++features;
#endif
#if DEBUG_STAT
- printf("DEBUG_STAT ");
+ printf ("DEBUG_STAT ");
++features;
#endif
#if defined USE_STRUCT_DIRENT_D_TYPE && defined HAVE_STRUCT_DIRENT_D_TYPE
- printf("D_TYPE ");
+ printf ("D_TYPE ");
++features;
#endif
#if defined O_NOFOLLOW
- printf("O_NOFOLLOW(%s) ",
- (options.open_nofollow_available ? "enabled" : "disabled"));
+ printf ("O_NOFOLLOW(%s) ",
+ (options.open_nofollow_available ? "enabled" : "disabled"));
++features;
#endif
#if defined LEAF_OPTIMISATION
- printf("LEAF_OPTIMISATION ");
+ printf ("LEAF_OPTIMISATION ");
++features;
#endif
if (0 < is_selinux_enabled ())
@@ -2709,34 +2709,34 @@ parse_version (const struct parser_table* entry, char
**argv, int *arg_ptr)
}
flags = 0;
- if (is_fts_enabled(&flags))
+ if (is_fts_enabled (&flags))
{
int nflags = 0;
- printf("FTS(");
+ printf ("FTS(");
++features;
if (flags & FTS_CWDFD)
{
if (nflags)
{
- printf(",");
+ printf (",");
}
- printf("FTS_CWDFD");
+ printf ("FTS_CWDFD");
++nflags;
}
- printf(") ");
+ printf (") ");
}
- printf("CBO(level=%d) ", (int)(options.optimisation_level));
+ printf ("CBO(level=%d) ", (int)(options.optimisation_level));
++features;
if (0 == features)
{
/* For the moment, leave this as English in case someone wants
to parse these strings. */
- printf("none");
+ printf ("none");
}
- printf("\n");
+ printf ("\n");
exit (0);
}
@@ -2770,28 +2770,28 @@ static boolean
parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr)
{
options.stay_on_filesystem = true;
- return parse_noop(entry, argv, arg_ptr);
+ return parse_noop (entry, argv, arg_ptr);
}
static boolean
parse_ignore_race (const struct parser_table* entry, char **argv, int *arg_ptr)
{
options.ignore_readdir_race = true;
- return parse_noop(entry, argv, arg_ptr);
+ return parse_noop (entry, argv, arg_ptr);
}
static boolean
parse_noignore_race (const struct parser_table* entry, char **argv, int
*arg_ptr)
{
options.ignore_readdir_race = false;
- return parse_noop(entry, argv, arg_ptr);
+ return parse_noop (entry, argv, arg_ptr);
}
static boolean
parse_warn (const struct parser_table* entry, char **argv, int *arg_ptr)
{
options.warnings = true;
- return parse_noop(entry, argv, arg_ptr);
+ return parse_noop (entry, argv, arg_ptr);
}
static boolean
@@ -2810,11 +2810,11 @@ insert_type (char **argv, int *arg_ptr,
float rate = 0.5;
const char *typeletter;
- if (collect_arg(argv, arg_ptr, &typeletter))
+ if (collect_arg (argv, arg_ptr, &typeletter))
{
- if (strlen(typeletter) != 1u)
+ if (strlen (typeletter) != 1u)
{
- error(1, 0, _("Arguments to -type should contain only one letter"));
+ error (1, 0, _("Arguments to -type should contain only one letter"));
/*NOTREACHED*/
return false;
}
@@ -2862,7 +2862,7 @@ insert_type (char **argv, int *arg_ptr,
break;
#endif
default: /* None of the above ... nuke 'em. */
- error(1, 0, _("Unknown argument to -type: %c"), (*typeletter));
+ error (1, 0, _("Unknown argument to -type: %c"), (*typeletter));
/*NOTREACHED*/
return false;
}
@@ -2893,16 +2893,16 @@ insert_type (char **argv, int *arg_ptr,
/* Return true if the file accessed via FP is a terminal.
*/
static boolean
-stream_is_tty(FILE *fp)
+stream_is_tty (FILE *fp)
{
- int fd = fileno(fp);
+ int fd = fileno (fp);
if (-1 == fd)
{
return false; /* not a valid stream */
}
else
{
- return isatty(fd) ? true : false;
+ return isatty (fd) ? true : false;
}
}
@@ -3206,10 +3206,10 @@ make_segment (struct segment **segment,
}
static void
-check_path_safety(const char *action, char **argv)
+check_path_safety (const char *action, char **argv)
{
char *s;
- const char *path = getenv("PATH");
+ const char *path = getenv ("PATH");
if (NULL == path)
{
/* $PATH is not set. Assume the OS default is safe.
@@ -3222,28 +3222,28 @@ check_path_safety(const char *action, char **argv)
(void)argv;
- s = next_element(path, 1);
+ s = next_element (path, 1);
while ((s = next_element ((char *) NULL, 1)) != NULL)
{
- if (0 == strcmp(s, "."))
+ if (0 == strcmp (s, "."))
{
- error(1, 0, _("The current directory is included in the PATH "
- "environment variable, which is insecure in "
- "combination with the %s action of find. "
- "Please remove the current directory from your "
- "$PATH (that is, remove \".\" or leading or trailing "
- "colons)"),
+ error (1, 0, _("The current directory is included in the PATH "
+ "environment variable, which is insecure in "
+ "combination with the %s action of find. "
+ "Please remove the current directory from your "
+ "$PATH (that is, remove \".\" or leading or trailing "
+ "colons)"),
action);
}
else if ('/' != s[0])
{
/* Relative paths are also dangerous in $PATH. */
- error(1, 0, _("The relative path %s is included in the PATH "
- "environment variable, which is insecure in "
- "combination with the %s action of find. "
- "Please remove that entry from $PATH"),
- safely_quote_err_filename(0, s),
- action);
+ error (1, 0, _("The relative path %s is included in the PATH "
+ "environment variable, which is insecure in "
+ "combination with the %s action of find. "
+ "Please remove that entry from $PATH"),
+ safely_quote_err_filename (0, s),
+ action);
}
}
}
@@ -3296,7 +3296,7 @@ new_insert_exec_ok (const char *action,
if ((func == pred_execdir) || (func == pred_okdir))
{
options.ignore_readdir_race = false;
- check_path_safety(action, argv);
+ check_path_safety (action, argv);
execp->use_current_dir = true;
}
else
@@ -3341,9 +3341,9 @@ new_insert_exec_ok (const char *action,
* allowed. We can specify this as those options are
* not defined by POSIX.
*/
- error(1, 0, _("You may not use {} within the utility name for "
- "-execdir and -okdir, because this is a potential "
- "security problem."));
+ error (1, 0, _("You may not use {} within the utility name for "
+ "-execdir and -okdir, because this is a potential "
+ "security problem."));
}
}
}
@@ -3352,7 +3352,7 @@ new_insert_exec_ok (const char *action,
if ((end == start) || (argv[end] == NULL))
{
*arg_ptr = end;
- free(our_pred);
+ free (our_pred);
return false;
}
@@ -3365,9 +3365,9 @@ new_insert_exec_ok (const char *action,
else
suffix = "";
- error(1, 0,
- _("Only one instance of {} is supported with -exec%s ... +"),
- suffix);
+ error (1, 0,
+ _("Only one instance of {} is supported with -exec%s ... +"),
+ suffix);
}
/* We use a switch statement here so that the compiler warns us when
@@ -3377,19 +3377,19 @@ new_insert_exec_ok (const char *action,
* export its own environment variables before calling something
* else.
*/
- bcstatus = bc_init_controlinfo(&execp->ctl, 2048u);
+ bcstatus = bc_init_controlinfo (&execp->ctl, 2048u);
switch (bcstatus)
{
case BC_INIT_ENV_TOO_BIG:
case BC_INIT_CANNOT_ACCOMODATE_HEADROOM:
- error(1, 0,
- _("The environment is too large for exec()."));
+ error (1, 0,
+ _("The environment is too large for exec()."));
break;
case BC_INIT_OK:
/* Good news. Carry on. */
break;
}
- bc_use_sensible_arg_max(&execp->ctl);
+ bc_use_sensible_arg_max (&execp->ctl);
execp->ctl.exec_callback = launch;
@@ -3409,15 +3409,15 @@ new_insert_exec_ok (const char *action,
execp->ctl.initial_argc = (end-start) - 1;
/* execp->state = xmalloc(sizeof struct buildcmd_state); */
- bc_init_state(&execp->ctl, &execp->state, execp);
+ bc_init_state (&execp->ctl, &execp->state, execp);
/* Gather the initial arguments. Skip the {}. */
for (i=start; i<end-1; ++i)
{
- bc_push_arg(&execp->ctl, &execp->state,
- argv[i], strlen(argv[i])+1,
- NULL, 0,
- 1);
+ bc_push_arg (&execp->ctl, &execp->state,
+ argv[i], strlen (argv[i])+1,
+ NULL, 0,
+ 1);
}
}
else
@@ -3428,14 +3428,14 @@ new_insert_exec_ok (const char *action,
execp->num_args = end - start;
execp->ctl.replace_pat = "{}";
- execp->ctl.rplen = strlen(execp->ctl.replace_pat);
+ execp->ctl.rplen = strlen (execp->ctl.replace_pat);
execp->ctl.lines_per_exec = 0; /* no limit */
execp->ctl.args_per_exec = 0; /* no limit */
- execp->replace_vec = xmalloc(sizeof(char*)*execp->num_args);
+ execp->replace_vec = xmalloc (sizeof(char*)*execp->num_args);
/* execp->state = xmalloc(sizeof(*(execp->state))); */
- bc_init_state(&execp->ctl, &execp->state, execp);
+ bc_init_state (&execp->ctl, &execp->state, execp);
/* Remember the (pre-replacement) arguments for later. */
for (i=0; i<execp->num_args; ++i)
@@ -3461,7 +3461,7 @@ insert_exec_ok (const char *action,
char **argv,
int *arg_ptr)
{
- return new_insert_exec_ok(action, entry, dir_fd, argv, arg_ptr);
+ return new_insert_exec_ok (action, entry, dir_fd, argv, arg_ptr);
}
@@ -3489,7 +3489,7 @@ get_relative_timestamp (const char *str,
double offset, seconds, nanosec;
static const long nanosec_per_sec = 1000000000;
- if (get_comp_type(&str, &result->kind))
+ if (get_comp_type (&str, &result->kind))
{
/* Invert the sense of the comparison */
switch (result->kind)
@@ -3500,13 +3500,13 @@ get_relative_timestamp (const char *str,
}
/* Convert the ASCII number into floating-point. */
- if (xstrtod(str, NULL, &offset, strtod))
+ if (xstrtod (str, NULL, &offset, strtod))
{
/* Separate the floating point number the user specified
* (which is a number of days, or minutes, etc) into an
* integral number of seconds (SECONDS) and a fraction (NANOSEC).
*/
- nanosec = modf(offset * sec_per_unit, &seconds);
+ nanosec = modf (offset * sec_per_unit, &seconds);
nanosec *= 1.0e9; /* convert from fractional seconds to ns. */
assert (nanosec < nanosec_per_sec);
@@ -3568,14 +3568,14 @@ parse_time (const struct parser_table* entry, char
*argv[], int *arg_ptr)
struct timespec origin;
const int saved_argc = *arg_ptr;
- if (!collect_arg(argv, arg_ptr, &timearg))
+ if (!collect_arg (argv, arg_ptr, &timearg))
return false;
orig_timearg = timearg;
/* Decide the origin by previewing the comparison type. */
origin = options.cur_day_start;
- if (get_comp_type(&timearg, &comp))
+ if (get_comp_type (&timearg, &comp))
{
/* Remember, we invert the sense of the comparison, so this tests
* against COMP_LT instead of COMP_GT...
@@ -3586,8 +3586,8 @@ parse_time (const struct parser_table* entry, char
*argv[], int *arg_ptr)
origin.tv_sec += (DAYSECS-1);
if (origin.tv_sec != expected)
{
- error(1, 0,
- _("arithmetic overflow when trying to calculate the end of
today"));
+ error (1, 0,
+ _("arithmetic overflow when trying to calculate the end of
today"));
}
}
}
@@ -3598,7 +3598,7 @@ parse_time (const struct parser_table* entry, char
*argv[], int *arg_ptr)
*/
timearg = orig_timearg;
- if (!get_relative_timestamp(timearg, &tval, origin, DAYSECS, errmsg))
+ if (!get_relative_timestamp (timearg, &tval, origin, DAYSECS, errmsg))
{
*arg_ptr = saved_argc; /* don't consume the invalid argument */
return false;
@@ -3606,7 +3606,7 @@ parse_time (const struct parser_table* entry, char
*argv[], int *arg_ptr)
our_pred = insert_primary (entry, orig_timearg);
our_pred->args.reftime = tval;
- our_pred->est_success_rate = estimate_timestamp_success_rate(tval.ts.tv_sec);
+ our_pred->est_success_rate = estimate_timestamp_success_rate
(tval.ts.tv_sec);
if (options.debug_options & DebugExpressionTree)
{
@@ -3640,7 +3640,7 @@ parse_time (const struct parser_table* entry, char
*argv[], int *arg_ptr)
Return true if all okay, false if input error. */
static boolean
-get_comp_type(const char **str, enum comparison_type *comp_type)
+get_comp_type (const char **str, enum comparison_type *comp_type)
{
switch (**str)
{
@@ -3686,7 +3686,7 @@ get_num (const char *str,
/* Figure out the comparison type if the caller accepts one. */
if (comp_type)
{
- if (!get_comp_type(&str, comp_type))
+ if (!get_comp_type (&str, comp_type))
return false;
}
@@ -3710,7 +3710,7 @@ insert_num (char **argv, int *arg_ptr, const struct
parser_table *entry)
{
const char *numstr;
- if (collect_arg(argv, arg_ptr, &numstr))
+ if (collect_arg (argv, arg_ptr, &numstr))
{
uintmax_t num;
enum comparison_type c_type;
@@ -3770,5 +3770,5 @@ open_output_file (const char *path, struct format_val *p)
static void
open_stdout (struct format_val *p)
{
- open_output_file("/dev/stdout", p);
+ open_output_file ("/dev/stdout", p);
}
diff --git a/find/pred.c b/find/pred.c
index 63c49dd..c8820d4 100644
--- a/find/pred.c
+++ b/find/pred.c
@@ -239,18 +239,18 @@ struct pred_assoc pred_table[] =
#endif
/* Returns ts1 - ts2 */
-static double ts_difference(struct timespec ts1,
- struct timespec ts2)
+static double ts_difference (struct timespec ts1,
+ struct timespec ts2)
{
- double d = difftime(ts1.tv_sec, ts2.tv_sec)
+ double d = difftime (ts1.tv_sec, ts2.tv_sec)
+ (1.0e-9 * (ts1.tv_nsec - ts2.tv_nsec));
return d;
}
static int
-compare_ts(struct timespec ts1,
- struct timespec ts2)
+compare_ts (struct timespec ts1,
+ struct timespec ts2)
{
if ((ts1.tv_sec == ts2.tv_sec) &&
(ts1.tv_nsec == ts2.tv_nsec))
@@ -259,7 +259,7 @@ compare_ts(struct timespec ts1,
}
else
{
- double diff = ts_difference(ts1, ts2);
+ double diff = ts_difference (ts1, ts2);
return diff < 0.0 ? -1 : +1;
}
}
@@ -281,15 +281,15 @@ compare_ts(struct timespec ts1,
* COMP_EQ: after the specified time but by not more than WINDOW seconds.
*/
static boolean
-pred_timewindow(struct timespec ts, struct predicate const *pred_ptr, int
window)
+pred_timewindow (struct timespec ts, struct predicate const *pred_ptr, int
window)
{
switch (pred_ptr->args.reftime.kind)
{
case COMP_GT:
- return compare_ts(ts, pred_ptr->args.reftime.ts) > 0;
+ return compare_ts (ts, pred_ptr->args.reftime.ts) > 0;
case COMP_LT:
- return compare_ts(ts, pred_ptr->args.reftime.ts) < 0;
+ return compare_ts (ts, pred_ptr->args.reftime.ts) < 0;
case COMP_EQ:
{
@@ -306,7 +306,7 @@ pred_timewindow(struct timespec ts, struct predicate const
*pred_ptr, int window
* was not created today. If the delta is 86400, the file
* was created this instant.
*/
- double delta = ts_difference(ts, pred_ptr->args.reftime.ts);
+ double delta = ts_difference (ts, pred_ptr->args.reftime.ts);
return (delta > 0.0 && delta <= window);
}
}
@@ -319,16 +319,16 @@ boolean
pred_amin (const char *pathname, struct stat *stat_buf, struct predicate
*pred_ptr)
{
(void) &pathname;
- return pred_timewindow(get_stat_atime(stat_buf), pred_ptr, 60);
+ return pred_timewindow (get_stat_atime(stat_buf), pred_ptr, 60);
}
boolean
pred_and (const char *pathname, struct stat *stat_buf, struct predicate
*pred_ptr)
{
if (pred_ptr->pred_left == NULL
- || apply_predicate(pathname, stat_buf, pred_ptr->pred_left))
+ || apply_predicate (pathname, stat_buf, pred_ptr->pred_left))
{
- return apply_predicate(pathname, stat_buf, pred_ptr->pred_right);
+ return apply_predicate (pathname, stat_buf, pred_ptr->pred_right);
}
else
return false;
@@ -339,14 +339,14 @@ pred_anewer (const char *pathname, struct stat *stat_buf,
struct predicate *pred
{
(void) &pathname;
assert (COMP_GT == pred_ptr->args.reftime.kind);
- return compare_ts(get_stat_atime(stat_buf), pred_ptr->args.reftime.ts) > 0;
+ return compare_ts (get_stat_atime(stat_buf), pred_ptr->args.reftime.ts) > 0;
}
boolean
pred_atime (const char *pathname, struct stat *stat_buf, struct predicate
*pred_ptr)
{
(void) &pathname;
- return pred_timewindow(get_stat_atime(stat_buf), pred_ptr, DAYSECS);
+ return pred_timewindow (get_stat_atime(stat_buf), pred_ptr, DAYSECS);
}
boolean
@@ -363,7 +363,7 @@ boolean
pred_cmin (const char *pathname, struct stat *stat_buf, struct predicate
*pred_ptr)
{
(void) pathname;
- return pred_timewindow(get_stat_ctime(stat_buf), pred_ptr, 60);
+ return pred_timewindow (get_stat_ctime(stat_buf), pred_ptr, 60);
}
boolean
@@ -372,7 +372,7 @@ pred_cnewer (const char *pathname, struct stat *stat_buf,
struct predicate *pred
(void) pathname;
assert (COMP_GT == pred_ptr->args.reftime.kind);
- return compare_ts(get_stat_ctime(stat_buf), pred_ptr->args.reftime.ts) > 0;
+ return compare_ts (get_stat_ctime(stat_buf), pred_ptr->args.reftime.ts) > 0;
}
boolean
@@ -380,22 +380,22 @@ pred_comma (const char *pathname, struct stat *stat_buf,
struct predicate *pred_
{
if (pred_ptr->pred_left != NULL)
{
- apply_predicate(pathname, stat_buf,pred_ptr->pred_left);
+ apply_predicate (pathname, stat_buf,pred_ptr->pred_left);
}
- return apply_predicate(pathname, stat_buf, pred_ptr->pred_right);
+ return apply_predicate (pathname, stat_buf, pred_ptr->pred_right);
}
boolean
pred_ctime (const char *pathname, struct stat *stat_buf, struct predicate
*pred_ptr)
{
(void) &pathname;
- return pred_timewindow(get_stat_ctime(stat_buf), pred_ptr, DAYSECS);
+ return pred_timewindow (get_stat_ctime(stat_buf), pred_ptr, DAYSECS);
}
static boolean
-perform_delete(int flags)
+perform_delete (int flags)
{
- return 0 == unlinkat(state.cwd_dir_fd, state.rel_pathname, flags);
+ return 0 == unlinkat (state.cwd_dir_fd, state.rel_pathname, flags);
}
@@ -409,7 +409,7 @@ pred_delete (const char *pathname, struct stat *stat_buf,
struct predicate *pred
int flags=0;
if (state.have_stat && S_ISDIR(stat_buf->st_mode))
flags |= AT_REMOVEDIR;
- if (perform_delete(flags))
+ if (perform_delete (flags))
{
return true;
}
@@ -421,13 +421,13 @@ pred_delete (const char *pathname, struct stat *stat_buf,
struct predicate *pred
{
/* unlink() operation failed because we should have done
rmdir(). */
flags |= AT_REMOVEDIR;
- if (perform_delete(flags))
+ if (perform_delete (flags))
return true;
}
}
}
error (0, errno, _("cannot delete %s"),
- safely_quote_err_filename(0, pathname));
+ safely_quote_err_filename (0, pathname));
/* Previously I had believed that having the -delete action
* return false provided the user with control over whether an
* error message is issued. While this is true, the policy of
@@ -462,20 +462,20 @@ pred_empty (const char *pathname, struct stat *stat_buf,
struct predicate *pred_
boolean empty = true;
errno = 0;
- if ((fd = openat(state.cwd_dir_fd, state.rel_pathname, O_RDONLY
+ if ((fd = openat (state.cwd_dir_fd, state.rel_pathname, O_RDONLY
#if defined O_LARGEFILE
|O_LARGEFILE
#endif
)) < 0)
{
- error (0, errno, "%s", safely_quote_err_filename(0, pathname));
+ error (0, errno, "%s", safely_quote_err_filename (0, pathname));
state.exit_status = 1;
return false;
}
d = fdopendir (fd);
if (d == NULL)
{
- error (0, errno, "%s", safely_quote_err_filename(0, pathname));
+ error (0, errno, "%s", safely_quote_err_filename (0, pathname));
state.exit_status = 1;
return false;
}
@@ -491,7 +491,7 @@ pred_empty (const char *pathname, struct stat *stat_buf,
struct predicate *pred_
}
if (CLOSEDIR (d))
{
- error (0, errno, "%s", safely_quote_err_filename(0, pathname));
+ error (0, errno, "%s", safely_quote_err_filename (0, pathname));
state.exit_status = 1;
return false;
}
@@ -510,7 +510,7 @@ new_impl_pred_exec (int dir_fd, const char *pathname,
const char *prefix, size_t pfxlen)
{
struct exec_val *execp = &pred_ptr->args.exec_vec;
- size_t len = strlen(pathname);
+ size_t len = strlen (pathname);
(void) stat_buf;
execp->dir_fd = dir_fd;
@@ -520,11 +520,11 @@ new_impl_pred_exec (int dir_fd, const char *pathname,
* The command may or may not be run at this point,
* depending on the command line length limits.
*/
- bc_push_arg(&execp->ctl,
- &execp->state,
- pathname, len+1,
- prefix, pfxlen,
- 0);
+ bc_push_arg (&execp->ctl,
+ &execp->state,
+ pathname, len+1,
+ prefix, pfxlen,
+ 0);
/* remember that there are pending execdirs. */
state.execdirs_outstanding = true;
@@ -540,13 +540,13 @@ new_impl_pred_exec (int dir_fd, const char *pathname,
for (i=0; i<execp->num_args; ++i)
{
- bc_do_insert(&execp->ctl,
- &execp->state,
- execp->replace_vec[i],
- strlen(execp->replace_vec[i]),
- prefix, pfxlen,
- pathname, len,
- 0);
+ bc_do_insert (&execp->ctl,
+ &execp->state,
+ execp->replace_vec[i],
+ strlen (execp->replace_vec[i]),
+ prefix, pfxlen,
+ pathname, len,
+ 0);
}
/* Actually invoke the command. */
@@ -569,8 +569,8 @@ new_impl_pred_exec (int dir_fd, const char *pathname,
boolean
pred_exec (const char *pathname, struct stat *stat_buf, struct predicate
*pred_ptr)
{
- return new_impl_pred_exec(get_start_dirfd(),
- pathname, stat_buf, pred_ptr, NULL, 0);
+ return new_impl_pred_exec (get_start_dirfd(),
+ pathname, stat_buf, pred_ptr, NULL, 0);
}
boolean
@@ -578,7 +578,7 @@ pred_execdir (const char *pathname, struct stat *stat_buf,
struct predicate *pre
{
const char *prefix = (state.rel_pathname[0] == '/') ? NULL : "./";
(void) &pathname;
- return new_impl_pred_exec (get_current_dirfd(),
+ return new_impl_pred_exec (get_current_dirfd (),
state.rel_pathname, stat_buf, pred_ptr,
prefix, (prefix ? 2 : 0));
}
@@ -611,11 +611,11 @@ pred_fprint (const char *pathname, struct stat *stat_buf,
struct predicate *pred
(void) &pathname;
(void) &stat_buf;
- print_quoted(pred_ptr->args.printf_vec.stream,
- pred_ptr->args.printf_vec.quote_opts,
- pred_ptr->args.printf_vec.dest_is_tty,
- "%s\n",
- pathname);
+ print_quoted (pred_ptr->args.printf_vec.stream,
+ pred_ptr->args.printf_vec.quote_opts,
+ pred_ptr->args.printf_vec.dest_is_tty,
+ "%s\n",
+ pathname);
return true;
}
@@ -634,7 +634,7 @@ pred_fprint0 (const char *pathname, struct stat *stat_buf,
struct predicate *pre
static char*
-mode_to_filetype(mode_t m)
+mode_to_filetype (mode_t m)
{
#define HANDLE_TYPE(t,letter) if (m==t) { return letter; }
#ifdef S_IFREG
@@ -665,7 +665,7 @@ mode_to_filetype(mode_t m)
}
static double
-file_sparseness(const struct stat *p)
+file_sparseness (const struct stat *p)
{
#if defined HAVE_STRUCT_STAT_ST_BLOCKS
if (0 == p->st_size)
@@ -677,7 +677,7 @@ file_sparseness(const struct stat *p)
}
else
{
- double blklen = file_blocksize(p) * (double)p->st_blocks;
+ double blklen = file_blocksize (p) * (double)p->st_blocks;
return blklen / p->st_size;
}
#else
@@ -688,15 +688,15 @@ file_sparseness(const struct stat *p)
static void
-checked_fprintf(struct format_val *dest, const char *fmt, ...)
+checked_fprintf (struct format_val *dest, const char *fmt, ...)
{
int rv;
va_list ap;
- va_start(ap, fmt);
- rv = vfprintf(dest->stream, fmt, ap);
+ va_start (ap, fmt);
+ rv = vfprintf (dest->stream, fmt, ap);
if (rv < 0)
- nonfatal_file_error(dest->filename);
+ nonfatal_file_error (dest->filename);
}
@@ -704,35 +704,35 @@ static void
checked_print_quoted (struct format_val *dest,
const char *format, const char *s)
{
- int rv = print_quoted(dest->stream, dest->quote_opts, dest->dest_is_tty,
- format, s);
+ int rv = print_quoted (dest->stream, dest->quote_opts, dest->dest_is_tty,
+ format, s);
if (rv < 0)
- nonfatal_file_error(dest->filename);
+ nonfatal_file_error (dest->filename);
}
static void
-checked_fwrite(void *p, size_t siz, size_t nmemb, struct format_val *dest)
+checked_fwrite (void *p, size_t siz, size_t nmemb, struct format_val *dest)
{
- int items_written = fwrite(p, siz, nmemb, dest->stream);
+ int items_written = fwrite (p, siz, nmemb, dest->stream);
if (items_written < nmemb)
- nonfatal_file_error(dest->filename);
+ nonfatal_file_error (dest->filename);
}
static void
-checked_fflush(struct format_val *dest)
+checked_fflush (struct format_val *dest)
{
- if (0 != fflush(dest->stream))
+ if (0 != fflush (dest->stream))
{
- nonfatal_file_error(dest->filename);
+ nonfatal_file_error (dest->filename);
}
}
static void
-do_fprintf(struct format_val *dest,
- struct segment *segment,
- const char *pathname,
- const struct stat *stat_buf)
+do_fprintf (struct format_val *dest,
+ struct segment *segment,
+ const char *pathname,
+ const struct stat *stat_buf)
{
char hbuf[LONGEST_HUMAN_READABLE + 1];
const char *cp;
@@ -746,8 +746,8 @@ do_fprintf(struct format_val *dest,
case KIND_STOP: /* Terminate argument and flush output. */
/* trusted */
- checked_fwrite(segment->text, 1, segment->text_len, dest);
- checked_fflush(dest);
+ checked_fwrite (segment->text, 1, segment->text_len, dest);
+ checked_fflush (dest);
break;
case KIND_FORMAT:
@@ -755,7 +755,7 @@ do_fprintf(struct format_val *dest,
{
case 'a': /* atime in `ctime' format. */
/* UNTRUSTED, probably unexploitable */
- checked_fprintf (dest, segment->text, ctime_format
(get_stat_atime(stat_buf)));
+ checked_fprintf (dest, segment->text, ctime_format (get_stat_atime
(stat_buf)));
break;
case 'b': /* size in 512-byte blocks */
/* UNTRUSTED, probably unexploitable */
@@ -766,7 +766,7 @@ do_fprintf(struct format_val *dest,
break;
case 'c': /* ctime in `ctime' format */
/* UNTRUSTED, probably unexploitable */
- checked_fprintf (dest, segment->text, ctime_format
(get_stat_ctime(stat_buf)));
+ checked_fprintf (dest, segment->text, ctime_format (get_stat_ctime
(stat_buf)));
break;
case 'd': /* depth in search tree */
/* UNTRUSTED, probably unexploitable */
@@ -833,10 +833,10 @@ do_fprintf(struct format_val *dest,
}
else
{
- char *s = strdup(pathname);
+ char *s = strdup (pathname);
s[cp - pathname] = 0;
checked_print_quoted (dest, segment->text, s);
- free(s);
+ free (s);
}
}
break;
@@ -844,11 +844,11 @@ do_fprintf(struct format_val *dest,
case 'H': /* ARGV element file was found under */
/* trusted */
{
- char *s = xmalloc(state.starting_path_length+1);
- memcpy(s, pathname, state.starting_path_length);
+ char *s = xmalloc (state.starting_path_length+1);
+ memcpy (s, pathname, state.starting_path_length);
s[state.starting_path_length] = 0;
checked_fprintf (dest, segment->text, s);
- free(s);
+ free (s);
}
break;
@@ -977,13 +977,13 @@ do_fprintf(struct format_val *dest,
case 'S': /* sparseness */
/* UNTRUSTED, probably unexploitable */
- checked_fprintf (dest, segment->text, file_sparseness(stat_buf));;
+ checked_fprintf (dest, segment->text, file_sparseness (stat_buf));;
break;
case 't': /* mtime in `ctime' format */
/* UNTRUSTED, probably unexploitable */
checked_fprintf (dest, segment->text,
- ctime_format (get_stat_mtime(stat_buf)));
+ ctime_format (get_stat_mtime (stat_buf)));
break;
case 'u': /* user name */
@@ -1014,7 +1014,7 @@ do_fprintf(struct format_val *dest,
break;
/* %Y: type of file system entry like `ls -l`:
- * (d,-,l,s,p,b,c,n) n=nonexistent(symlink)
+ * (d,-,l,s,p,b,c,n) n=nonexistent (symlink)
*/
case 'Y': /* in case of symlink */
/* trusted */
@@ -1026,7 +1026,7 @@ do_fprintf(struct format_val *dest,
/* If we would normally follow links, do not do so.
* If we would normally not follow links, do so.
*/
- if ((following_links() ? lstat : stat)
+ if ((following_links () ? lstat : stat)
(state.rel_pathname, &sbuf) != 0)
{
if ( errno == ENOENT )
@@ -1043,20 +1043,20 @@ do_fprintf(struct format_val *dest,
{
checked_fprintf (dest, segment->text, "?");
error (0, errno, "%s",
- safely_quote_err_filename(0, pathname));
+ safely_quote_err_filename (0, pathname));
/* exit_status = 1;
return ; */
break;
}
}
checked_fprintf (dest, segment->text,
- mode_to_filetype(sbuf.st_mode & S_IFMT));
+ mode_to_filetype (sbuf.st_mode & S_IFMT));
}
#endif /* S_ISLNK */
else
{
checked_fprintf (dest, segment->text,
- mode_to_filetype(stat_buf->st_mode & S_IFMT));
+ mode_to_filetype (stat_buf->st_mode & S_IFMT));
}
}
break;
@@ -1065,7 +1065,7 @@ do_fprintf(struct format_val *dest,
/* trusted */
{
checked_fprintf (dest, segment->text,
- mode_to_filetype(stat_buf->st_mode & S_IFMT));
+ mode_to_filetype (stat_buf->st_mode & S_IFMT));
}
break;
@@ -1114,22 +1114,22 @@ pred_fprintf (const char *pathname, struct stat
*stat_buf, struct predicate *pre
switch (segment->format_char[0])
{
case 'A':
- ts = get_stat_atime(stat_buf);
+ ts = get_stat_atime (stat_buf);
valid = 1;
break;
case 'B':
- ts = get_stat_birthtime(stat_buf);
+ ts = get_stat_birthtime (stat_buf);
if ('@' == segment->format_char[1])
valid = 1;
else
valid = (ts.tv_nsec >= 0);
break;
case 'C':
- ts = get_stat_ctime(stat_buf);
+ ts = get_stat_ctime (stat_buf);
valid = 1;
break;
case 'T':
- ts = get_stat_mtime(stat_buf);
+ ts = get_stat_mtime (stat_buf);
valid = 1;
break;
default:
@@ -1160,7 +1160,7 @@ pred_fprintf (const char *pathname, struct stat
*stat_buf, struct predicate *pre
else
{
/* Print a segment which is not a date. */
- do_fprintf(dest, segment, pathname, stat_buf);
+ do_fprintf (dest, segment, pathname, stat_buf);
}
}
return true;
@@ -1232,7 +1232,7 @@ pred_name_common (const char *pathname, const char *str,
int flags)
*/
char *base = base_name (pathname);
/* remove trailing slashes, but leave "/" or "//foo" unchanged. */
- strip_trailing_slashes(base);
+ strip_trailing_slashes (base);
/* FNM_PERIOD is not used here because POSIX requires that it not be.
* See
http://standards.ieee.org/reading/ieee/interp/1003-2-92_int/pasc-1003.2-126.html
@@ -1336,21 +1336,21 @@ match_lname (const char *pathname, struct stat
*stat_buf, struct predicate *pred
boolean
pred_ls (const char *pathname, struct stat *stat_buf, struct predicate
*pred_ptr)
{
- return pred_fls(pathname, stat_buf, pred_ptr);
+ return pred_fls (pathname, stat_buf, pred_ptr);
}
boolean
pred_mmin (const char *pathname, struct stat *stat_buf, struct predicate
*pred_ptr)
{
(void) &pathname;
- return pred_timewindow(get_stat_mtime(stat_buf), pred_ptr, 60);
+ return pred_timewindow (get_stat_mtime(stat_buf), pred_ptr, 60);
}
boolean
pred_mtime (const char *pathname, struct stat *stat_buf, struct predicate
*pred_ptr)
{
(void) pathname;
- return pred_timewindow(get_stat_mtime(stat_buf), pred_ptr, DAYSECS);
+ return pred_timewindow (get_stat_mtime(stat_buf), pred_ptr, DAYSECS);
}
boolean
@@ -1363,7 +1363,7 @@ pred_name (const char *pathname, struct stat *stat_buf,
struct predicate *pred_p
boolean
pred_negate (const char *pathname, struct stat *stat_buf, struct predicate
*pred_ptr)
{
- return !apply_predicate(pathname, stat_buf, pred_ptr->pred_right);
+ return !apply_predicate (pathname, stat_buf, pred_ptr->pred_right);
}
boolean
@@ -1372,7 +1372,7 @@ pred_newer (const char *pathname, struct stat *stat_buf,
struct predicate *pred_
(void) pathname;
assert (COMP_GT == pred_ptr->args.reftime.kind);
- return compare_ts(get_stat_mtime(stat_buf), pred_ptr->args.reftime.ts) > 0;
+ return compare_ts (get_stat_mtime(stat_buf), pred_ptr->args.reftime.ts) > 0;
}
boolean
@@ -1390,35 +1390,35 @@ pred_newerXY (const char *pathname, struct stat
*stat_buf, struct predicate *pre
return false;
case XVAL_ATIME:
- ts = get_stat_atime(stat_buf);
+ ts = get_stat_atime (stat_buf);
collected = true;
break;
case XVAL_BIRTHTIME:
- ts = get_stat_birthtime(stat_buf);
+ ts = get_stat_birthtime (stat_buf);
collected = true;
if (ts.tv_nsec < 0);
{
/* XXX: Cannot determine birth time. Warn once. */
- error(0, 0, _("Warning: cannot determine birth time of file %s"),
- safely_quote_err_filename(0, pathname));
+ error (0, 0, _("Warning: cannot determine birth time of file %s"),
+ safely_quote_err_filename (0, pathname));
return false;
}
break;
case XVAL_CTIME:
- ts = get_stat_ctime(stat_buf);
+ ts = get_stat_ctime (stat_buf);
collected = true;
break;
case XVAL_MTIME:
- ts = get_stat_mtime(stat_buf);
+ ts = get_stat_mtime (stat_buf);
collected = true;
break;
}
assert (collected);
- return compare_ts(ts, pred_ptr->args.reftime.ts) > 0;
+ return compare_ts (ts, pred_ptr->args.reftime.ts) > 0;
}
boolean
@@ -1455,7 +1455,7 @@ pred_nouser (const char *pathname, struct stat *stat_buf,
struct predicate *pred
static boolean
-is_ok(const char *program, const char *arg)
+is_ok (const char *program, const char *arg)
{
fflush (stdout);
/* The draft open standard requires that, in the POSIX locale,
@@ -1466,14 +1466,14 @@ is_ok(const char *program, const char *arg)
/* XXX: printing UNTRUSTED data here. */
fprintf (stderr, _("< %s ... %s > ? "), program, arg);
fflush (stderr);
- return yesno();
+ return yesno ();
}
boolean
pred_ok (const char *pathname, struct stat *stat_buf, struct predicate
*pred_ptr)
{
- if (is_ok(pred_ptr->args.exec_vec.replace_vec[0], pathname))
- return new_impl_pred_exec (get_start_dirfd(),
+ if (is_ok (pred_ptr->args.exec_vec.replace_vec[0], pathname))
+ return new_impl_pred_exec (get_start_dirfd (),
pathname, stat_buf, pred_ptr, NULL, 0);
else
return false;
@@ -1483,8 +1483,8 @@ boolean
pred_okdir (const char *pathname, struct stat *stat_buf, struct predicate
*pred_ptr)
{
const char *prefix = (state.rel_pathname[0] == '/') ? NULL : "./";
- if (is_ok(pred_ptr->args.exec_vec.replace_vec[0], pathname))
- return new_impl_pred_exec (get_current_dirfd(),
+ if (is_ok (pred_ptr->args.exec_vec.replace_vec[0], pathname))
+ return new_impl_pred_exec (get_current_dirfd (),
state.rel_pathname, stat_buf, pred_ptr,
prefix, (prefix ? 2 : 0));
else
@@ -1504,9 +1504,9 @@ boolean
pred_or (const char *pathname, struct stat *stat_buf, struct predicate
*pred_ptr)
{
if (pred_ptr->pred_left == NULL
- || !apply_predicate(pathname, stat_buf, pred_ptr->pred_left))
+ || !apply_predicate (pathname, stat_buf, pred_ptr->pred_left))
{
- return apply_predicate(pathname, stat_buf, pred_ptr->pred_right);
+ return apply_predicate (pathname, stat_buf, pred_ptr->pred_right);
}
else
return true;
@@ -1570,23 +1570,23 @@ struct access_check_args
static int
-access_callback(void *context)
+access_callback (void *context)
{
int rv;
struct access_check_args *args = context;
- if ((rv = access(args->filename, args->access_type)) < 0)
+ if ((rv = access (args->filename, args->access_type)) < 0)
args->cb_errno = errno;
return rv;
}
static int
-can_access(int access_type)
+can_access (int access_type)
{
struct access_check_args args;
args.filename = state.rel_pathname;
args.access_type = access_type;
args.cb_errno = 0;
- return 0 == run_in_dir(state.cwd_dir_fd, access_callback, &args);
+ return 0 == run_in_dir (state.cwd_dir_fd, access_callback, &args);
}
@@ -1597,7 +1597,7 @@ pred_executable (const char *pathname, struct stat
*stat_buf, struct predicate *
(void) stat_buf;
(void) pred_ptr;
- return can_access(X_OK);
+ return can_access (X_OK);
}
boolean
@@ -1607,7 +1607,7 @@ pred_readable (const char *pathname, struct stat
*stat_buf, struct predicate *pr
(void) stat_buf;
(void) pred_ptr;
- return can_access(R_OK);
+ return can_access (R_OK);
}
boolean
@@ -1617,7 +1617,7 @@ pred_writable (const char *pathname, struct stat
*stat_buf, struct predicate *pr
(void) stat_buf;
(void) pred_ptr;
- return can_access(W_OK);
+ return can_access (W_OK);
}
boolean
@@ -1626,10 +1626,10 @@ pred_print (const char *pathname, struct stat
*stat_buf, struct predicate *pred_
(void) stat_buf;
(void) pred_ptr;
- print_quoted(pred_ptr->args.printf_vec.stream,
- pred_ptr->args.printf_vec.quote_opts,
- pred_ptr->args.printf_vec.dest_is_tty,
- "%s\n", pathname);
+ print_quoted (pred_ptr->args.printf_vec.stream,
+ pred_ptr->args.printf_vec.quote_opts,
+ pred_ptr->args.printf_vec.dest_is_tty,
+ "%s\n", pathname);
return true;
}
@@ -1669,12 +1669,12 @@ pred_quit (const char *pathname, struct stat *stat_buf,
struct predicate *pred_p
/* Run any cleanups. This includes executing any command lines
* we have partly built but not executed.
*/
- cleanup();
+ cleanup ();
/* Since -exec and friends don't leave child processes running in the
* background, there is no need to wait for them here.
*/
- exit(state.exit_status); /* 0 for success, etc. */
+ exit (state.exit_status); /* 0 for success, etc. */
}
boolean
@@ -1845,8 +1845,8 @@ pred_used (const char *pathname, struct stat *stat_buf,
struct predicate *pred_p
(void) pathname;
/* TODO: this needs to be retested carefully (manually, if necessary) */
- at = get_stat_atime(stat_buf);
- ct = get_stat_ctime(stat_buf);
+ at = get_stat_atime (stat_buf);
+ ct = get_stat_ctime (stat_buf);
delta.tv_sec = at.tv_sec - ct.tv_sec;
delta.tv_nsec = at.tv_nsec - ct.tv_nsec;
if (delta.tv_nsec < 0)
@@ -1854,7 +1854,7 @@ pred_used (const char *pathname, struct stat *stat_buf,
struct predicate *pred_p
delta.tv_nsec += 1000000000;
delta.tv_sec -= 1;
}
- return pred_timewindow(delta, pred_ptr, DAYSECS);
+ return pred_timewindow (delta, pred_ptr, DAYSECS);
}
boolean
@@ -1876,15 +1876,15 @@ pred_xtype (const char *pathname, struct stat
*stat_buf, struct predicate *pred_
/* If we would normally stat the link itself, stat the target instead.
* If we would normally follow the link, stat the link itself instead.
*/
- if (following_links())
+ if (following_links ())
ystat = optionp_stat;
else
ystat = optionl_stat;
- set_stat_placeholders(&sbuf);
+ set_stat_placeholders (&sbuf);
if ((*ystat) (state.rel_pathname, &sbuf) != 0)
{
- if (following_links() && errno == ENOENT)
+ if (following_links () && errno == ENOENT)
{
/* If we failed to follow the symlink,
* fall back on looking at the symlink itself.
@@ -1894,7 +1894,7 @@ pred_xtype (const char *pathname, struct stat *stat_buf,
struct predicate *pred_
}
else
{
- error (0, errno, "%s", safely_quote_err_filename(0, pathname));
+ error (0, errno, "%s", safely_quote_err_filename (0, pathname));
state.exit_status = 1;
}
return false;
@@ -1952,14 +1952,14 @@ prep_child_for_exec (boolean close_stdin, int dir_fd)
{
const char inputfile[] = "/dev/null";
- if (close(0) < 0)
+ if (close (0) < 0)
{
- error(0, errno, _("Cannot close standard input"));
+ error (0, errno, _("Cannot close standard input"));
ok = false;
}
else
{
- if (open(inputfile, O_RDONLY
+ if (open (inputfile, O_RDONLY
#if defined O_LARGEFILE
|O_LARGEFILE
#endif
@@ -1970,7 +1970,7 @@ prep_child_for_exec (boolean close_stdin, int dir_fd)
* stdin is almost as good as executing it
* with its stdin attached to /dev/null.
*/
- error (0, errno, "%s", safely_quote_err_filename(0, inputfile));
+ error (0, errno, "%s", safely_quote_err_filename (0, inputfile));
/* do not set ok=false, it is OK to continue anyway. */
}
}
@@ -1984,12 +1984,12 @@ prep_child_for_exec (boolean close_stdin, int dir_fd)
if (dir_fd != AT_FDCWD)
{
assert (dir_fd >= 0);
- if (0 != fchdir(dir_fd))
+ if (0 != fchdir (dir_fd))
{
/* If we cannot execute our command in the correct directory,
* we should not execute it at all.
*/
- error(0, errno, _("Failed to change directory"));
+ error (0, errno, _("Failed to change directory"));
ok = false;
}
}
@@ -2032,9 +2032,9 @@ launch (struct buildcmd_control *ctl, void *usercontext,
int argc, char **argv)
{
/* We are the child. */
assert (starting_desc >= 0);
- if (!prep_child_for_exec(execp->close_stdin, execp->dir_fd))
+ if (!prep_child_for_exec (execp->close_stdin, execp->dir_fd))
{
- _exit(1);
+ _exit (1);
}
else
{
@@ -2050,7 +2050,7 @@ launch (struct buildcmd_control *ctl, void *usercontext,
int argc, char **argv)
execvp (argv[0], argv);
/* TODO: use a pipe to pass back the errno value, like xargs does */
error (0, errno, "%s",
- safely_quote_err_filename(0, argv[0]));
+ safely_quote_err_filename (0, argv[0]));
_exit (1);
}
@@ -2059,7 +2059,7 @@ launch (struct buildcmd_control *ctl, void *usercontext,
int argc, char **argv)
if (errno != EINTR)
{
error (0, errno, _("error waiting for %s"),
- safely_quote_err_filename(0, argv[0]));
+ safely_quote_err_filename (0, argv[0]));
state.exit_status = 1;
return 0; /* FAIL */
}
@@ -2068,7 +2068,7 @@ launch (struct buildcmd_control *ctl, void *usercontext,
int argc, char **argv)
if (WIFSIGNALED (execp->last_child_status))
{
error (0, 0, _("%s terminated by signal %d"),
- quotearg_n_style(0, options.err_quoting_style, argv[0]),
+ quotearg_n_style (0, options.err_quoting_style, argv[0]),
WTERMSIG (execp->last_child_status));
if (execp->multiple)
@@ -2107,8 +2107,8 @@ launch (struct buildcmd_control *ctl, void *usercontext,
int argc, char **argv)
static boolean
-scan_for_digit_differences(const char *p, const char *q,
- size_t *first, size_t *n)
+scan_for_digit_differences (const char *p, const char *q,
+ size_t *first, size_t *n)
{
bool seen = false;
size_t i;
@@ -2117,7 +2117,7 @@ scan_for_digit_differences(const char *p, const char *q,
{
if (p[i] != q[i])
{
- if (!isdigit((unsigned char)q[i]) || !isdigit ((unsigned char)q[i]))
+ if (!isdigit ((unsigned char)q[i]) || !isdigit ((unsigned char)q[i]))
return false;
if (!seen)
@@ -2165,7 +2165,7 @@ do_time_format (const char *fmt, const struct tm *p,
const char *ns, size_t ns_s
* an otherwise uninteresting character to prevent the no-output
* case.
*/
- timefmt = xmalloc (strlen(fmt) + 2u);
+ timefmt = xmalloc (strlen (fmt) + 2u);
sprintf (timefmt, "_%s", fmt);
/* altered_time is a similar time, but in which both
@@ -2209,7 +2209,7 @@ do_time_format (const char *fmt, const struct tm *p,
const char *ns, size_t ns_s
* When that happens, we just avoid inserting the nanoseconds field.
*/
if (scan_for_digit_differences (buf, altbuf, &i, &n)
- && (2==n) && !isdigit((unsigned char)buf[i+n]))
+ && (2==n) && !isdigit ((unsigned char)buf[i+n]))
{
const size_t end_of_seconds = i + n;
const size_t suffix_len = buf_used-(end_of_seconds)+1;
@@ -2291,7 +2291,7 @@ format_date (struct timespec ts, int kind)
* demonstrating that the performance difference is actually
* measurable.
*/
- verify (sizeof(buf) >= LONGEST_HUMAN_READABLE);
+ verify (sizeof (buf) >= LONGEST_HUMAN_READABLE);
charsprinted = 0;
need_ns_suffix = 0;
@@ -2331,7 +2331,7 @@ format_date (struct timespec ts, int kind)
* The reason for discouraging this is that in the future, the
* granularity may not be nanoseconds.
*/
- charsprinted = snprintf(ns_buf, NS_BUF_LEN, ".%09ld0", (long
int)ts.tv_nsec);
+ charsprinted = snprintf (ns_buf, NS_BUF_LEN, ".%09ld0", (long
int)ts.tv_nsec);
assert (charsprinted < NS_BUF_LEN);
}
else
@@ -2376,19 +2376,19 @@ format_date (struct timespec ts, int kind)
*/
if (need_ns_suffix)
{
- len = strlen(p);
+ len = strlen (p);
used = (p-buf) + len; /* Offset into buf of current end */
assert (sizeof buf > used); /* Ensure we can perform subtraction
safely. */
remaining = sizeof buf - used - 1u; /* allow space for NUL */
- if (strlen(ns_buf) >= remaining)
+ if (strlen (ns_buf) >= remaining)
{
- error(0, 0,
- "charsprinted=%ld but remaining=%lu: ns_buf=%s",
- (long)charsprinted, (unsigned long)remaining, ns_buf);
+ error (0, 0,
+ "charsprinted=%ld but remaining=%lu: ns_buf=%s",
+ (long)charsprinted, (unsigned long)remaining, ns_buf);
}
- assert (strlen(ns_buf) < remaining);
- strcat(p, ns_buf);
+ assert (strlen (ns_buf) < remaining);
+ strcat (p, ns_buf);
}
return p;
}
@@ -2413,7 +2413,7 @@ ctime_format (struct timespec ts)
static char resultbuf[TIME_BUF_LEN];
int nout;
- ptm = localtime(&ts.tv_sec);
+ ptm = localtime (&ts.tv_sec);
if (ptm)
{
assert (ptm->tm_wday >= 0);
@@ -2426,16 +2426,16 @@ ctime_format (struct timespec ts)
assert (ptm->tm_sec <= 61); /* allows 2 leap seconds. */
/* wkday mon mday hh:mm:ss.nnnnnnnnn yyyy */
- nout = snprintf(resultbuf, TIME_BUF_LEN,
- "%3s %3s %2d %02d:%02d:%02d.%010ld %04d",
- weekdays[ptm->tm_wday],
- months[ptm->tm_mon],
- ptm->tm_mday,
- ptm->tm_hour,
- ptm->tm_min,
- ptm->tm_sec,
- (long int)ts.tv_nsec,
- 1900 + ptm->tm_year);
+ nout = snprintf (resultbuf, TIME_BUF_LEN,
+ "%3s %3s %2d %02d:%02d:%02d.%010ld %04d",
+ weekdays[ptm->tm_wday],
+ months[ptm->tm_mon],
+ ptm->tm_mday,
+ ptm->tm_hour,
+ ptm->tm_min,
+ ptm->tm_sec,
+ (long int)ts.tv_nsec,
+ 1900 + ptm->tm_year);
assert (nout < TIME_BUF_LEN);
return resultbuf;
@@ -2486,13 +2486,13 @@ print_list (FILE *fp, struct predicate *node)
/* Print out the predicate list starting at NODE. */
static void
-print_parenthesised(FILE *fp, struct predicate *node)
+print_parenthesised (FILE *fp, struct predicate *node)
{
int parens = 0;
if (node)
{
- if ((pred_is(node, pred_or) || pred_is(node, pred_and))
+ if ((pred_is (node, pred_or) || pred_is (node, pred_and))
&& node->pred_left == NULL)
{
/* We print "<nothing> or X" as just "X"
@@ -2506,10 +2506,10 @@ print_parenthesised(FILE *fp, struct predicate *node)
parens = 1;
if (parens)
- fprintf(fp, "%s", " ( ");
- print_optlist(fp, node);
+ fprintf (fp, "%s", " ( ");
+ print_optlist (fp, node);
if (parens)
- fprintf(fp, "%s", " ) ");
+ fprintf (fp, "%s", " ) ");
}
}
}
@@ -2519,38 +2519,38 @@ print_optlist (FILE *fp, const struct predicate *p)
{
if (p)
{
- print_parenthesised(fp, p->pred_left);
+ print_parenthesised (fp, p->pred_left);
fprintf (fp,
"%s%s%s",
p->need_stat ? "[call stat] " : "",
p->need_type ? "[need type] " : "",
p->need_inum ? "[need inum] " : "");
- print_predicate(fp, p);
- fprintf(fp, " [%g] ", p->est_success_rate);
+ print_predicate (fp, p);
+ fprintf (fp, " [%g] ", p->est_success_rate);
if (options.debug_options & DebugSuccessRates)
{
- fprintf(fp, "[%ld/%ld", p->perf.successes, p->perf.visits);
+ fprintf (fp, "[%ld/%ld", p->perf.successes, p->perf.visits);
if (p->perf.visits)
{
double real_rate = (double)p->perf.successes /
(double)p->perf.visits;
- fprintf(fp, "=%g] ", real_rate);
+ fprintf (fp, "=%g] ", real_rate);
}
else
{
- fprintf(fp, "=_] ");
+ fprintf (fp, "=_] ");
}
}
- print_parenthesised(fp, p->pred_right);
+ print_parenthesised (fp, p->pred_right);
}
}
-void show_success_rates(const struct predicate *p)
+void show_success_rates (const struct predicate *p)
{
if (options.debug_options & DebugSuccessRates)
{
- fprintf(stderr, "Predicate success rates after completion:\n");
- print_optlist(stderr, p);
- fprintf(stderr, "\n");
+ fprintf (stderr, "Predicate success rates after completion:\n");
+ print_optlist (stderr, p);
+ fprintf (stderr, "\n");
}
}
@@ -2563,14 +2563,14 @@ void show_success_rates(const struct predicate *p)
* if that preprocessor macro is defined.
*/
void
-pred_sanity_check(const struct predicate *predicates)
+pred_sanity_check (const struct predicate *predicates)
{
/* Do nothing, since assert is a no-op with _NDEBUG set */
return;
}
#else
void
-pred_sanity_check(const struct predicate *predicates)
+pred_sanity_check (const struct predicate *predicates)
{
const struct predicate *p;
@@ -2610,8 +2610,8 @@ pred_sanity_check(const struct predicate *predicates)
break;
case ARG_ACTION:
- assert(p->side_effects); /* actions have side effects. */
- if (!pred_is(p, pred_prune) && !pred_is(p, pred_quit))
+ assert (p->side_effects); /* actions have side effects. */
+ if (!pred_is (p, pred_prune) && !pred_is(p, pred_quit))
{
/* actions other than -prune and -quit should
* inhibit the default -print
diff --git a/find/sharefile.c b/find/sharefile.c
index fa329d4..93ecee3 100644
--- a/find/sharefile.c
+++ b/find/sharefile.c
@@ -96,7 +96,7 @@ sharefile_init (const char *mode)
{
struct Hash_tuning;
- struct sharefile *p = malloc (sizeof(struct sharefile));
+ struct sharefile *p = malloc (sizeof (struct sharefile));
if (p)
{
p->mode = strdup (mode);
diff --git a/find/tree.c b/find/tree.c
index 0f38406..4b41091 100644
--- a/find/tree.c
+++ b/find/tree.c
@@ -57,8 +57,8 @@ static size_t num_start_points = 0;
static struct predicate *scan_rest PARAMS((struct predicate **input,
- struct predicate *head,
- short int prev_prec));
+ struct predicate *head,
+ short int prev_prec));
static void merge_pred PARAMS((struct predicate *beg_list, struct predicate
*end_list, struct predicate **last_p));
static struct predicate *set_new_parent PARAMS((struct predicate *curr, enum
predicate_precedence high_prec, struct predicate **prevp));
static const char *cost_name PARAMS((enum EvaluationCost cost));
@@ -69,7 +69,7 @@ static const char *cost_name PARAMS((enum EvaluationCost
cost));
command line, we return true for ".".
*/
boolean
-matches_start_point(const char *glob, bool foldcase)
+matches_start_point (const char *glob, bool foldcase)
{
int fnmatch_flags = 0;
if (foldcase)
@@ -139,8 +139,8 @@ get_expr (struct predicate **input,
&& !this_pred->artificial)
{
/* e.g. "find \( -not \)" or "find \( -true -a \" */
- error(1, 0, _("expected an expression between '%s' and ')'"),
- prev_pred->p_name);
+ error (1, 0, _("expected an expression between '%s' and ')'"),
+ prev_pred->p_name);
}
else if ( (*input)->artificial )
{
@@ -272,7 +272,7 @@ scan_rest (struct predicate **input,
/* Returns true if the specified predicate is reorderable. */
static boolean
-predicate_is_cost_free(const struct predicate *p)
+predicate_is_cost_free (const struct predicate *p)
{
if (pred_is(p, pred_name) ||
pred_is(p, pred_path) ||
@@ -301,7 +301,7 @@ predicate_is_cost_free(const struct predicate *p)
}
/* Prints a predicate */
-void print_predicate(FILE *fp, const struct predicate *p)
+void print_predicate (FILE *fp, const struct predicate *p)
{
if (p->arg_text)
{
@@ -321,15 +321,15 @@ struct predlist
};
static void
-predlist_init(struct predlist *p)
+predlist_init (struct predlist *p)
{
p->head = p->tail = NULL;
}
static void
-predlist_insert(struct predlist *list,
- struct predicate *curr,
- struct predicate **pprev)
+predlist_insert (struct predlist *list,
+ struct predicate *curr,
+ struct predicate **pprev)
{
struct predicate **insertpos = &(list->head);
@@ -352,7 +352,7 @@ predlist_insert(struct predlist *list,
}
static int
-pred_cost_compare(const struct predicate *p1, const struct predicate *p2,
boolean wantfailure)
+pred_cost_compare (const struct predicate *p1, const struct predicate *p2,
boolean wantfailure)
{
if (p1->p_cost == p2->p_cost)
{
@@ -371,8 +371,8 @@ pred_cost_compare(const struct predicate *p1, const struct
predicate *p2, boolea
static void
-predlist_merge_sort(struct predlist *list,
- struct predicate **last)
+predlist_merge_sort (struct predlist *list,
+ struct predicate **last)
{
struct predlist new_list;
struct predicate *p, *q;
@@ -382,12 +382,12 @@ predlist_merge_sort(struct predlist *list,
if (options.debug_options & DebugTreeOpt)
{
- fprintf(stderr, "%s:\n", "predlist before merge sort");
- print_tree(stderr, list->head, 2);
+ fprintf (stderr, "%s:\n", "predlist before merge sort");
+ print_tree (stderr, list->head, 2);
}
- calculate_derived_rates(list->head);
- predlist_init(&new_list);
+ calculate_derived_rates (list->head);
+ predlist_init (&new_list);
while (list->head)
{
/* remove head of source list */
@@ -408,7 +408,7 @@ predlist_merge_sort(struct predlist *list,
* pass a flag into pred_cost_compare().
*/
boolean wantfailure = (OR_PREC != p->p_prec);
- if (pred_cost_compare(p->pred_right, q->pred_right, wantfailure) >= 0)
+ if (pred_cost_compare (p->pred_right, q->pred_right, wantfailure) >=
0)
break;
}
if (p)
@@ -429,43 +429,43 @@ predlist_merge_sort(struct predlist *list,
}
if (options.debug_options & DebugTreeOpt)
{
- fprintf(stderr, "%s:\n", "predlist after merge sort");
- print_tree(stderr, new_list.head, 2);
+ fprintf (stderr, "%s:\n", "predlist after merge sort");
+ print_tree (stderr, new_list.head, 2);
}
calculate_derived_rates(new_list.head);
- merge_pred(new_list.head, new_list.tail, last);
- predlist_init(list);
+ merge_pred (new_list.head, new_list.tail, last);
+ predlist_init (list);
}
static void
-merge_lists(struct predlist lists[], int nlists,
- struct predlist *name_list,
- struct predlist *regex_list,
- struct predicate **last)
+merge_lists (struct predlist lists[], int nlists,
+ struct predlist *name_list,
+ struct predlist *regex_list,
+ struct predicate **last)
{
int i;
static void (*mergefn)(struct predlist *, struct predicate**);
mergefn = predlist_merge_sort;
- mergefn(name_list, last);
- mergefn(regex_list, last);
+ mergefn (name_list, last);
+ mergefn (regex_list, last);
for (i=0; i<nlists; i++)
- mergefn(&lists[i], last);
+ mergefn (&lists[i], last);
}
static boolean
-subtree_has_side_effects(const struct predicate *p)
+subtree_has_side_effects (const struct predicate *p)
{
if (p)
{
return p->side_effects
- || subtree_has_side_effects(p->pred_left)
- || subtree_has_side_effects(p->pred_right);
+ || subtree_has_side_effects (p->pred_left)
+ || subtree_has_side_effects (p->pred_right);
}
else
{
@@ -480,8 +480,8 @@ worst_cost (const struct predicate *p)
if (p)
{
unsigned int cost_r, cost_l, worst;
- cost_l = worst_cost(p->pred_left);
- cost_r = worst_cost(p->pred_right);
+ cost_l = worst_cost (p->pred_left);
+ cost_r = worst_cost (p->pred_right);
worst = (cost_l > cost_r) ? cost_l : cost_r;
if (worst < p->p_cost)
worst = p->p_cost;
@@ -496,7 +496,7 @@ worst_cost (const struct predicate *p)
static void
-perform_arm_swap(struct predicate *p)
+perform_arm_swap (struct predicate *p)
{
struct predicate *tmp = p->pred_left->pred_right;
p->pred_left->pred_right = p->pred_right;
@@ -520,7 +520,7 @@ perform_arm_swap(struct predicate *p)
* as we assume that 95% of inodes are vanilla files.
*/
static boolean
-consider_arm_swap(struct predicate *p)
+consider_arm_swap (struct predicate *p)
{
int left_cost, right_cost;
const char *reason = NULL;
@@ -546,19 +546,19 @@ consider_arm_swap(struct predicate *p)
if (!reason)
{
- if (subtree_has_side_effects(*pl))
+ if (subtree_has_side_effects (*pl))
reason = "Left subtree has side-effects";
}
if (!reason)
{
- if (subtree_has_side_effects(*pr))
+ if (subtree_has_side_effects (*pr))
reason = "Right subtree has side-effects";
}
if (!reason)
{
- left_cost = worst_cost(*pl);
- right_cost = worst_cost(*pr);
+ left_cost = worst_cost (*pl);
+ right_cost = worst_cost (*pr);
if (left_cost < right_cost)
{
@@ -577,16 +577,16 @@ consider_arm_swap(struct predicate *p)
if (options.debug_options & DebugTreeOpt)
{
- fprintf(stderr, "Success rates: l=%f, r=%f\n", succ_rate_l,
succ_rate_r);
+ fprintf (stderr, "Success rates: l=%f, r=%f\n", succ_rate_l,
succ_rate_r);
}
- if (pred_is(p, pred_or))
+ if (pred_is (p, pred_or))
{
want_swap = succ_rate_r < succ_rate_l;
if (!want_swap)
reason = "Operation is OR and right success rate >= left";
}
- else if (pred_is(p, pred_and))
+ else if (pred_is (p, pred_and))
{
want_swap = succ_rate_r > succ_rate_l;
if (!want_swap)
@@ -607,10 +607,10 @@ consider_arm_swap(struct predicate *p)
{
if (options.debug_options & DebugTreeOpt)
{
- fprintf(stderr, "Performing arm swap on:\n");
+ fprintf (stderr, "Performing arm swap on:\n");
print_tree (stderr, p, 0);
}
- perform_arm_swap(p);
+ perform_arm_swap (p);
return true;
}
}
@@ -618,14 +618,14 @@ consider_arm_swap(struct predicate *p)
if (options.debug_options & DebugTreeOpt)
{
- fprintf(stderr, "Not an arm swap candidate (%s):\n", reason);
+ fprintf (stderr, "Not an arm swap candidate (%s):\n", reason);
print_tree (stderr, p, 0);
}
return false;
}
static boolean
-do_arm_swaps(struct predicate *p)
+do_arm_swaps (struct predicate *p)
{
if (p)
{
@@ -633,9 +633,9 @@ do_arm_swaps(struct predicate *p)
do
{
swapped = false;
- if (consider_arm_swap(p)
- || do_arm_swaps(p->pred_left)
- || do_arm_swaps(p->pred_right))
+ if (consider_arm_swap (p)
+ || do_arm_swaps (p->pred_left)
+ || do_arm_swaps (p->pred_right))
{
swapped = true;
}
@@ -700,7 +700,7 @@ opt_expr (struct predicate **eval_treep)
return (false);
for (i=0; i<NumEvaluationCosts; i++)
- predlist_init(&cbo_list[i]);
+ predlist_init (&cbo_list[i]);
/* Set up to normalize tree as a left-linked list of ANDs or ORs.
Set `curr' to the leftmost node, `prevp' to its address, and
@@ -742,7 +742,7 @@ opt_expr (struct predicate **eval_treep)
if (curr->p_type == BI_OP)
{
if (curr->p_prec != biop_prec)
- curr = set_new_parent(curr, biop_prec, prevp);
+ curr = set_new_parent (curr, biop_prec, prevp);
}
/* See which predicate type we have. */
@@ -766,22 +766,22 @@ opt_expr (struct predicate **eval_treep)
/* If it's one of our special primaries, move it to the
front of the list for that primary. */
- if (predicate_is_cost_free(curr->pred_right))
+ if (predicate_is_cost_free (curr->pred_right))
{
if (options.debug_options & DebugTreeOpt)
{
- fprintf(stderr, "-O%d: promoting cheap predicate ",
- (int)options.optimisation_level);
- print_predicate(stderr, curr->pred_right);
- fprintf(stderr, " into name_list\n");
+ fprintf (stderr, "-O%d: promoting cheap predicate ",
+ (int)options.optimisation_level);
+ print_predicate (stderr, curr->pred_right);
+ fprintf (stderr, " into name_list\n");
}
- predlist_insert(&name_list, curr, prevp);
+ predlist_insert (&name_list, curr, prevp);
continue;
}
if (pred_func == pred_regex)
{
- predlist_insert(®ex_list, curr, prevp);
+ predlist_insert (®ex_list, curr, prevp);
continue;
}
@@ -795,13 +795,13 @@ opt_expr (struct predicate **eval_treep)
{
if (options.debug_options & DebugTreeOpt)
{
- fprintf(stderr, "-O%d: categorising predicate ",
- (int)options.optimisation_level);
- print_predicate(stderr, curr->pred_right);
- fprintf(stderr, " by cost (%s)\n",
- cost_name(curr->pred_right->p_cost));
+ fprintf (stderr, "-O%d: categorising predicate ",
+ (int)options.optimisation_level);
+ print_predicate (stderr, curr->pred_right);
+ fprintf (stderr, " by cost (%s)\n",
+ cost_name(curr->pred_right->p_cost));
}
- predlist_insert(&cbo_list[curr->pred_right->p_cost], curr,
prevp);
+ predlist_insert (&cbo_list[curr->pred_right->p_cost], curr,
prevp);
continue;
}
}
@@ -833,7 +833,7 @@ opt_expr (struct predicate **eval_treep)
last_sidep = prevp;
/* Incorporate lists and reset list pointers for this group. */
- merge_lists(cbo_list, NumEvaluationCosts, &name_list, ®ex_list,
last_sidep);
+ merge_lists (cbo_list, NumEvaluationCosts, &name_list, ®ex_list,
last_sidep);
has_side_effects = true;
}
@@ -842,12 +842,12 @@ opt_expr (struct predicate **eval_treep)
/* Do final list merges. */
last_sidep = prevp;
- merge_lists(cbo_list, NumEvaluationCosts, &name_list, ®ex_list,
last_sidep);
+ merge_lists (cbo_list, NumEvaluationCosts, &name_list, ®ex_list,
last_sidep);
return has_side_effects;
}
static float
-constrain_rate(float rate)
+constrain_rate (float rate)
{
if (rate > 1.0f)
return 1.0;
@@ -884,12 +884,12 @@ set_new_parent (struct predicate *curr, enum
predicate_precedence high_prec, str
case OR_PREC:
new_parent->pred_func = pred_or;
new_parent->p_name = "-o";
- new_parent->est_success_rate = constrain_rate(curr->est_success_rate);
+ new_parent->est_success_rate = constrain_rate (curr->est_success_rate);
break;
case AND_PREC:
new_parent->pred_func = pred_and;
new_parent->p_name = "-a";
- new_parent->est_success_rate = constrain_rate(curr->est_success_rate);
+ new_parent->est_success_rate = constrain_rate (curr->est_success_rate);
break;
default:
; /* empty */
@@ -1000,17 +1000,17 @@ static struct pred_cost_lookup costlookup[] =
static int pred_table_sorted = 0;
static boolean
-check_sorted(void *base, size_t members, size_t membersize,
- int (*cmpfn)(const void*, const void*))
+check_sorted (void *base, size_t members, size_t membersize,
+ int (*cmpfn)(const void*, const void*))
{
const char *p = base;
size_t i;
for (i=1u; i<members; ++i)
{
- int result = cmpfn(p+i*membersize, p+(i-1)*membersize);
+ int result = cmpfn (p+i*membersize, p+(i-1)*membersize);
if (result < 0)
return false;
- result = cmpfn(p+(i-1)*membersize, p+i*membersize);
+ result = cmpfn (p+(i-1)*membersize, p+i*membersize);
assert (result <= 0);
}
return true;
@@ -1018,7 +1018,7 @@ check_sorted(void *base, size_t members, size_t
membersize,
static int
-cost_table_comparison(const void *p1, const void *p2)
+cost_table_comparison (const void *p1, const void *p2)
{
/* We have to compare the function pointers with memcmp(),
* because ISO C does not allow magnitude comparison of
@@ -1033,11 +1033,11 @@ cost_table_comparison(const void *p1, const void *p2)
u1.pfn = pc1->fn;
u2.pfn = pc2->fn;
- return memcmp(u1.mem, u2.mem, sizeof(u1.pfn));
+ return memcmp (u1.mem, u2.mem, sizeof(u1.pfn));
}
static enum EvaluationCost
-get_pred_cost(const struct predicate *p)
+get_pred_cost (const struct predicate *p)
{
enum EvaluationCost data_requirement_cost = NeedsNothing;
enum EvaluationCost inherent_cost = NeedsUnknown;
@@ -1059,14 +1059,14 @@ get_pred_cost(const struct predicate *p)
data_requirement_cost = NeedsNothing;
}
- if (pred_is(p, pred_exec) || pred_is(p, pred_execdir))
+ if (pred_is (p, pred_exec) || pred_is(p, pred_execdir))
{
if (p->args.exec_vec.multiple)
inherent_cost = NeedsEventualExec;
else
inherent_cost = NeedsImmediateExec;
}
- else if (pred_is(p, pred_fprintf))
+ else if (pred_is (p, pred_fprintf))
{
/* the parser calculated the cost for us. */
inherent_cost = p->p_cost;
@@ -1078,25 +1078,25 @@ get_pred_cost(const struct predicate *p)
if (!pred_table_sorted)
{
- qsort(costlookup,
- sizeof(costlookup)/sizeof(costlookup[0]),
- sizeof(costlookup[0]),
- cost_table_comparison);
-
- if (!check_sorted(costlookup,
- sizeof(costlookup)/sizeof(costlookup[0]),
- sizeof(costlookup[0]),
- cost_table_comparison))
+ qsort (costlookup,
+ sizeof(costlookup)/sizeof(costlookup[0]),
+ sizeof(costlookup[0]),
+ cost_table_comparison);
+
+ if (!check_sorted (costlookup,
+ sizeof(costlookup)/sizeof(costlookup[0]),
+ sizeof(costlookup[0]),
+ cost_table_comparison))
{
error(1, 0, "Failed to sort the costlookup array (indirect).");
}
pred_table_sorted = 1;
}
key.fn = p->pred_func;
- entry = bsearch(&key, costlookup,
- sizeof(costlookup)/sizeof(costlookup[0]),
- sizeof(costlookup[0]),
- cost_table_comparison);
+ entry = bsearch (&key, costlookup,
+ sizeof(costlookup)/sizeof(costlookup[0]),
+ sizeof(costlookup[0]),
+ cost_table_comparison);
if (entry)
{
inherent_cost = ((const struct pred_cost_lookup*)entry)->cost;
@@ -1119,21 +1119,21 @@ estimate_costs (struct predicate *tree)
{
if (tree)
{
- estimate_costs(tree->pred_right);
- estimate_costs(tree->pred_left);
+ estimate_costs (tree->pred_right);
+ estimate_costs (tree->pred_left);
tree->p_cost = get_pred_cost(tree);
}
}
struct predicate*
-get_eval_tree(void)
+get_eval_tree (void)
{
return eval_tree;
}
static float
-getrate(const struct predicate *p)
+getrate (const struct predicate *p)
{
if (p)
return p->est_success_rate;
@@ -1143,14 +1143,14 @@ getrate(const struct predicate *p)
float
-calculate_derived_rates(struct predicate *p)
+calculate_derived_rates (struct predicate *p)
{
assert (NULL != p);
if (p->pred_right)
- calculate_derived_rates(p->pred_right);
+ calculate_derived_rates (p->pred_right);
if (p->pred_left)
- calculate_derived_rates(p->pred_left);
+ calculate_derived_rates (p->pred_left);
assert (p->p_type != CLOSE_PAREN);
assert (p->p_type != OPEN_PAREN);
@@ -1169,7 +1169,7 @@ calculate_derived_rates(struct predicate *p)
case UNI_OP:
/* Unary operators must have exactly one operand */
- assert (pred_is(p, pred_negate));
+ assert (pred_is (p, pred_negate));
assert (NULL == p->pred_left);
p->est_success_rate = (1.0 - p->pred_right->est_success_rate);
return p->est_success_rate;
@@ -1178,17 +1178,17 @@ calculate_derived_rates(struct predicate *p)
{
float rate;
/* Binary operators must have two operands */
- if (pred_is(p, pred_and))
+ if (pred_is (p, pred_and))
{
- rate = getrate(p->pred_right) * getrate(p->pred_left);
+ rate = getrate (p->pred_right) * getrate(p->pred_left);
}
- else if (pred_is(p, pred_comma))
+ else if (pred_is (p, pred_comma))
{
rate = 1.0f;
}
- else if (pred_is(p, pred_or))
+ else if (pred_is (p, pred_or))
{
- rate = getrate(p->pred_right) + getrate(p->pred_left);
+ rate = getrate (p->pred_right) + getrate(p->pred_left);
}
else
{
@@ -1196,7 +1196,7 @@ calculate_derived_rates(struct predicate *p)
assert (0);
abort ();
}
- p->est_success_rate = constrain_rate(rate);
+ p->est_success_rate = constrain_rate (rate);
}
return p->est_success_rate;
@@ -1214,7 +1214,7 @@ calculate_derived_rates(struct predicate *p)
* asserts that this property still holds.
*
*/
-static void check_normalization(struct predicate *p, boolean at_root)
+static void check_normalization (struct predicate *p, boolean at_root)
{
if (at_root)
{
@@ -1228,12 +1228,12 @@ static void check_normalization(struct predicate *p,
boolean at_root)
}
if (p->pred_right)
{
- check_normalization(p->pred_right, false);
+ check_normalization (p->pred_right, false);
}
}
struct predicate*
-build_expression_tree(int argc, char *argv[], int end_of_leading_options)
+build_expression_tree (int argc, char *argv[], int end_of_leading_options)
{
const struct parser_table *parse_entry; /* Pointer to the parsing table
entry for this expression. */
char *predicate_name; /* Name of predicate being parsed. */
@@ -1255,9 +1255,9 @@ build_expression_tree(int argc, char *argv[], int
end_of_leading_options)
/* Enclose the expression in `( ... )' so a default -print will
apply to the whole expression. */
- entry_open = find_parser("(");
- entry_close = find_parser(")");
- entry_print = find_parser("print");
+ entry_open = find_parser ("(");
+ entry_close = find_parser (")");
+ entry_print = find_parser ("print");
assert (entry_open != NULL);
assert (entry_close != NULL);
assert (entry_print != NULL);
@@ -1265,16 +1265,16 @@ build_expression_tree(int argc, char *argv[], int
end_of_leading_options)
parse_openparen (entry_open, argv, &argc);
last_pred->p_name = "(";
predicates->artificial = true;
- parse_begin_user_args(argv, argc, last_pred, predicates);
- pred_sanity_check(last_pred);
+ parse_begin_user_args (argv, argc, last_pred, predicates);
+ pred_sanity_check (last_pred);
/* Build the input order list. */
while (i < argc )
{
- if (!looks_like_expression(argv[i], false))
+ if (!looks_like_expression (argv[i], false))
{
error (0, 0, _("paths must precede expression: %s"), argv[i]);
- usage(stderr, 1, NULL);
+ usage (stderr, 1, NULL);
}
predicate_name = argv[i];
@@ -1330,7 +1330,7 @@ build_expression_tree(int argc, char *argv[], int
end_of_leading_options)
pred_sanity_check(last_pred);
pred_sanity_check(predicates); /* XXX: expensive */
}
- parse_end_user_args(argv, argc, last_pred, predicates);
+ parse_end_user_args (argv, argc, last_pred, predicates);
if (predicates->pred_next == NULL)
{
/* No predicates that do something other than set a global variable
@@ -1349,7 +1349,7 @@ build_expression_tree(int argc, char *argv[], int
end_of_leading_options)
remove the unneeded initial `('. */
cur_pred = predicates;
predicates = predicates->pred_next;
- pred_sanity_check(predicates); /* XXX: expensive */
+ pred_sanity_check (predicates); /* XXX: expensive */
free (cur_pred);
}
else
@@ -1358,12 +1358,12 @@ build_expression_tree(int argc, char *argv[], int
end_of_leading_options)
parse_closeparen (entry_close, argv, &argc);
last_pred->p_name = ")";
last_pred->artificial = true;
- pred_sanity_check(last_pred);
+ pred_sanity_check (last_pred);
parse_print (entry_print, argv, &argc);
last_pred->p_name = "-print";
last_pred->artificial = true;
- pred_sanity_check(last_pred);
- pred_sanity_check(predicates); /* XXX: expensive */
+ pred_sanity_check (last_pred);
+ pred_sanity_check (predicates); /* XXX: expensive */
}
if (options.debug_options & (DebugExpressionTree|DebugTreeOpt))
@@ -1373,13 +1373,13 @@ build_expression_tree(int argc, char *argv[], int
end_of_leading_options)
}
/* do a sanity check */
- check_option_combinations(predicates);
- pred_sanity_check(predicates);
+ check_option_combinations (predicates);
+ pred_sanity_check (predicates);
/* Done parsing the predicates. Build the evaluation tree. */
cur_pred = predicates;
eval_tree = get_expr (&cur_pred, NO_PREC, NULL);
- calculate_derived_rates(eval_tree);
+ calculate_derived_rates (eval_tree);
/* Check if we have any left-over predicates (this fixes
* Debian bug #185202).
@@ -1387,7 +1387,7 @@ build_expression_tree(int argc, char *argv[], int
end_of_leading_options)
if (cur_pred != NULL)
{
/* cur_pred->p_name is often NULL here */
- if (pred_is(cur_pred, pred_closeparen))
+ if (pred_is (cur_pred, pred_closeparen))
{
/* e.g. "find \( -true \) \)" */
error (1, 0, _("you have too many ')'"));
@@ -1407,26 +1407,26 @@ build_expression_tree(int argc, char *argv[], int
end_of_leading_options)
print_tree (stderr, eval_tree, 0);
}
- estimate_costs(eval_tree);
+ estimate_costs (eval_tree);
/* Rearrange the eval tree in optimal-predicate order. */
opt_expr (&eval_tree);
/* Check that the tree is in normalised order (opt_expr does this) */
- check_normalization(eval_tree, true);
+ check_normalization (eval_tree, true);
- do_arm_swaps(eval_tree);
+ do_arm_swaps (eval_tree);
/* Check that the tree is still in normalised order */
- check_normalization(eval_tree, true);
+ check_normalization (eval_tree, true);
if (options.debug_options & (DebugExpressionTree|DebugTreeOpt))
{
fprintf (stderr, "Optimized Eval Tree:\n");
print_tree (stderr, eval_tree, 0);
fprintf (stderr, "Optimized command line:\n");
- print_optlist(stderr, eval_tree);
- fprintf(stderr, "\n");
+ print_optlist (stderr, eval_tree);
+ fprintf (stderr, "\n");
}
return eval_tree;
@@ -1435,7 +1435,7 @@ build_expression_tree(int argc, char *argv[], int
end_of_leading_options)
/* Initialise the performance data for a predicate.
*/
static void
-init_pred_perf(struct predicate *pred)
+init_pred_perf (struct predicate *pred)
{
struct predicate_performance_info *p = &pred->perf;
p->visits = p->successes = 0;
@@ -1445,7 +1445,7 @@ init_pred_perf(struct predicate *pred)
struct predicate *
get_new_pred_noarg (const struct parser_table *entry)
{
- struct predicate *p = get_new_pred(entry);
+ struct predicate *p = get_new_pred (entry);
if (p)
{
p->arg_text = NULL;
@@ -1504,7 +1504,7 @@ get_new_pred (const struct parser_table *entry)
last_pred->literal_control_chars = options.literal_control_chars;
last_pred->artificial = false;
last_pred->est_success_rate = 1.0;
- init_pred_perf(last_pred);
+ init_pred_perf (last_pred);
return last_pred;
}
@@ -1521,7 +1521,7 @@ get_new_pred_chk_op (const struct parser_table *entry,
/* Locate the entry in the parser table for the "and" operator */
if (NULL == entry_and)
- entry_and = find_parser("and");
+ entry_and = find_parser ("and");
/* Check that it's actually there. If not, that is a bug.*/
assert (entry_and != NULL);
@@ -1618,7 +1618,7 @@ static const char *
cost_name (enum EvaluationCost cost)
{
unsigned int i;
- unsigned int n = sizeof(cost_table)/sizeof(cost_table[0]);
+ unsigned int n = sizeof (cost_table)/sizeof(cost_table[0]);
for (i = 0; i<n; ++i)
if (cost_table[i].cost == cost)
@@ -1665,11 +1665,11 @@ print_tree (FILE *fp, struct predicate *node, int
indent)
for (i = 0; i < indent; i++)
fprintf (fp, " ");
fprintf (fp, "pred=[");
- print_predicate(fp, node);
+ print_predicate (fp, node);
fprintf (fp, "] type=%s prec=%s",
type_name (node->p_type), prec_name (node->p_prec));
fprintf (fp, " cost=%s rate=%#03.2g %sside effects ",
- cost_name(node->p_cost),
+ cost_name (node->p_cost),
node->est_success_rate,
(node->side_effects ? "" : "no "));
diff --git a/find/util.c b/find/util.c
index 505dd02..734391f 100644
--- a/find/util.c
+++ b/find/util.c
@@ -124,36 +124,36 @@ struct predicate *
insert_primary (const struct parser_table *entry, const char *arg)
{
assert (entry->pred_func != NULL);
- return insert_primary_withpred(entry, entry->pred_func, arg);
+ return insert_primary_withpred (entry, entry->pred_func, arg);
}
struct predicate *
insert_primary_noarg (const struct parser_table *entry)
{
- return insert_primary(entry, NULL);
+ return insert_primary (entry, NULL);
}
static void
-show_valid_debug_options(FILE *fp, int full)
+show_valid_debug_options (FILE *fp, int full)
{
int i;
if (full)
{
- fprintf(fp, "Valid arguments for -D:\n");
+ fprintf (fp, "Valid arguments for -D:\n");
for (i=0; i<N_DEBUGASSOC; ++i)
{
- fprintf(fp, "%-10s %s\n",
- debugassoc[i].name,
- debugassoc[i].docstring);
+ fprintf (fp, "%-10s %s\n",
+ debugassoc[i].name,
+ debugassoc[i].docstring);
}
}
else
{
for (i=0; i<N_DEBUGASSOC; ++i)
{
- fprintf(fp, "%s%s", (i>0 ? "|" : ""), debugassoc[i].name);
+ fprintf (fp, "%s%s", (i>0 ? "|" : ""), debugassoc[i].name);
}
}
}
@@ -165,14 +165,14 @@ usage (FILE *fp, int status, char *msg)
fprintf (fp, "%s: %s\n", program_name, msg);
fprintf (fp, _("Usage: %s [-H] [-L] [-P] [-Olevel] [-D "), program_name);
- show_valid_debug_options(fp, 0);
+ show_valid_debug_options (fp, 0);
fprintf (fp, _("] [path...] [expression]\n"));
if (0 != status)
exit (status);
}
void
-set_stat_placeholders(struct stat *p)
+set_stat_placeholders (struct stat *p)
{
#if HAVE_STRUCT_STAT_ST_BIRTHTIME
p->st_birthtime = 0;
@@ -201,14 +201,14 @@ get_statinfo (const char *pathname, const char *name,
struct stat *p)
*/
if (!state.have_stat)
{
- set_stat_placeholders(p);
+ set_stat_placeholders (p);
if (0 == (*options.xstat) (name, p))
{
if (00000 == p->st_mode)
{
/* Savannah bug #16378. */
- error(0, 0, _("Warning: file %s appears to have mode 0000"),
- quotearg_n_style(0, options.err_quoting_style, name));
+ error (0, 0, _("Warning: file %s appears to have mode 0000"),
+ quotearg_n_style (0, options.err_quoting_style, name));
}
}
else
@@ -216,7 +216,7 @@ get_statinfo (const char *pathname, const char *name,
struct stat *p)
if (!options.ignore_readdir_race || (errno != ENOENT) )
{
error (0, errno, "%s",
- safely_quote_err_filename(0, pathname));
+ safely_quote_err_filename (0, pathname));
state.exit_status = 1;
}
return -1;
@@ -268,7 +268,7 @@ get_info (const char *pathname,
}
if (todo)
{
- int result = get_statinfo(pathname, state.rel_pathname, p);
+ int result = get_statinfo (pathname, state.rel_pathname, p);
if (result != 0)
{
/* Verify some postconditions. We can't check st_mode for
@@ -299,7 +299,7 @@ get_info (const char *pathname,
*/
#if defined O_NOFOLLOW
boolean
-check_nofollow(void)
+check_nofollow (void)
{
struct utsname uts;
float release;
@@ -309,17 +309,17 @@ check_nofollow(void)
return false;
}
- if (0 == uname(&uts))
+ if (0 == uname (&uts))
{
/* POSIX requires that atof() ignore "unrecognised suffixes". */
- release = atof(uts.release);
+ release = atof (uts.release);
- if (0 == strcmp("Linux", uts.sysname))
+ if (0 == strcmp ("Linux", uts.sysname))
{
/* Linux kernels 2.1.126 and earlier ignore the O_NOFOLLOW flag. */
return release >= 2.2; /* close enough */
}
- else if (0 == strcmp("FreeBSD", uts.sysname))
+ else if (0 == strcmp ("FreeBSD", uts.sysname))
{
/* FreeBSD 3.0-CURRENT and later support it */
return release >= 3.1;
@@ -339,16 +339,16 @@ check_nofollow(void)
* have no effect if there are no arguments waiting).
*/
static void
-do_complete_pending_execdirs(struct predicate *p, int dir_fd)
+do_complete_pending_execdirs (struct predicate *p, int dir_fd)
{
if (NULL == p)
return;
assert (state.execdirs_outstanding);
- do_complete_pending_execdirs(p->pred_left, dir_fd);
+ do_complete_pending_execdirs (p->pred_left, dir_fd);
- if (pred_is(p, pred_execdir) || pred_is(p, pred_okdir))
+ if (pred_is (p, pred_execdir) || pred_is(p, pred_okdir))
{
/* It's an exec-family predicate. p->args.exec_val is valid. */
if (p->args.exec_vec.multiple)
@@ -366,15 +366,15 @@ do_complete_pending_execdirs(struct predicate *p, int
dir_fd)
}
}
- do_complete_pending_execdirs(p->pred_right, dir_fd);
+ do_complete_pending_execdirs (p->pred_right, dir_fd);
}
void
-complete_pending_execdirs(int dir_fd)
+complete_pending_execdirs (int dir_fd)
{
if (state.execdirs_outstanding)
{
- do_complete_pending_execdirs(get_eval_tree(), dir_fd);
+ do_complete_pending_execdirs (get_eval_tree(), dir_fd);
state.execdirs_outstanding = false;
}
}
@@ -387,18 +387,18 @@ complete_pending_execdirs(int dir_fd)
* there are no arguments waiting).
*/
void
-complete_pending_execs(struct predicate *p)
+complete_pending_execs (struct predicate *p)
{
if (NULL == p)
return;
- complete_pending_execs(p->pred_left);
+ complete_pending_execs (p->pred_left);
/* It's an exec-family predicate then p->args.exec_val is valid
* and we can check it.
*/
/* XXX: what about pred_ok() ? */
- if (pred_is(p, pred_exec) && p->args.exec_vec.multiple)
+ if (pred_is (p, pred_exec) && p->args.exec_vec.multiple)
{
struct exec_val *execp = &p->args.exec_vec;
@@ -413,20 +413,20 @@ complete_pending_execs(struct predicate *p)
}
}
- complete_pending_execs(p->pred_right);
+ complete_pending_execs (p->pred_right);
}
static void
-traverse_tree(struct predicate *tree,
+traverse_tree (struct predicate *tree,
void (*callback)(struct predicate*))
{
if (tree->pred_left)
- traverse_tree(tree->pred_left, callback);
+ traverse_tree (tree->pred_left, callback);
- callback(tree);
+ callback (tree);
if (tree->pred_right)
- traverse_tree(tree->pred_right, callback);
+ traverse_tree (tree->pred_right, callback);
}
/* After sharefile_destroy is called, our output file
@@ -460,17 +460,17 @@ fd_leak_check_is_enabled (void)
void
cleanup (void)
{
- struct predicate *eval_tree = get_eval_tree();
+ struct predicate *eval_tree = get_eval_tree ();
if (eval_tree)
{
- traverse_tree(eval_tree, complete_pending_execs);
- complete_pending_execdirs(get_current_dirfd());
+ traverse_tree (eval_tree, complete_pending_execs);
+ complete_pending_execdirs (get_current_dirfd());
}
/* Close ouptut files and NULL out references to them. */
sharefile_destroy (state.shared_files);
if (eval_tree)
- traverse_tree(eval_tree, undangle_file_pointers);
+ traverse_tree (eval_tree, undangle_file_pointers);
if (fd_leak_check_is_enabled ())
{
@@ -488,23 +488,23 @@ cleanup (void)
*/
#undef DEBUG_SV_BUG_16378
#if defined DEBUG_SV_BUG_16378
-static int hook_fstatat(int fd, const char *name, struct stat *p, int flags)
+static int hook_fstatat (int fd, const char *name, struct stat *p, int flags)
{
static int warned = 0;
if (!warned)
{
/* No use of _() here; no point asking translators to translate a debug
msg */
- error(0, 0,
- "Warning: some debug code is enabled for Savannah bug #16378; "
- "this should not occur in released versions of findutils!");
+ error (0, 0,
+ "Warning: some debug code is enabled for Savannah bug #16378; "
+ "this should not occur in released versions of findutils!");
warned = 1;
}
- if (0 == strcmp(name, "./mode0file")
- || 0 == strcmp(name, "mode0file"))
+ if (0 == strcmp (name, "./mode0file")
+ || 0 == strcmp (name, "mode0file"))
{
- time_t now = time(NULL);
+ time_t now = time (NULL);
long day = 86400;
p->st_rdev = 0;
@@ -512,7 +512,7 @@ static int hook_fstatat(int fd, const char *name, struct
stat *p, int flags)
p->st_ino = 0;
p->st_mode = 0; /* SV bug #16378 */
p->st_nlink = 1;
- p->st_uid = geteuid();
+ p->st_uid = geteuid ();
p->st_gid = 0;
p->st_size = 42;
p->st_blksize = 32768;
@@ -522,16 +522,16 @@ static int hook_fstatat(int fd, const char *name, struct
stat *p, int flags)
return 0;
}
- return fstatat(fd, name, p, flags);
+ return fstatat (fd, name, p, flags);
}
# undef fstatat
-# define fstatat(fd,name,p,flags) hook_fstatat((fd),(name),(p),(flags))
+# define fstatat (fd,name,p,flags) hook_fstatat((fd),(name),(p),(flags))
#endif
static int
-fallback_stat(const char *name, struct stat *p, int prev_rv)
+fallback_stat (const char *name, struct stat *p, int prev_rv)
{
/* Our original stat() call failed. Perhaps we can't follow a
* symbolic link. If that might be the problem, lstat() the link.
@@ -569,28 +569,28 @@ fallback_stat(const char *name, struct stat *p, int
prev_rv)
* examine the link itself.
*/
int
-optionh_stat(const char *name, struct stat *p)
+optionh_stat (const char *name, struct stat *p)
{
if (AT_FDCWD != state.cwd_dir_fd)
assert (state.cwd_dir_fd >= 0);
- set_stat_placeholders(p);
+ set_stat_placeholders (p);
if (0 == state.curdepth)
{
/* This file is from the command line; deference the link (if it
* is a link).
*/
int rv;
- rv = fstatat(state.cwd_dir_fd, name, p, 0);
+ rv = fstatat (state.cwd_dir_fd, name, p, 0);
if (0 == rv)
return 0; /* success */
else
- return fallback_stat(name, p, rv);
+ return fallback_stat (name, p, rv);
}
else
{
/* Not a file on the command line; do not dereference the link.
*/
- return fstatat(state.cwd_dir_fd, name, p, AT_SYMLINK_NOFOLLOW);
+ return fstatat (state.cwd_dir_fd, name, p, AT_SYMLINK_NOFOLLOW);
}
}
@@ -605,12 +605,12 @@ optionl_stat(const char *name, struct stat *p)
if (AT_FDCWD != state.cwd_dir_fd)
assert (state.cwd_dir_fd >= 0);
- set_stat_placeholders(p);
- rv = fstatat(state.cwd_dir_fd, name, p, 0);
+ set_stat_placeholders (p);
+ rv = fstatat (state.cwd_dir_fd, name, p, 0);
if (0 == rv)
return 0; /* normal case. */
else
- return fallback_stat(name, p, rv);
+ return fallback_stat (name, p, rv);
}
/* optionp_stat() implements the stat operation when the -P option is
@@ -618,11 +618,11 @@ optionl_stat(const char *name, struct stat *p)
* the symbolic link itself, not the thing it points to.
*/
int
-optionp_stat(const char *name, struct stat *p)
+optionp_stat (const char *name, struct stat *p)
{
assert ((state.cwd_dir_fd >= 0) || (state.cwd_dir_fd==AT_FDCWD));
- set_stat_placeholders(p);
- return fstatat(state.cwd_dir_fd, name, p, AT_SYMLINK_NOFOLLOW);
+ set_stat_placeholders (p);
+ return fstatat (state.cwd_dir_fd, name, p, AT_SYMLINK_NOFOLLOW);
}
@@ -637,11 +637,11 @@ debug_stat (const char *file, struct stat *bufp)
switch (options.symlink_handling)
{
case SYMLINK_ALWAYS_DEREF:
- return optionl_stat(file, bufp);
+ return optionl_stat (file, bufp);
case SYMLINK_DEREF_ARGSONLY:
- return optionh_stat(file, bufp);
+ return optionh_stat (file, bufp);
case SYMLINK_NEVER_DEREF:
- return optionp_stat(file, bufp);
+ return optionp_stat (file, bufp);
}
/*NOTREACHED*/
assert (0);
@@ -668,11 +668,11 @@ following_links(void)
/* Take a "mode" indicator and fill in the files of 'state'.
*/
int
-digest_mode(mode_t *mode,
- const char *pathname,
- const char *name,
- struct stat *pstat,
- boolean leaf)
+digest_mode (mode_t *mode,
+ const char *pathname,
+ const char *name,
+ struct stat *pstat,
+ boolean leaf)
{
/* If we know the type of the directory entry, and it is not a
* symbolic link, we may be able to avoid a stat() or lstat() call.
@@ -682,7 +682,7 @@ digest_mode(mode_t *mode,
if (S_ISLNK(*mode) && following_links())
{
/* mode is wrong because we should have followed the symlink. */
- if (get_statinfo(pathname, name, pstat) != 0)
+ if (get_statinfo (pathname, name, pstat) != 0)
return 0;
*mode = state.type = pstat->st_mode;
state.have_type = true;
@@ -707,7 +707,7 @@ digest_mode(mode_t *mode,
}
else
{
- if (get_statinfo(pathname, name, pstat) != 0)
+ if (get_statinfo (pathname, name, pstat) != 0)
return 0;
/* If -L is in effect and we are dealing with a symlink,
@@ -742,7 +742,7 @@ default_prints (struct predicate *pred)
}
boolean
-looks_like_expression(const char *arg, boolean leading)
+looks_like_expression (const char *arg, boolean leading)
{
switch (arg[0])
{
@@ -776,7 +776,7 @@ looks_like_expression(const char *arg, boolean leading)
}
static void
-process_debug_options(char *arg)
+process_debug_options (char *arg)
{
const char *p;
char *token_context = NULL;
@@ -784,14 +784,14 @@ process_debug_options(char *arg)
boolean empty = true;
size_t i;
- p = strtok_r(arg, delimiters, &token_context);
+ p = strtok_r (arg, delimiters, &token_context);
while (p)
{
empty = false;
for (i=0; i<N_DEBUGASSOC; ++i)
{
- if (0 == strcmp(debugassoc[i].name, p))
+ if (0 == strcmp (debugassoc[i].name, p))
{
options.debug_options |= debugassoc[i].val;
break;
@@ -799,10 +799,10 @@ process_debug_options(char *arg)
}
if (i >= N_DEBUGASSOC)
{
- error(0, 0, _("Ignoring unrecognised debug flag %s"),
- quotearg_n_style(0, options.err_quoting_style, arg));
+ error (0, 0, _("Ignoring unrecognised debug flag %s"),
+ quotearg_n_style (0, options.err_quoting_style, arg));
}
- p = strtok_r(NULL, delimiters, &token_context);
+ p = strtok_r (NULL, delimiters, &token_context);
}
if (empty)
{
@@ -810,55 +810,55 @@ process_debug_options(char *arg)
}
else if (options.debug_options & DebugHelp)
{
- show_valid_debug_options(stdout, 1);
- exit(0);
+ show_valid_debug_options (stdout, 1);
+ exit (0);
}
}
static void
-process_optimisation_option(const char *arg)
+process_optimisation_option (const char *arg)
{
if (0 == arg[0])
{
- error(1, 0, _("The -O option must be immediately followed by a decimal
integer"));
+ error (1, 0, _("The -O option must be immediately followed by a decimal
integer"));
}
else
{
unsigned long opt_level;
char *end;
- if (!isdigit( (unsigned char) arg[0] ))
+ if (!isdigit ( (unsigned char) arg[0] ))
{
- error(1, 0, _("Please specify a decimal number immediately after
-O"));
+ error (1, 0, _("Please specify a decimal number immediately after
-O"));
}
else
{
int prev_errno = errno;
errno = 0;
- opt_level = strtoul(arg, &end, 10);
+ opt_level = strtoul (arg, &end, 10);
if ( (0==opt_level) && (end==arg) )
{
- error(1, 0, _("Please specify a decimal number immediately after
-O"));
+ error (1, 0, _("Please specify a decimal number immediately after
-O"));
}
else if (*end)
{
/* unwanted trailing characters. */
- error(1, 0, _("Invalid optimisation level %s"), arg);
+ error (1, 0, _("Invalid optimisation level %s"), arg);
}
else if ( (ULONG_MAX==opt_level) && errno)
{
- error(1, errno, _("Invalid optimisation level %s"), arg);
+ error (1, errno, _("Invalid optimisation level %s"), arg);
}
else if (opt_level > USHRT_MAX)
{
/* tricky to test, as on some platforms USHORT_MAX and ULONG_MAX
* can have the same value, though this is unusual.
*/
- error(1, 0, _("Optimisation level %lu is too high. "
- "If you want to find files very quickly, "
- "consider using GNU locate."),
+ error (1, 0, _("Optimisation level %lu is too high. "
+ "If you want to find files very quickly, "
+ "consider using GNU locate."),
opt_level);
}
else
@@ -871,41 +871,41 @@ process_optimisation_option(const char *arg)
}
int
-process_leading_options(int argc, char *argv[])
+process_leading_options (int argc, char *argv[])
{
int i, end_of_leading_options;
for (i=1; (end_of_leading_options = i) < argc; ++i)
{
- if (0 == strcmp("-H", argv[i]))
+ if (0 == strcmp ("-H", argv[i]))
{
/* Meaning: dereference symbolic links on command line, but nowhere
else. */
- set_follow_state(SYMLINK_DEREF_ARGSONLY);
+ set_follow_state (SYMLINK_DEREF_ARGSONLY);
}
- else if (0 == strcmp("-L", argv[i]))
+ else if (0 == strcmp ("-L", argv[i]))
{
/* Meaning: dereference all symbolic links. */
- set_follow_state(SYMLINK_ALWAYS_DEREF);
+ set_follow_state (SYMLINK_ALWAYS_DEREF);
}
- else if (0 == strcmp("-P", argv[i]))
+ else if (0 == strcmp ("-P", argv[i]))
{
/* Meaning: never dereference symbolic links (default). */
- set_follow_state(SYMLINK_NEVER_DEREF);
+ set_follow_state (SYMLINK_NEVER_DEREF);
}
- else if (0 == strcmp("--", argv[i]))
+ else if (0 == strcmp ("--", argv[i]))
{
/* -- signifies the end of options. */
end_of_leading_options = i+1; /* Next time start with the next option
*/
break;
}
- else if (0 == strcmp("-D", argv[i]))
+ else if (0 == strcmp ("-D", argv[i]))
{
- process_debug_options(argv[i+1]);
+ process_debug_options (argv[i+1]);
++i; /* skip the argument too. */
}
- else if (0 == strncmp("-O", argv[i], 2))
+ else if (0 == strncmp ("-O", argv[i], 2))
{
- process_optimisation_option(argv[i]+2);
+ process_optimisation_option (argv[i]+2);
}
else
{
@@ -927,13 +927,13 @@ now(void)
struct timeval tv;
time_t t;
- if (0 == gettimeofday(&tv, NULL))
+ if (0 == gettimeofday (&tv, NULL))
{
retval.tv_sec = tv.tv_sec;
retval.tv_nsec = tv.tv_usec * 1000; /* convert unit from microseconds to
nanoseconds */
return retval;
}
- t = time(NULL);
+ t = time (NULL);
assert (t != (time_t)-1);
retval.tv_sec = t;
retval.tv_nsec = 0;
@@ -941,9 +941,9 @@ now(void)
}
void
-set_option_defaults(struct options *p)
+set_option_defaults (struct options *p)
{
- if (getenv("POSIXLY_CORRECT"))
+ if (getenv ("POSIXLY_CORRECT"))
p->posixly_correct = true;
else
p->posixly_correct = false;
@@ -955,14 +955,14 @@ set_option_defaults(struct options *p)
* if we call it after setlocale().
*/
#ifdef O_NOFOLLOW
- p->open_nofollow_available = check_nofollow();
+ p->open_nofollow_available = check_nofollow ();
#else
p->open_nofollow_available = false;
#endif
p->regex_options = RE_SYNTAX_EMACS;
- if (isatty(0))
+ if (isatty (0))
{
p->warnings = true;
p->literal_control_chars = false;
@@ -981,7 +981,7 @@ set_option_defaults(struct options *p)
p->explicit_depth = false;
p->maxdepth = p->mindepth = -1;
- p->start_time = now();
+ p->start_time = now ();
p->cur_day_start.tv_sec = p->start_time.tv_sec - DAYSECS;
p->cur_day_start.tv_nsec = p->start_time.tv_nsec;
@@ -997,7 +997,7 @@ set_option_defaults(struct options *p)
p->debug_options = 0uL;
p->optimisation_level = 2;
- if (getenv("FIND_BLOCK_SIZE"))
+ if (getenv ("FIND_BLOCK_SIZE"))
{
error (1, 0, _("The environment variable FIND_BLOCK_SIZE is not
supported, the only thing that affects the block size is the POSIXLY_CORRECT
environment variable"));
}
@@ -1010,7 +1010,7 @@ set_option_defaults(struct options *p)
p->no_leaf_check = true;
#endif
- set_follow_state(SYMLINK_NEVER_DEREF); /* The default is equivalent to -P. */
+ set_follow_state (SYMLINK_NEVER_DEREF); /* The default is equivalent to -P.
*/
p->err_quoting_style = locale_quoting_style;
}
@@ -1020,7 +1020,7 @@ set_option_defaults(struct options *p)
*
* Returns the fd for the directory we started in.
*/
-int get_start_dirfd(void)
+int get_start_dirfd (void)
{
return starting_desc;
}
@@ -1072,7 +1072,7 @@ report_file_err(int exitval, int errno_value, const char
*name)
if (state.exit_status < 1)
state.exit_status = 1;
- error (exitval, errno_value, "%s", safely_quote_err_filename(0, name));
+ error (exitval, errno_value, "%s", safely_quote_err_filename (0, name));
}
/* fatal_file_error
@@ -1081,14 +1081,14 @@ report_file_err(int exitval, int errno_value, const
char *name)
void
fatal_file_error(const char *name)
{
- report_file_err(1, errno, name);
+ report_file_err (1, errno, name);
/*NOTREACHED*/
- abort();
+ abort ();
}
void
-nonfatal_file_error(const char *name)
+nonfatal_file_error (const char *name)
{
- report_file_err(0, errno, name);
+ report_file_err (0, errno, name);
}
--
1.5.6.5
- Coding style fixes, James Youngman, 2010/03/31
- [PATCH] Coding style fixes: space after function names.,
James Youngman <=