2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
5 * This code is derived from software contributed to Berkeley by
6 * Cimarron D. Taylor of the University of California, Berkeley.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 static char sccsid[] = "@(#)function.c 8.10 (Berkeley) 5/4/95";
39 static char rcsid[] = "$FreeBSD$";
42 #include <sys/param.h>
43 #include <sys/ucred.h>
46 #include <sys/mount.h>
61 int string_to_flags __P((char **, u_long *, u_long *));
63 #define COMPARE(a, b) { \
64 switch (plan->flags) { \
76 static PLAN *palloc __P((enum ntype, int (*) __P((PLAN *, FTSENT *))));
80 * Parse a string of the form [+-]# and return the value.
83 find_parsenum(plan, option, vp, endch)
85 char *option, *vp, *endch;
88 char *endchar, *str; /* Pointer to character ending conversion. */
90 /* Determine comparison from leading + or -. */
95 plan->flags = F_GREATER;
99 plan->flags = F_LESSTHAN;
102 plan->flags = F_EQUAL;
107 * Convert the string with strtoq(). Note, if strtoq() returns zero
108 * and endchar points to the beginning of the string we know we have
111 value = strtoq(str, &endchar, 10);
112 if (value == 0 && endchar == str)
113 errx(1, "%s: %s: illegal numeric value", option, vp);
114 if (endchar[0] && (endch == NULL || endchar[0] != *endch))
115 errx(1, "%s: %s: illegal trailing character", option, vp);
122 * The value of n for the inode times (atime, ctime, and mtime) is a range,
123 * i.e. n matches from (n - 1) to n 24 hour periods. This interacts with
124 * -n, such that "-mtime -1" would be less than 0 days, which isn't what the
125 * user wanted. Correct so that -1 is "less than 1".
127 #define TIME_CORRECT(p, ttype) \
128 if ((p)->type == ttype && (p)->flags == F_LESSTHAN) \
132 * -amin n functions --
134 * True if the difference between the file access time and the
135 * current time is n min periods.
144 COMPARE((now - entry->fts_statp->st_atime +
145 60 - 1) / 60, plan->t_data);
154 ftsoptions &= ~FTS_NOSTAT;
156 new = palloc(N_AMIN, f_amin);
157 new->t_data = find_parsenum(new, "-amin", arg, NULL);
158 TIME_CORRECT(new, N_AMIN);
164 * -atime n functions --
166 * True if the difference between the file access time and the
167 * current time is n 24 hour periods.
176 COMPARE((now - entry->fts_statp->st_atime +
177 86400 - 1) / 86400, plan->t_data);
186 ftsoptions &= ~FTS_NOSTAT;
188 new = palloc(N_ATIME, f_atime);
189 new->t_data = find_parsenum(new, "-atime", arg, NULL);
190 TIME_CORRECT(new, N_ATIME);
196 * -cmin n functions --
198 * True if the difference between the last change of file
199 * status information and the current time is n min periods.
208 COMPARE((now - entry->fts_statp->st_ctime +
209 60 - 1) / 60, plan->t_data);
218 ftsoptions &= ~FTS_NOSTAT;
220 new = palloc(N_CMIN, f_cmin);
221 new->t_data = find_parsenum(new, "-cmin", arg, NULL);
222 TIME_CORRECT(new, N_CMIN);
227 * -ctime n functions --
229 * True if the difference between the last change of file
230 * status information and the current time is n 24 hour periods.
239 COMPARE((now - entry->fts_statp->st_ctime +
240 86400 - 1) / 86400, plan->t_data);
249 ftsoptions &= ~FTS_NOSTAT;
251 new = palloc(N_CTIME, f_ctime);
252 new->t_data = find_parsenum(new, "-ctime", arg, NULL);
253 TIME_CORRECT(new, N_CTIME);
259 * -depth functions --
261 * Always true, causes descent of the directory hierarchy to be done
262 * so that all entries in a directory are acted on before the directory
266 f_always_true(plan, entry)
278 return (palloc(N_DEPTH, f_always_true));
282 * [-exec | -ok] utility [arg ... ] ; functions --
284 * True if the executed utility returns a zero value as exit status.
285 * The end of the primary expression is delimited by a semicolon. If
286 * "{}" occurs anywhere, it gets replaced by the current pathname.
287 * The current directory for the execution of utility is the same as
288 * the current directory when the find utility was started.
290 * The primary -ok is different in that it requests affirmation of the
291 * user before executing the utility.
303 for (cnt = 0; plan->e_argv[cnt]; ++cnt)
304 if (plan->e_len[cnt])
305 brace_subst(plan->e_orig[cnt], &plan->e_argv[cnt],
306 entry->fts_path, plan->e_len[cnt]);
308 if (plan->flags == F_NEEDOK && !queryuser(plan->e_argv))
311 /* make sure find output is interspersed correctly with subprocesses */
314 switch (pid = fork()) {
323 execvp(plan->e_argv[0], plan->e_argv);
324 warn("%s", plan->e_argv[0]);
327 pid = waitpid(pid, &status, 0);
328 return (pid != -1 && WIFEXITED(status) && !WEXITSTATUS(status));
333 * build three parallel arrays, one with pointers to the strings passed
334 * on the command line, one with (possibly duplicated) pointers to the
335 * argv array, and one with integer values that are lengths of the
336 * strings, but also flags meaning that the string has to be massaged.
343 PLAN *new; /* node returned */
345 register char **argv, **ap, *p;
349 new = palloc(N_EXEC, f_exec);
351 new->flags = F_NEEDOK;
353 for (ap = argv = *argvp;; ++ap) {
356 "%s: no terminating \";\"", isok ? "-ok" : "-exec");
361 cnt = ap - *argvp + 1;
362 new->e_argv = (char **)emalloc((u_int)cnt * sizeof(char *));
363 new->e_orig = (char **)emalloc((u_int)cnt * sizeof(char *));
364 new->e_len = (int *)emalloc((u_int)cnt * sizeof(int));
366 for (argv = *argvp, cnt = 0; argv < ap; ++argv, ++cnt) {
367 new->e_orig[cnt] = *argv;
368 for (p = *argv; *p; ++p)
369 if (p[0] == '{' && p[1] == '}') {
370 new->e_argv[cnt] = emalloc((u_int)MAXPATHLEN);
371 new->e_len[cnt] = MAXPATHLEN;
375 new->e_argv[cnt] = *argv;
379 new->e_argv[cnt] = new->e_orig[cnt] = NULL;
386 * -execdir utility [arg ... ] ; functions --
388 * True if the executed utility returns a zero value as exit status.
389 * The end of the primary expression is delimited by a semicolon. If
390 * "{}" occurs anywhere, it gets replaced by the unqualified pathname.
391 * The current directory for the execution of utility is the same as
392 * the directory where the file lives.
395 f_execdir(plan, entry)
404 /* XXX - if file/dir ends in '/' this will not work -- can it? */
405 if ((file = strrchr(entry->fts_path, '/')))
408 file = entry->fts_path;
410 for (cnt = 0; plan->e_argv[cnt]; ++cnt)
411 if (plan->e_len[cnt])
412 brace_subst(plan->e_orig[cnt], &plan->e_argv[cnt],
413 file, plan->e_len[cnt]);
415 /* don't mix output of command with find output */
419 switch (pid = fork()) {
424 execvp(plan->e_argv[0], plan->e_argv);
425 warn("%s", plan->e_argv[0]);
428 pid = waitpid(pid, &status, 0);
429 return (pid != -1 && WIFEXITED(status) && !WEXITSTATUS(status));
434 * build three parallel arrays, one with pointers to the strings passed
435 * on the command line, one with (possibly duplicated) pointers to the
436 * argv array, and one with integer values that are lengths of the
437 * strings, but also flags meaning that the string has to be massaged.
443 PLAN *new; /* node returned */
445 register char **argv, **ap, *p;
447 ftsoptions &= ~FTS_NOSTAT;
450 new = palloc(N_EXECDIR, f_execdir);
452 for (ap = argv = *argvp;; ++ap) {
455 "-execdir: no terminating \";\"");
460 cnt = ap - *argvp + 1;
461 new->e_argv = (char **)emalloc((u_int)cnt * sizeof(char *));
462 new->e_orig = (char **)emalloc((u_int)cnt * sizeof(char *));
463 new->e_len = (int *)emalloc((u_int)cnt * sizeof(int));
465 for (argv = *argvp, cnt = 0; argv < ap; ++argv, ++cnt) {
466 new->e_orig[cnt] = *argv;
467 for (p = *argv; *p; ++p)
468 if (p[0] == '{' && p[1] == '}') {
469 new->e_argv[cnt] = emalloc((u_int)MAXPATHLEN);
470 new->e_len[cnt] = MAXPATHLEN;
474 new->e_argv[cnt] = *argv;
478 new->e_argv[cnt] = new->e_orig[cnt] = NULL;
485 * -follow functions --
487 * Always true, causes symbolic links to be followed on a global
493 ftsoptions &= ~FTS_PHYSICAL;
494 ftsoptions |= FTS_LOGICAL;
496 return (palloc(N_FOLLOW, f_always_true));
500 * -fstype functions --
502 * True if the file is of a certain type.
505 f_fstype(plan, entry)
509 static dev_t curdev; /* need a guaranteed illegal dev value */
510 static int first = 1;
512 static int val_type, val_flags;
515 /* Only check when we cross mount point. */
516 if (first || curdev != entry->fts_statp->st_dev) {
517 curdev = entry->fts_statp->st_dev;
520 * Statfs follows symlinks; find wants the link's file system,
521 * not where it points.
523 if (entry->fts_info == FTS_SL ||
524 entry->fts_info == FTS_SLNONE) {
525 if ((p = strrchr(entry->fts_accpath, '/')) != NULL)
528 p = entry->fts_accpath;
537 if (statfs(entry->fts_accpath, &sb))
538 err(1, "%s", entry->fts_accpath);
548 * Further tests may need both of these values, so
549 * always copy both of them.
551 val_flags = sb.f_flags;
552 val_type = sb.f_type;
554 switch (plan->flags) {
556 return (val_flags & plan->mt_data) != 0;
558 return (val_type == plan->mt_data);
564 #if !defined(__NetBSD__)
572 ftsoptions &= ~FTS_NOSTAT;
574 new = palloc(N_FSTYPE, f_fstype);
577 * Check first for a filesystem name.
579 if (getvfsbyname(arg, &vfc) == 0) {
580 new->flags = F_MTTYPE;
581 new->mt_data = vfc.vfc_typenum;
587 if (!strcmp(arg, "local")) {
588 new->flags = F_MTFLAG;
589 new->mt_data = MNT_LOCAL;
594 if (!strcmp(arg, "rdonly")) {
595 new->flags = F_MTFLAG;
596 new->mt_data = MNT_RDONLY;
601 errx(1, "%s: unknown file type", arg);
607 * -group gname functions --
609 * True if the file belongs to the group gname. If gname is numeric and
610 * an equivalent of the getgrnam() function does not return a valid group
611 * name, gname is taken as a group ID.
618 return (entry->fts_statp->st_gid == plan->g_data);
629 ftsoptions &= ~FTS_NOSTAT;
634 if (gid == 0 && gname[0] != '0')
635 errx(1, "-group: %s: no such group", gname);
639 new = palloc(N_GROUP, f_group);
645 * -inum n functions --
647 * True if the file has inode # n.
654 COMPARE(entry->fts_statp->st_ino, plan->i_data);
663 ftsoptions &= ~FTS_NOSTAT;
665 new = palloc(N_INUM, f_inum);
666 new->i_data = find_parsenum(new, "-inum", arg, NULL);
671 * -links n functions --
673 * True if the file has n links.
680 COMPARE(entry->fts_statp->st_nlink, plan->l_data);
689 ftsoptions &= ~FTS_NOSTAT;
691 new = palloc(N_LINKS, f_links);
692 new->l_data = (nlink_t)find_parsenum(new, "-links", arg, NULL);
699 * Always true - prints the current entry to stdout in "ls" format.
706 printlong(entry->fts_path, entry->fts_accpath, entry->fts_statp);
713 ftsoptions &= ~FTS_NOSTAT;
716 return (palloc(N_LS, f_ls));
720 * -mtime n functions --
722 * True if the difference between the file modification time and the
723 * current time is n 24 hour periods.
732 COMPARE((now - entry->fts_statp->st_mtime + 86400 - 1) /
733 86400, plan->t_data);
742 ftsoptions &= ~FTS_NOSTAT;
744 new = palloc(N_MTIME, f_mtime);
745 new->t_data = find_parsenum(new, "-mtime", arg, NULL);
746 TIME_CORRECT(new, N_MTIME);
751 * -mmin n functions --
753 * True if the difference between the file modification time and the
754 * current time is n min periods.
763 COMPARE((now - entry->fts_statp->st_mtime + 60 - 1) /
773 ftsoptions &= ~FTS_NOSTAT;
775 new = palloc(N_MMIN, f_mmin);
776 new->t_data = find_parsenum(new, "-mmin", arg, NULL);
777 TIME_CORRECT(new, N_MMIN);
785 * True if the basename of the filename being examined
786 * matches pattern using Pattern Matching Notation S3.14
793 return (!fnmatch(plan->c_data, entry->fts_name, 0));
802 new = palloc(N_NAME, f_name);
803 new->c_data = pattern;
808 * -newer file functions --
810 * True if the current file has been modified more recently
811 * then the modification time of the file named by the pathname
819 return (entry->fts_statp->st_mtime > plan->t_data);
829 ftsoptions &= ~FTS_NOSTAT;
831 if (stat(filename, &sb))
832 err(1, "%s", filename);
833 new = palloc(N_NEWER, f_newer);
834 new->t_data = sb.st_mtime;
839 * -nogroup functions --
841 * True if file belongs to a user ID for which the equivalent
842 * of the getgrnam() 9.2.1 [POSIX.1] function returns NULL.
845 f_nogroup(plan, entry)
849 char *group_from_gid();
851 return (group_from_gid(entry->fts_statp->st_gid, 1) ? 0 : 1);
857 ftsoptions &= ~FTS_NOSTAT;
859 return (palloc(N_NOGROUP, f_nogroup));
863 * -nouser functions --
865 * True if file belongs to a user ID for which the equivalent
866 * of the getpwuid() 9.2.2 [POSIX.1] function returns NULL.
869 f_nouser(plan, entry)
873 char *user_from_uid();
875 return (user_from_uid(entry->fts_statp->st_uid, 1) ? 0 : 1);
881 ftsoptions &= ~FTS_NOSTAT;
883 return (palloc(N_NOUSER, f_nouser));
889 * True if the path of the filename being examined
890 * matches pattern using Pattern Matching Notation S3.14
897 return (!fnmatch(plan->c_data, entry->fts_path, 0));
906 new = palloc(N_NAME, f_path);
907 new->c_data = pattern;
914 * The mode argument is used to represent file mode bits. If it starts
915 * with a leading digit, it's treated as an octal mode, otherwise as a
925 mode = entry->fts_statp->st_mode &
926 (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO);
927 if (plan->flags == F_ATLEAST)
928 return ((plan->m_data | mode) == mode);
930 return (mode == plan->m_data);
941 ftsoptions &= ~FTS_NOSTAT;
943 new = palloc(N_PERM, f_perm);
946 new->flags = F_ATLEAST;
950 if ((set = setmode(perm)) == NULL)
951 errx(1, "-perm: %s: illegal mode string", perm);
953 new->m_data = getmode(set, 0);
959 * -flags functions --
961 * The flags argument is used to represent file flags bits.
970 flags = entry->fts_statp->st_flags &
971 (UF_NODUMP | UF_IMMUTABLE | UF_APPEND | UF_OPAQUE |
972 SF_ARCHIVED | SF_IMMUTABLE | SF_APPEND);
973 if (plan->flags == F_ATLEAST)
974 /* note that plan->fl_flags always is a subset of
976 return (flags & plan->fl_mask) == plan->fl_flags;
978 return flags == plan->fl_flags;
987 u_long flags, notflags;
989 ftsoptions &= ~FTS_NOSTAT;
991 new = palloc(N_FLAGS, f_flags);
993 if (*flags_str == '-') {
994 new->flags = F_ATLEAST;
997 if (string_to_flags(&flags_str, &flags, ¬flags) == 1)
998 errx(1, "-flags: %s: illegal flags string", flags_str);
1000 new->fl_flags = flags;
1001 new->fl_mask = flags | notflags;
1003 printf("flags = %08x, mask = %08x (%08x, %08x)\n",
1004 new->fl_flags, new->fl_mask, flags, notflags);
1013 * -print functions --
1015 * Always true, causes the current pathame to be written to
1019 f_print(plan, entry)
1023 (void)puts(entry->fts_path);
1032 return (palloc(N_PRINT, f_print));
1036 * -print0 functions --
1038 * Always true, causes the current pathame to be written to
1039 * standard output followed by a NUL character
1042 f_print0(plan, entry)
1046 fputs(entry->fts_path, stdout);
1047 fputc('\0', stdout);
1056 return (palloc(N_PRINT0, f_print0));
1060 * -prune functions --
1062 * Prune a portion of the hierarchy.
1065 f_prune(plan, entry)
1071 if (fts_set(tree, entry, FTS_SKIP))
1072 err(1, "%s", entry->fts_path);
1079 return (palloc(N_PRUNE, f_prune));
1083 * -size n[c] functions --
1085 * True if the file size in bytes, divided by an implementation defined
1086 * value and rounded up to the next integer, is n. If n is followed by
1087 * a c, the size is in bytes.
1089 #define FIND_SIZE 512
1090 static int divsize = 1;
1099 size = divsize ? (entry->fts_statp->st_size + FIND_SIZE - 1) /
1100 FIND_SIZE : entry->fts_statp->st_size;
1101 COMPARE(size, plan->o_data);
1111 ftsoptions &= ~FTS_NOSTAT;
1113 new = palloc(N_SIZE, f_size);
1115 new->o_data = find_parsenum(new, "-size", arg, &endch);
1122 * -type c functions --
1124 * True if the type of the file is c, where c is b, c, d, p, f or w
1125 * for block special file, character special file, directory, FIFO,
1126 * regular file or whiteout respectively.
1133 return ((entry->fts_statp->st_mode & S_IFMT) == plan->m_data);
1143 ftsoptions &= ~FTS_NOSTAT;
1145 switch (typestring[0]) {
1170 ftsoptions |= FTS_WHITEOUT;
1172 #endif /* FTS_WHITEOUT */
1174 errx(1, "-type: %s: unknown type", typestring);
1177 new = palloc(N_TYPE, f_type);
1183 * -delete functions --
1185 * True always. Makes it's best shot and continues on regardless.
1188 f_delete(plan, entry)
1192 /* ignore these from fts */
1193 if (strcmp(entry->fts_accpath, ".") == 0 ||
1194 strcmp(entry->fts_accpath, "..") == 0)
1198 if (isdepth == 0 || /* depth off */
1199 (ftsoptions & FTS_NOSTAT) || /* not stat()ing */
1200 !(ftsoptions & FTS_PHYSICAL) || /* physical off */
1201 (ftsoptions & FTS_LOGICAL)) /* or finally, logical on */
1202 errx(1, "-delete: insecure options got turned on");
1204 /* Potentially unsafe - do not accept relative paths whatsoever */
1205 if (strchr(entry->fts_accpath, '/') != NULL)
1206 errx(1, "-delete: %s: relative path potentially not safe",
1207 entry->fts_accpath);
1209 /* Turn off user immutable bits if running as root */
1210 if ((entry->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
1211 !(entry->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)) &&
1213 chflags(entry->fts_accpath,
1214 entry->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE));
1216 /* rmdir directories, unlink everything else */
1217 if (S_ISDIR(entry->fts_statp->st_mode)) {
1218 if (rmdir(entry->fts_accpath) < 0 && errno != ENOTEMPTY)
1219 warn("-delete: rmdir(%s)", entry->fts_path);
1221 if (unlink(entry->fts_accpath) < 0)
1222 warn("-delete: unlink(%s)", entry->fts_path);
1233 ftsoptions &= ~FTS_NOSTAT; /* no optimise */
1234 ftsoptions |= FTS_PHYSICAL; /* disable -follow */
1235 ftsoptions &= ~FTS_LOGICAL; /* disable -follow */
1236 isoutput = 1; /* possible output */
1237 isdepth = 1; /* -depth implied */
1239 return (palloc(N_DELETE, f_delete));
1243 * -user uname functions --
1245 * True if the file belongs to the user uname. If uname is numeric and
1246 * an equivalent of the getpwnam() S9.2.2 [POSIX.1] function does not
1247 * return a valid user name, uname is taken as a user ID.
1254 return (entry->fts_statp->st_uid == plan->u_data);
1265 ftsoptions &= ~FTS_NOSTAT;
1267 p = getpwnam(username);
1269 uid = atoi(username);
1270 if (uid == 0 && username[0] != '0')
1271 errx(1, "-user: %s: no such user", username);
1275 new = palloc(N_USER, f_user);
1281 * -xdev functions --
1283 * Always true, causes find not to decend past directories that have a
1284 * different device ID (st_dev, see stat() S5.6.2 [POSIX.1])
1289 ftsoptions |= FTS_XDEV;
1291 return (palloc(N_XDEV, f_always_true));
1295 * ( expression ) functions --
1297 * True if expression is true.
1308 for (p = plan->p_data[0];
1309 p && (state = (p->eval)(p, entry)); p = p->next);
1314 * N_OPENPAREN and N_CLOSEPAREN nodes are temporary place markers. They are
1315 * eliminated during phase 2 of find_formplan() --- the '(' node is converted
1316 * to a N_EXPR node containing the expression and the ')' node is discarded.
1321 return (palloc(N_OPENPAREN, (int (*)())-1));
1327 return (palloc(N_CLOSEPAREN, (int (*)())-1));
1331 * ! expression functions --
1333 * Negation of a primary; the unary NOT operator.
1344 for (p = plan->p_data[0];
1345 p && (state = (p->eval)(p, entry)); p = p->next);
1352 return (palloc(N_NOT, f_not));
1356 * expression -o expression functions --
1358 * Alternation of primaries; the OR operator. The second expression is
1359 * not evaluated if the first expression is true.
1370 for (p = plan->p_data[0];
1371 p && (state = (p->eval)(p, entry)); p = p->next);
1376 for (p = plan->p_data[1];
1377 p && (state = (p->eval)(p, entry)); p = p->next);
1384 return (palloc(N_OR, f_or));
1390 int (*f) __P((PLAN *, FTSENT *));
1394 if ((new = malloc(sizeof(PLAN))) == NULL)