From: Rob Landley Date: Sun, 10 May 2015 05:21:42 +0000 (-0500) Subject: Cleanups of dirtree_start() calls. (Don't need to feed in flag values, just X-Git-Tag: upstream/0.6.0~69 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f5f436826505df6dfabe1de9724424fc40fae23;p=platform%2Fupstream%2Ftoybox.git Cleanups of dirtree_start() calls. (Don't need to feed in flag values, just symfollow true/false.) --- diff --git a/toys/posix/cp.c b/toys/posix/cp.c index df8269f..803bff8 100644 --- a/toys/posix/cp.c +++ b/toys/posix/cp.c @@ -340,9 +340,8 @@ void cp_main(void) // Skip nonexistent sources if (rc) { - int symfollow = DIRTREE_SYMFOLLOW*!!(toys.optflags & (FLAG_H|FLAG_L)); - - if (errno != EXDEV || !(new = dirtree_start(src, symfollow))) + if (errno!=EXDEV || + !(new = dirtree_start(src, toys.optflags&(FLAG_H|FLAG_L)))) perror_msg("bad '%s'", src); else dirtree_handle_callback(new, TT.callback); } diff --git a/toys/posix/du.c b/toys/posix/du.c index 0dea495..c72019e 100644 --- a/toys/posix/du.c +++ b/toys/posix/du.c @@ -128,7 +128,7 @@ static int do_du(struct dirtree *node) if (S_ISDIR(node->st.st_mode)) { if (!node->again) { TT.depth++; - return DIRTREE_COMEAGAIN | (DIRTREE_SYMFOLLOW*!!(toys.optflags & FLAG_L)); + return DIRTREE_COMEAGAIN|(DIRTREE_SYMFOLLOW*!!(toys.optflags&FLAG_L)); } else TT.depth--; } @@ -151,8 +151,8 @@ void du_main(void) // Loop over command line arguments, recursing through children for (args = toys.optc ? toys.optargs : noargs; *args; args++) - dirtree_handle_callback(dirtree_start(*args, - DIRTREE_SYMFOLLOW*!!(toys.optflags & (FLAG_H|FLAG_L))), do_du); + dirtree_handle_callback(dirtree_start(*args, toys.optflags&(FLAG_H|FLAG_L)), + do_du); if (toys.optflags & FLAG_c) print(TT.total*512, 0); if (CFG_TOYBOX_FREE) seen_inode(TT.inodes, 0); diff --git a/toys/posix/find.c b/toys/posix/find.c index 73502b4..01d2999 100644 --- a/toys/posix/find.c +++ b/toys/posix/find.c @@ -184,7 +184,7 @@ static int do_find(struct dirtree *new) struct double_list *argdata = TT.argdata; char *s, **ss; - recurse = DIRTREE_COMEAGAIN|((toys.optflags&FLAG_L) ? DIRTREE_SYMFOLLOW : 0); + recurse = DIRTREE_COMEAGAIN|(DIRTREE_SYMFOLLOW*!!(toys.optflags&FLAG_L)); // skip . and .. below topdir, handle -xdev and -depth if (new) { diff --git a/toys/posix/ls.c b/toys/posix/ls.c index 3e5d391..38db997 100644 --- a/toys/posix/ls.c +++ b/toys/posix/ls.c @@ -329,7 +329,7 @@ static void listfiles(int dirfd, struct dirtree *indir) } else { // Read directory contents. We dup() the fd because this will close it. indir->data = dup(dirfd); - dirtree_recurse(indir, filter, (flags&FLAG_L) ? DIRTREE_SYMFOLLOW : 0); + dirtree_recurse(indir, filter, DIRTREE_SYMFOLLOW*!!(flags&FLAG_L)); } // Copy linked list to array and sort it. Directories go in array because