Deleted Added
full compact
function.c (157440) function.c (158572)
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Cimarron D. Taylor of the University of California, Berkeley.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 27 unchanged lines hidden (view full) ---

36
37#ifndef lint
38#if 0
39static const char sccsid[] = "@(#)function.c 8.10 (Berkeley) 5/4/95";
40#endif
41#endif /* not lint */
42
43#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Cimarron D. Taylor of the University of California, Berkeley.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 27 unchanged lines hidden (view full) ---

36
37#ifndef lint
38#if 0
39static const char sccsid[] = "@(#)function.c 8.10 (Berkeley) 5/4/95";
40#endif
41#endif /* not lint */
42
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: head/usr.bin/find/function.c 157440 2006-04-03 20:36:37Z ceri $");
44__FBSDID("$FreeBSD: head/usr.bin/find/function.c 158572 2006-05-14 20:23:01Z krion $");
45
46#include <sys/param.h>
47#include <sys/ucred.h>
48#include <sys/stat.h>
49#include <sys/types.h>
50#include <sys/acl.h>
51#include <sys/wait.h>
52#include <sys/mount.h>

--- 18 unchanged lines hidden (view full) ---

71
72static PLAN *palloc(OPTION *);
73static long long find_parsenum(PLAN *, const char *, char *, char *);
74static long long find_parsetime(PLAN *, const char *, char *);
75static char *nextarg(OPTION *, char ***);
76
77extern char **environ;
78
45
46#include <sys/param.h>
47#include <sys/ucred.h>
48#include <sys/stat.h>
49#include <sys/types.h>
50#include <sys/acl.h>
51#include <sys/wait.h>
52#include <sys/mount.h>

--- 18 unchanged lines hidden (view full) ---

71
72static PLAN *palloc(OPTION *);
73static long long find_parsenum(PLAN *, const char *, char *, char *);
74static long long find_parsetime(PLAN *, const char *, char *);
75static char *nextarg(OPTION *, char ***);
76
77extern char **environ;
78
79static PLAN *lastexecplus = NULL;
80
79#define COMPARE(a, b) do { \
80 switch (plan->flags & F_ELG_MASK) { \
81 case F_EQUAL: \
82 return (a == b); \
83 case F_LESSTHAN: \
84 return (a < b); \
85 case F_GREATER: \
86 return (a > b); \

--- 619 unchanged lines hidden (view full) ---

706 argmax -= 1 + sizeof(*ep);
707 new->e_pnummax = argmax / 16;
708 argmax -= sizeof(char *) * new->e_pnummax;
709 if (argmax <= 0)
710 errx(1, "no space for arguments");
711 new->e_psizemax = argmax;
712 new->e_pbsize = 0;
713 cnt += new->e_pnummax + 1;
81#define COMPARE(a, b) do { \
82 switch (plan->flags & F_ELG_MASK) { \
83 case F_EQUAL: \
84 return (a == b); \
85 case F_LESSTHAN: \
86 return (a < b); \
87 case F_GREATER: \
88 return (a > b); \

--- 619 unchanged lines hidden (view full) ---

708 argmax -= 1 + sizeof(*ep);
709 new->e_pnummax = argmax / 16;
710 argmax -= sizeof(char *) * new->e_pnummax;
711 if (argmax <= 0)
712 errx(1, "no space for arguments");
713 new->e_psizemax = argmax;
714 new->e_pbsize = 0;
715 cnt += new->e_pnummax + 1;
716 new->e_next = lastexecplus;
717 lastexecplus = new;
714 }
715 if ((new->e_argv = malloc(cnt * sizeof(char *))) == NULL)
716 err(1, NULL);
717 if ((new->e_orig = malloc(cnt * sizeof(char *))) == NULL)
718 err(1, NULL);
719 if ((new->e_len = malloc(cnt * sizeof(int))) == NULL)
720 err(1, NULL);
721

--- 27 unchanged lines hidden (view full) ---

749 goto done;
750 }
751 new->e_argv[cnt] = new->e_orig[cnt] = NULL;
752
753done: *argvp = argv + 1;
754 return new;
755}
756
718 }
719 if ((new->e_argv = malloc(cnt * sizeof(char *))) == NULL)
720 err(1, NULL);
721 if ((new->e_orig = malloc(cnt * sizeof(char *))) == NULL)
722 err(1, NULL);
723 if ((new->e_len = malloc(cnt * sizeof(int))) == NULL)
724 err(1, NULL);
725

--- 27 unchanged lines hidden (view full) ---

753 goto done;
754 }
755 new->e_argv[cnt] = new->e_orig[cnt] = NULL;
756
757done: *argvp = argv + 1;
758 return new;
759}
760
761/* Finish any pending -exec ... {} + functions. */
762void
763finish_execplus()
764{
765 PLAN *p;
766
767 p = lastexecplus;
768 while (p != NULL) {
769 (p->execute)(p, NULL);
770 p = p->e_next;
771 }
772}
773
757int
758f_flags(PLAN *plan, FTSENT *entry)
759{
760 u_long flags;
761
762 flags = entry->fts_statp->st_flags;
763 if (plan->flags & F_ATLEAST)
764 return (flags | plan->fl_flags) == flags &&

--- 816 unchanged lines hidden ---
774int
775f_flags(PLAN *plan, FTSENT *entry)
776{
777 u_long flags;
778
779 flags = entry->fts_statp->st_flags;
780 if (plan->flags & F_ATLEAST)
781 return (flags | plan->fl_flags) == flags &&

--- 816 unchanged lines hidden ---