Print this page
3795 find does not support -path or -ipath

*** 19,28 **** --- 19,29 ---- * CDDL HEADER END */ /* * 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. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */
*** 81,94 **** 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 }; enum Type { Unary, Id, Num, Str, Exec, Cpio, Op --- 82,95 ---- 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, 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 { Unary, Id, Num, Str, Exec, Cpio, Op
*** 123,132 **** --- 124,134 ---- "-fstype", FSTYPE, Str, "-group", F_GROUP, Num, "-groupacl", F_GROUPACL, Num, "-iname", INAME, Str, "-inum", INUM, Num, + "-ipath", IPATH, Str, "-iregex", IREGEX, Str, "-links", LINKS, Num, "-local", LOCAL, Unary, "-ls", LS, Unary, "-maxdepth", MAXDEPTH, Num,
*** 141,150 **** --- 143,153 ---- "-not", NOT, Op, "-nouser", NOUSER, Unary, "-o", OR, Op, "-ok", OK, Exec, "-or", OR, Op, + "-path", PATH, Str, "-perm", PERM, Num, "-print", PRINT, Unary, "-print0", PRINT0, Unary, "-prune", PRUNE, Unary, "-regex", REGEX, Str,
*** 619,628 **** --- 622,633 ---- } break; case NAME: case INAME: + case PATH: + case IPATH: np->first.cp = b; break; case REGEX: case IREGEX: { int error;
*** 991,1010 **** case FOLLOW: val = 1; break; case NAME: ! case INAME: { ! char *name1; ! int fnmflags = (np->action == INAME) ? ! FNM_IGNORECASE : 0; /* * basename(3c) may modify name, so * we need to pass another string */ ! if ((name1 = strdup(name)) == NULL) { (void) fprintf(stderr, gettext("%s: cannot strdup() %s: %s\n"), cmdname, name, strerror(errno)); exit(2); } --- 996,1019 ---- case FOLLOW: val = 1; break; case NAME: ! 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 ((path = strdup(name)) == NULL) { (void) fprintf(stderr, gettext("%s: cannot strdup() %s: %s\n"), cmdname, name, strerror(errno)); exit(2); }
*** 1016,1027 **** * specified. */ #ifndef XPG4 fnmflags |= FNM_PERIOD; #endif ! val = !fnmatch(np->first.cp, basename(name1), fnmflags); ! free(name1); break; } case PRUNE: if (type == FTW_D) --- 1025,1039 ---- * specified. */ #ifndef XPG4 fnmflags |= FNM_PERIOD; #endif ! ! val = !fnmatch(np->first.cp, ! (np->action == NAME || np->action == INAME) ! ? basename(path) : path, fnmflags); ! free(path); break; } case PRUNE: if (type == FTW_D)