Lines Matching +full:10 +full:base +full:- +full:t1
71 #define round(x, s) (((x)+(s)-1)&~((s)-1))
104 char name[10];
117 "-a", AND, Op,
118 "-acl", ACL, Unary,
119 "-amin", AMIN, Num,
120 "-and", AND, Op,
121 "-atime", ATIME, Num,
122 "-cmin", CMIN, Num,
123 "-cpio", CPIO, Cpio,
124 "-ctime", CTIME, Num,
125 "-depth", DEPTH, Unary,
126 "-delete", DELETE, Unary,
127 "-exec", EXEC, Exec,
128 "-follow", FOLLOW, Unary,
129 "-fstype", FSTYPE, Str,
130 "-group", F_GROUP, Num,
131 "-groupacl", GROUPACL, Num,
132 "-gsid", GSID, Num,
133 "-gsidacl", GSIDACL, Num,
134 "-iname", INAME, Str,
135 "-inum", INUM, Num,
136 "-ipath", IPATH, Str,
137 "-iregex", IREGEX, Str,
138 "-links", LINKS, Num,
139 "-local", LOCAL, Unary,
140 "-ls", LS, Unary,
141 "-maxdepth", MAXDEPTH, Num,
142 "-mindepth", MINDEPTH, Num,
143 "-mmin", MMIN, Num,
144 "-mount", MOUNT, Unary,
145 "-mtime", MTIME, Num,
146 "-name", NAME, Str,
147 "-ncpio", NCPIO, Cpio,
148 "-newer", NEWER, Str,
149 "-nogroup", NOGRP, Unary,
150 "-not", NOT, Op,
151 "-nouser", NOUSER, Unary,
152 "-o", OR, Op,
153 "-ok", OK, Exec,
154 "-or", OR, Op,
155 "-path", PATH, Str,
156 "-perm", PERM, Num,
157 "-print", PRINT, Unary,
158 "-print0", PRINT0, Unary,
159 "-prune", PRUNE, Unary,
160 "-regex", REGEX, Str,
161 "-sidacl", SIDACL, Num,
162 "-size", SIZE, Num,
163 "-type", TYPE, Num,
164 "-user", F_USER, Num,
165 "-useracl", USERACL, Num,
166 "-usid", USID, Num,
167 "-usidacl", USIDACL, Num,
168 "-xattr", XATTR, Unary,
169 "-xdev", MOUNT, Unary,
194 /* if no -print, -exec or -ok replace "expression" with "(expression) -print" */
239 static char *cpio[] = { "cpio", "-o", 0 };
240 static char *ncpio[] = { "cpio", "-oc", 0 };
241 static char *cpiol[] = { "cpio", "-oL", 0 };
242 static char *ncpiol[] = { "cpio", "-ocL", 0 };
245 static char *dummyarg = (char *)-1;
252 static int action_expression = 0; /* -print, -exec, or -ok */
258 /* set when doexec()-invoked utility returns non-zero */
262 static int mindepth = -1, maxdepth = -1;
274 #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ in main()
280 if (time(&now) == (time_t)(-1)) { in main()
285 while ((c = getopt(argc, argv, "EHL")) != -1) { in main()
304 argc -= optind; in main()
314 if (*cp == '-') in main()
320 if (paths == 0) /* no path-list */ in main()
325 /* lflag is the same as -follow */ in main()
334 /* no expression, default to -print */ in main()
344 (void) fprintf(stderr, gettext("%s: can't append -print" in main()
345 " implicitly; try explicit -print option\n"), in main()
352 topnode->next = freenode; in main()
353 topnode->first.np = savenode; in main()
354 (void) memcpy(topnode->next, &PRINT_NODE, sizeof (struct Node)); in main()
357 while (paths--) { in main()
364 * If -H is specified, it means we walk the first in main()
412 if (lastlist->end != lastlist->nextstr) { in main()
413 *lastlist->nextvar = 0; in main()
414 (void) doexec(NULL, lastlist->arglist, in main()
417 lastlist = lastlist->next; in main()
446 np->next = 0; in compile()
447 np->action = argp->action; in compile()
448 np->type = argp->type; in compile()
449 np->second.i = 0; in compile()
450 if (argp->type == Op) { in compile()
451 if (wasop == NOT || (wasop && np->action != NOT)) { in compile()
457 if (np->action != NOT && oldnp == 0) in compile()
459 wasop = argp->action; in compile()
462 if (argp->type != Unary) { in compile()
469 if (argp->type == Num) { in compile()
470 if (((argp->action == MAXDEPTH) || in compile()
471 (argp->action == MINDEPTH)) && in compile()
473 10) < 0)) in compile()
477 (argp->action == MAXDEPTH) ? in compile()
479 if ((argp->action != PERM) || in compile()
481 if (*b == '+' || *b == '-') { in compile()
482 np->second.i = *b; in compile()
489 switch (argp->action) { in compile()
495 np->first.np = topnode; in compile()
497 oldnp->next = 0; in compile()
505 np->first.np = topnode; in compile()
510 oldnp->next = np; in compile()
521 paren_cnt--; in compile()
524 if (oldnp->type == Op) { in compile()
531 oldnp->next = 0; in compile()
532 return (av-argv); in compile()
550 np->first.l = 0L; in compile()
551 np->first.ll = 0LL; in compile()
552 np->second.i = '+'; in compile()
554 * Make it compatible to df -l for in compile()
563 if (b[strlen(b)-1] == 'c') in compile()
564 np->action = CSIZE; in compile()
567 np->first.ll = atoll(b); in compile()
577 np->first.l = atol(b); in compile()
589 value = -1; in compile()
590 if (argp->action == F_USER || in compile()
591 argp->action == USERACL) { in compile()
593 value = (long)pw->pw_uid; in compile()
596 value = (long)gr->gr_gid; in compile()
598 if (value == -1) { in compile()
600 value = strtol(b, &q, 10); in compile()
608 np->first.l = value; in compile()
617 boolean_t need_user = ((argp->action == USID) || in compile()
618 (argp->action == USIDACL)); in compile()
619 value = -1; in compile()
626 np->first.l = value; in compile()
628 switch (argp->action) { in compile()
630 np->action = F_USER; in compile()
634 np->action = F_GROUP; in compile()
638 np->action = USERACL; in compile()
642 np->action = GROUPACL; in compile()
649 uid_t siduid = -1; in compile()
650 uid_t sidgid = -1; in compile()
661 np->action = GROUPACL; in compile()
662 np->first.l = sidgid; in compile()
664 np->action = USERACL; in compile()
665 np->first.l = siduid; in compile()
667 np->first.l = siduid; in compile()
668 np->second.l = sidgid; in compile()
676 np->first.ap = av; in compile()
691 av[-1] == dummyarg && np->action == EXEC) { in compile()
692 av[-1] = 0; in compile()
693 np->first.vp = varargs(np->first.ap); in compile()
694 np->action = VARARGS; in compile()
705 np->first.cp = b; in compile()
717 ((np->action == IREGEX) ? REG_ICASE : 0) | in compile()
730 if (*b == '-') in compile()
735 "find: -perm: Bad permission string\n")); in compile()
738 np->first.l = (long)getmode((mode_t)0); in compile()
742 np->first.l = in compile()
785 np->first.l = (long)cmdopen("cpio", com, "w", fd); in compile()
788 np->action = CPIO; in compile()
804 np->first.l = statb.st_mtime; in compile()
805 np->second.i = '+'; in compile()
814 np->first.cp = b; in compile()
824 maxdepth = (int)strtol(b, NULL, 10); in compile()
827 mindepth = (int)strtol(b, NULL, 10); in compile()
832 oldnp->next = np; in compile()
844 freenode = oldnp->next; in compile()
845 oldnp->next = 0; in compile()
846 return (av-argv); in compile()
865 gettext("%s: [-E] [-H | -L] path-list predicate-list\n"), cmdname); in usage()
875 int i, t1, t2; in aclmatch() local
881 if (np->action == USERACL) { in aclmatch()
882 t1 = USER; in aclmatch()
885 t1 = GROUP; in aclmatch()
893 if (np->action == SIDACL && acl->acl_type == ACLENT_T) in aclmatch()
896 for (i = 0, acl_entry = acl->acl_aclp; in aclmatch()
897 i != acl->acl_cnt; i++) { in aclmatch()
898 id_t who = np->first.l; in aclmatch()
900 if (acl->acl_type == ACLENT_T) { in aclmatch()
902 if (np->action != SIDACL && in aclmatch()
903 p1->a_id == who && p1->a_type == t1) { in aclmatch()
910 if (np->action == SIDACL) { in aclmatch()
911 if (p2->a_flags & ACE_IDENTIFIER_GROUP) { in aclmatch()
912 who = np->second.l; in aclmatch()
918 if (p2->a_who == who && in aclmatch()
919 ((p2->a_flags & ACE_TYPE_FLAGS) == t2)) { in aclmatch()
924 acl_entry = ((char *)acl_entry + acl->acl_entry_size); in aclmatch()
967 if ((maxdepth != -1 && state->level > maxdepth) || in execute()
968 (mindepth != -1 && state->level < mindepth)) in execute()
972 switch (np->action) { in execute()
975 np = np->next; in execute()
979 np = np->next; in execute()
983 if (np->first.np == np) { in execute()
988 gettext("%s: invalid -o construction\n"), in execute()
995 topnode = np->first.np; in execute()
999 if (np->action == OR) { in execute()
1016 statb->st_fstype) == 0) { in execute()
1025 l = (long)statb->st_mode&S_IFMT; in execute()
1029 l = (long)statb->st_mode&07777; in execute()
1030 if (np->second.i == '-') in execute()
1031 val = ((l&np->first.l) == np->first.l); in execute()
1033 val = (l == np->first.l); in execute()
1037 ll = (long long)statb->st_ino; in execute()
1040 l = statb->st_mtime; in execute()
1043 t = statb->st_atime; in execute()
1046 t = statb->st_ctime; in execute()
1049 t = statb->st_mtime; in execute()
1051 l = (now-t)/A_DAY; in execute()
1054 t = statb->st_mtime; in execute()
1057 t = statb->st_atime; in execute()
1060 t = statb->st_ctime; in execute()
1063 l = (now-t)/A_MIN; in execute()
1066 ll = (long long)statb->st_size; in execute()
1069 ll = (long long)round(statb->st_size, BLKSIZ)/BLKSIZ; in execute()
1072 l = (long)statb->st_uid; in execute()
1075 l = (long)statb->st_gid; in execute()
1078 l = (long)statb->st_nlink; in execute()
1081 if (np->second.i == '+') in execute()
1082 val = (ll > np->first.ll); in execute()
1083 else if (np->second.i == '-') in execute()
1084 val = (ll < np->first.ll); in execute()
1086 val = (ll == np->first.ll); in execute()
1089 if (np->second.i == '+') in execute()
1090 val = (l > np->first.l); in execute()
1091 else if (np->second.i == '-') in execute()
1092 val = (l < np->first.l); in execute()
1094 val = (l == np->first.l); in execute()
1097 val = ok(name, np->first.ap); in execute()
1100 val = doexec(name, np->first.ap, NULL); in execute()
1107 struct Arglist *ap = np->first.vp; in execute()
1109 cp = ap->nextstr - (strlen(name)+1); in execute()
1110 if (cp >= (char *)(ap->nextvar+3)) { in execute()
1114 *ap->nextvar++ = cp; in execute()
1115 ap->nextstr = cp; in execute()
1118 *ap->nextvar++ = (char *)name; in execute()
1119 *ap->nextvar = 0; in execute()
1121 (void) doexec(NULL, ap->arglist, in execute()
1123 ap->nextstr = ap->end; in execute()
1124 ap->nextvar = ap->firstvar; in execute()
1142 if (np->action == INAME || np->action == IPATH) in execute()
1165 if (np->action == NAME || np->action == INAME) in execute()
1169 val = !fnmatch(np->first.cp, in execute()
1170 (np->action == NAME || np->action == INAME) ? in execute()
1178 state->quit = FTW_PRUNE; in execute()
1182 val = ((getpwuid(statb->st_uid)) == 0); in execute()
1185 val = ((getgrgid(statb->st_gid)) == 0); in execute()
1188 val = (strcmp(np->first.cp, statb->st_fstype) == 0); in execute()
1191 output = (FILE *)np->first.l; in execute()
1198 (np->action == PRINT) ? '\n' : '\0'); in execute()
1240 if (state->level == maxdepth && type == FTW_D) in execute()
1241 state->quit = FTW_PRUNE; in execute()
1248 * evaluate 'val' and 'not' (exclusive-or) in execute()
1261 np = np->next; in execute()
1267 * code for the -ok option
1277 (void) fflush(stdout); /* to flush possible `-print' */ in ok()
1303 * Per XPG6, find must exit non-zero if an invocation through
1304 * -exec, punctuated by a plus sign, exits non-zero, so set
1305 * exitcode if we see a non-zero exit.
1306 * exitcode should be NULL when -exec or -ok is not punctuated
1321 (void) fflush(stdout); /* to flush possible `-print' */ in doexec()
1326 av[-1] = (char *)name; in doexec()
1334 if ((pid = fork()) == -1) { in doexec()
1344 if ((rc = wait(&r)) == -1 && errno != EINTR) { in doexec()
1386 if ((pid1 = fork()) == -1) { in doexec()
1400 if ((rc = wait(&status)) == -1 && in doexec()
1419 av[-1] = dummyarg; in doexec()
1438 gettext("-delete is not allowed when symlinks are " in dodelete()
1443 fn = name + state->base; in dodelete()
1451 gettext("-delete with relative path is unsafe.")); in dodelete()
1455 if (S_ISDIR(statb->st_mode)) { in dodelete()
1484 while (*argp->name) { in lookup()
1485 if (second == argp->name[1] && strcmp(word, argp->name) == 0) in lookup()
1507 varsize = sizeof (struct Arglist)+ARG_MAX-PATH_MAX-n-1; in varargs()
1510 ap->end = (char *)ap + varsize; in varargs()
1511 ap->nextstr = ap->end; in varargs()
1512 ap->nextvar = ap->arglist; in varargs()
1513 while (*ap->nextvar++ = *com++) in varargs()
1515 ap->nextvar--; in varargs()
1516 ap->firstvar = ap->nextvar; in varargs()
1517 ap->next = lastlist; in varargs()
1530 #define CMDERR ((1<<8)-1) /* command error exit code */
1570 case -1: in cmdopen()
1596 if (v = malloc((p - argv + 1) * sizeof (char **))) { in cmdopen()
1616 * -1 returned if cmdopen() had a problem
1630 return (-1); in cmdclose()
1634 while ((p = wait(&status)) != pid && p != (pid_t)-1) in cmdclose()
1639 status = -1; in cmdclose()
1642 status = -1; in cmdclose()
1651 * if set-uid or set-gid then the executable and its containing
1683 * the following functions implement the added "-ls" option
1711 #if (((NUID) & ((NUID) - 1)) != 0) in getname()
1714 cp = uid & ((NUID) - 1); in getname()
1722 SCPYN(nc[cp].name, pw->pw_name); in getname()
1736 #if (((NGID) & ((NGID) - 1)) != 0) in getgroup()
1739 cp = gid & ((NGID) - 1); in getgroup()
1747 SCPYN(gc[cp].name, gr->gr_name); in getgroup()
1771 static time_t sixmonthsago = -1; in list()
1782 return (-1); in list()
1785 if (sixmonthsago == -1) in list()
1786 sixmonthsago = now - 6L*30L*24L*60L*60L; in list()
1788 switch (stp->st_mode & S_IFMT) { in list()
1826 pmode[0] = '-'; in list()
1835 int is_exec = stp->st_mode & permission(who, S_IEXEC)? 1 : 0; in list()
1837 if (stp->st_mode & permission(who, S_IREAD)) in list()
1840 pmode[permoffset(who) + 1] = '-'; in list()
1842 if (stp->st_mode & permission(who, S_IWRITE)) in list()
1845 pmode[permoffset(who) + 2] = '-'; in list()
1847 if (stp->st_mode & special[who * 3]) in list()
1853 pmode[permoffset(who) + 3] = '-'; in list()
1864 if (trivial == -1) in list()
1878 cp = getname(stp->st_uid); in list()
1880 (void) sprintf(uname, "%-8s ", cp); in list()
1882 (void) sprintf(uname, "%-8u ", stp->st_uid); in list()
1884 cp = getgroup(stp->st_gid); in list()
1886 (void) sprintf(gname, "%-8s ", cp); in list()
1888 (void) sprintf(gname, "%-8u ", stp->st_gid); in list()
1892 major(stp->st_rdev), minor(stp->st_rdev)); in list()
1894 (void) sprintf(fsize, (stp->st_size < 100000000) ? in list()
1895 "%8lld" : "%lld", stp->st_size); in list()
1898 who = readlink(tailname, flink, sizeof (flink) - 1); in list()
1908 cp = ctime(&stp->st_mtime); in list()
1909 if (stp->st_mtime < sixmonthsago || stp->st_mtime > now) in list()
1910 (void) sprintf(ftime, "%-7.7s %-4.4s", cp + 4, cp + 20); in list()
1912 (void) sprintf(ftime, "%-12.12s", cp + 4); in list()
1914 (void) printf((stp->st_ino < 100000) ? "%5llu " : in list()
1915 "%llu ", stp->st_ino); /* inode # */ in list()
1917 ksize = (long long) kbytes(ldbtob(stp->st_blocks)); /* kbytes */ in list()
1919 ksize = (long long) kbytes(stp->st_size); /* kbytes */ in list()
1925 stp->st_nlink, /* # of links */ in list()
1931 (pmode[0] == 'l') ? " -> " : "", in list()
1936 stp->st_nlink, /* # of links */ in list()
1981 /* LINTED - unbounded string specifier */ in init_remote_fs()
1995 * field contains what permissions need to be checked at run-time in
2002 uchar_t p_op; /* Operation: + - = */
2028 * is NULL if everything is OK, otherwise it is -1.
2045 mode = (mode<<3) + *amode++ - '0'; in readmode()
2047 return (-1); in readmode()
2072 pp->p_who = P_A; in readmode()
2073 pp->p_perm = mode; in readmode()
2074 pp->p_op = '='; in readmode()
2097 if (!isop(pp->p_op = *amode++)) in readmode()
2098 return (-1); in readmode()
2099 pp->p_perm = 0; in readmode()
2100 pp->p_special = 0; in readmode()
2102 if (pp->p_special == 'X') { in readmode()
2105 if (pp->p_perm != 0) { in readmode()
2112 pp->p_who = who; in readmode()
2113 pp->p_special = 0; in readmode()
2115 op = pp->p_op; in readmode()
2119 pp->p_special = 'X'; in readmode()
2120 pp->p_op = op; in readmode()
2126 pp->p_who = who; in readmode()
2128 op = pp->p_op; in readmode()
2132 pp->p_perm = 0; in readmode()
2133 pp->p_special = 0; in readmode()
2134 pp->p_op = op; in readmode()
2137 pp->p_perm |= t; in readmode()
2144 switch (pp->p_special) { in readmode()
2151 pp->p_who = who; in readmode()
2198 * Return non-zero if this is a valid op code
2206 case '-': in isop()
2218 * if it isn't valid. Also returns 0 when the pseudo-permissions 'u', 'g', or
2219 * 'o' are used, and sets pp->p_special to the one used.
2228 pp->p_special = c; in isperm()
2246 pp->p_special = 'X'; in isperm()
2280 * the file-type bits as well, so that S_ISDIR will succeed on directories.
2298 * lines 2568-2570, 2578-2583 in getmode()
2300 switch (pp->p_special) { in getmode()
2305 pp->p_who); in getmode()
2307 perm |= ((S_IWUSR|S_IWGRP|S_IWOTH) & pp->p_who); in getmode()
2309 perm |= ((S_IXUSR|S_IXGRP|S_IXOTH) & pp->p_who); in getmode()
2315 perm |= ((S_IRUSR|S_IRGRP|S_IROTH) & pp->p_who); in getmode()
2317 perm |= ((S_IWUSR|S_IWGRP|S_IWOTH) & pp->p_who); in getmode()
2319 perm |= ((S_IXUSR|S_IXGRP|S_IXOTH) & pp->p_who); in getmode()
2325 perm |= ((S_IRUSR|S_IRGRP|S_IROTH) & pp->p_who); in getmode()
2327 perm |= ((S_IWUSR|S_IWGRP|S_IWOTH) & pp->p_who); in getmode()
2329 perm |= ((S_IXUSR|S_IXGRP|S_IXOTH) & pp->p_who); in getmode()
2333 perm = pp->p_perm; in getmode()
2337 perm = pp->p_perm; in getmode()
2340 switch (pp->p_op) { in getmode()
2341 case '-': in getmode()
2342 startmode &= ~(perm & pp->p_who); in getmode()
2346 startmode &= ~pp->p_who; in getmode()
2349 startmode |= (perm & pp->p_who); in getmode()
2363 const char *base = fname; in gettail() local
2366 if ((base = strrchr(fname, '/')) != NULL) in gettail()
2367 base++; in gettail()
2369 base = fname; in gettail()
2371 return (base); in gettail()