aboutsummaryrefslogtreecommitdiff
path: root/findutils/find.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-02-02 01:17:52 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-02-02 01:17:52 +0000
commita100707c04a41510bfe3460bf15a88c339ce4f30 (patch)
tree576d48e7a524624804c06891b37649965881b798 /findutils/find.c
parent731d3572959774b36bab415bd1ae8bcd1958639b (diff)
downloadbusybox-w32-a100707c04a41510bfe3460bf15a88c339ce4f30.tar.gz
busybox-w32-a100707c04a41510bfe3460bf15a88c339ce4f30.tar.bz2
busybox-w32-a100707c04a41510bfe3460bf15a88c339ce4f30.zip
find -user support by Natanael Copa <natanael.copa@gmail.com>
Diffstat (limited to 'findutils/find.c')
-rw-r--r--findutils/find.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/findutils/find.c b/findutils/find.c
index 0c22ee6d1..2decb3608 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -68,6 +68,7 @@ USE_FEATURE_FIND_MMIN( ACTS(mmin, char mmin_char; unsigned mmin_mins;))
68USE_FEATURE_FIND_NEWER( ACTS(newer, time_t newer_mtime;)) 68USE_FEATURE_FIND_NEWER( ACTS(newer, time_t newer_mtime;))
69USE_FEATURE_FIND_INUM( ACTS(inum, ino_t inode_num;)) 69USE_FEATURE_FIND_INUM( ACTS(inum, ino_t inode_num;))
70USE_FEATURE_FIND_EXEC( ACTS(exec, char **exec_argv; int *subst_count; int exec_argc;)) 70USE_FEATURE_FIND_EXEC( ACTS(exec, char **exec_argv; int *subst_count; int exec_argc;))
71USE_FEATURE_FIND_USER( ACTS(user, int uid;))
71USE_DESKTOP( ACTS(paren, action ***subexpr;)) 72USE_DESKTOP( ACTS(paren, action ***subexpr;))
72USE_DESKTOP( ACTS(size, off_t size;)) 73USE_DESKTOP( ACTS(size, off_t size;))
73USE_DESKTOP( ACTS(prune)) 74USE_DESKTOP( ACTS(prune))
@@ -212,6 +213,13 @@ ACTF(exec)
212} 213}
213#endif 214#endif
214 215
216#if ENABLE_FEATURE_FIND_USER
217ACTF(user)
218{
219 return (statbuf->st_uid == ap->uid);
220}
221#endif
222
215#if ENABLE_FEATURE_FIND_PRINT0 223#if ENABLE_FEATURE_FIND_PRINT0
216ACTF(print0) 224ACTF(print0)
217{ 225{
@@ -478,6 +486,17 @@ static action*** parse_params(char **argv)
478 ap->subst_count[i] = count_subst(ap->exec_argv[i]); 486 ap->subst_count[i] = count_subst(ap->exec_argv[i]);
479 } 487 }
480#endif 488#endif
489#ifdef ENABLE_FEATURE_FIND_USER
490 else if (strcmp(arg, "-user") == 0) {
491 action_user *ap;
492 if (!*++argv)
493 bb_error_msg_and_die(bb_msg_requires_arg, arg);
494 ap = ALLOC_ACTION(user);
495 ap->uid = bb_strtou(arg1, NULL, 10);
496 if (errno)
497 ap->uid = xuname2uid(arg1);
498 }
499#endif
481#if ENABLE_DESKTOP 500#if ENABLE_DESKTOP
482 else if (LONE_CHAR(arg, '(')) { 501 else if (LONE_CHAR(arg, '(')) {
483 action_paren *ap; 502 action_paren *ap;