diff options
| author | Andy Stormont <andyjstormont@gmail.com> | 2013-06-05 11:48:52 -0400 |
|---|---|---|
| committer | Dan McDonald <danmcd@nexenta.com> | 2013-06-05 11:48:52 -0400 |
| commit | 05f32410ae979b9796bef0f9ca68747c59821a3f (patch) | |
| tree | ddc9f5a3916da994682f2f78f4cf2f39e3517062 /usr/src/cmd/find | |
| parent | 9f4ed2b28e85fcda47378b4a8a399fcbf6bd9825 (diff) | |
| download | illumos-joyent-05f32410ae979b9796bef0f9ca68747c59821a3f.tar.gz | |
3795 find does not support -path or -ipath
Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
Reviewed by: Albert Lee <trisk@nexenta.com>
Approved by: Dan McDonald <danmcd@nexenta.com>
Diffstat (limited to 'usr/src/cmd/find')
| -rw-r--r-- | usr/src/cmd/find/find.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/usr/src/cmd/find/find.c b/usr/src/cmd/find/find.c index a8754e83e5..c6fc469e15 100644 --- a/usr/src/cmd/find/find.c +++ b/usr/src/cmd/find/find.c @@ -21,6 +21,7 @@ /* * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2012 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2013 Andrew Stormont. All rights reserved. */ @@ -83,10 +84,10 @@ enum Command { PRINT, ACL, AMIN, AND, ATIME, CMIN, CPIO, CSIZE, CTIME, DEPTH, EXEC, F_GROUP, - F_GROUPACL, F_USER, F_USERACL, FOLLOW, FSTYPE, INAME, INUM, IREGEX, - LINKS, LOCAL, LPAREN, LS, MAXDEPTH, MINDEPTH, MMIN, MOUNT, MTIME, NAME, - NCPIO, NEWER, NOGRP, NOT, NOUSER, OK, OR, PERM, PRINT0, PRUNE, REGEX, - RPAREN, SIZE, TYPE, VARARGS, XATTR + F_GROUPACL, F_USER, F_USERACL, FOLLOW, FSTYPE, INAME, INUM, IPATH, + IREGEX, LINKS, LOCAL, LPAREN, LS, MAXDEPTH, MINDEPTH, MMIN, MOUNT, + MTIME, NAME, NCPIO, NEWER, NOGRP, NOT, NOUSER, OK, OR, PATH, PERM, + PRINT0, PRUNE, REGEX, RPAREN, SIZE, TYPE, VARARGS, XATTR }; enum Type @@ -125,6 +126,7 @@ static struct Args commands[] = "-groupacl", F_GROUPACL, Num, "-iname", INAME, Str, "-inum", INUM, Num, + "-ipath", IPATH, Str, "-iregex", IREGEX, Str, "-links", LINKS, Num, "-local", LOCAL, Unary, @@ -143,6 +145,7 @@ static struct Args commands[] = "-o", OR, Op, "-ok", OK, Exec, "-or", OR, Op, + "-path", PATH, Str, "-perm", PERM, Num, "-print", PRINT, Unary, "-print0", PRINT0, Unary, @@ -621,6 +624,8 @@ int *actionp; case NAME: case INAME: + case PATH: + case IPATH: np->first.cp = b; break; case REGEX: @@ -993,16 +998,20 @@ struct FTW *state; break; case NAME: - case INAME: { - char *name1; - int fnmflags = (np->action == INAME) ? - FNM_IGNORECASE : 0; + case INAME: + case PATH: + case IPATH: { + char *path; + int fnmflags = 0; + + if (np->action == INAME || np->action == IPATH) + fnmflags = FNM_IGNORECASE; /* * basename(3c) may modify name, so * we need to pass another string */ - if ((name1 = strdup(name)) == NULL) { + if ((path = strdup(name)) == NULL) { (void) fprintf(stderr, gettext("%s: cannot strdup() %s: %s\n"), cmdname, name, strerror(errno)); @@ -1018,8 +1027,11 @@ struct FTW *state; #ifndef XPG4 fnmflags |= FNM_PERIOD; #endif - val = !fnmatch(np->first.cp, basename(name1), fnmflags); - free(name1); + + val = !fnmatch(np->first.cp, + (np->action == NAME || np->action == INAME) + ? basename(path) : path, fnmflags); + free(path); break; } |
