find.c (76250) | find.c (91400) |
---|---|
1/*- 2 * Copyright (c) 1991, 1993, 1994 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 --- 25 unchanged lines hidden (view full) --- 34 * SUCH DAMAGE. 35 */ 36 37#ifndef lint 38#if 0 39static char sccsid[] = "@(#)find.c 8.5 (Berkeley) 8/5/94"; 40#else 41static const char rcsid[] = | 1/*- 2 * Copyright (c) 1991, 1993, 1994 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 --- 25 unchanged lines hidden (view full) --- 34 * SUCH DAMAGE. 35 */ 36 37#ifndef lint 38#if 0 39static char sccsid[] = "@(#)find.c 8.5 (Berkeley) 8/5/94"; 40#else 41static const char rcsid[] = |
42 "$FreeBSD: head/usr.bin/find/find.c 76250 2001-05-03 18:05:35Z phk $"; | 42 "$FreeBSD: head/usr.bin/find/find.c 91400 2002-02-27 17:57:00Z dwmalone $"; |
43#endif 44#endif /* not lint */ 45 46#include <sys/types.h> 47#include <sys/stat.h> 48 49#include <err.h> 50#include <errno.h> --- 61 unchanged lines hidden (view full) --- 112 113 /* 114 * if the user didn't specify one of -print, -ok or -exec, then -print 115 * is assumed so we bracket the current expression with parens, if 116 * necessary, and add a -print node on the end. 117 */ 118 if (!isoutput) { 119 OPTION *p; | 43#endif 44#endif /* not lint */ 45 46#include <sys/types.h> 47#include <sys/stat.h> 48 49#include <err.h> 50#include <errno.h> --- 61 unchanged lines hidden (view full) --- 112 113 /* 114 * if the user didn't specify one of -print, -ok or -exec, then -print 115 * is assumed so we bracket the current expression with parens, if 116 * necessary, and add a -print node on the end. 117 */ 118 if (!isoutput) { 119 OPTION *p; |
120 char **argv = 0; | 120 char **argv1 = 0; |
121 122 if (plan == NULL) { | 121 122 if (plan == NULL) { |
123 p = option("-print"); 124 new = (p->create)(p, &argv); | 123 p = lookup_option("-print"); 124 new = (p->create)(p, &argv1); |
125 tail = plan = new; 126 } else { | 125 tail = plan = new; 126 } else { |
127 p = option("("); 128 new = (p->create)(p, &argv); | 127 p = lookup_option("("); 128 new = (p->create)(p, &argv1); |
129 new->next = plan; 130 plan = new; | 129 new->next = plan; 130 plan = new; |
131 p = option(")"); 132 new = (p->create)(p, &argv); | 131 p = lookup_option(")"); 132 new = (p->create)(p, &argv1); |
133 tail->next = new; 134 tail = new; | 133 tail->next = new; 134 tail = new; |
135 p = option("-print"); 136 new = (p->create)(p, &argv); | 135 p = lookup_option("-print"); 136 new = (p->create)(p, &argv1); |
137 tail->next = new; 138 tail = new; 139 } 140 } 141 142 /* 143 * the command line has been completely processed into a search plan 144 * except for the (, ), !, and -o operators. Rearrange the plan so --- 30 unchanged lines hidden (view full) --- 175 * take a search plan and an array of search paths and executes the plan 176 * over all FTSENT's returned for the given search paths. 177 */ 178int 179find_execute(plan, paths) 180 PLAN *plan; /* search plan */ 181 char **paths; /* array of pathnames to traverse */ 182{ | 137 tail->next = new; 138 tail = new; 139 } 140 } 141 142 /* 143 * the command line has been completely processed into a search plan 144 * except for the (, ), !, and -o operators. Rearrange the plan so --- 30 unchanged lines hidden (view full) --- 175 * take a search plan and an array of search paths and executes the plan 176 * over all FTSENT's returned for the given search paths. 177 */ 178int 179find_execute(plan, paths) 180 PLAN *plan; /* search plan */ 181 char **paths; /* array of pathnames to traverse */ 182{ |
183 register FTSENT *entry; | 183 FTSENT *entry; |
184 PLAN *p; 185 int rval; 186 187 tree = fts_open(paths, ftsoptions, (issort ? find_compare : NULL)); 188 if (tree == NULL) 189 err(1, "ftsopen"); 190 191 for (rval = 0; (entry = fts_read(tree)) != NULL;) { --- 50 unchanged lines hidden --- | 184 PLAN *p; 185 int rval; 186 187 tree = fts_open(paths, ftsoptions, (issort ? find_compare : NULL)); 188 if (tree == NULL) 189 err(1, "ftsopen"); 190 191 for (rval = 0; (entry = fts_read(tree)) != NULL;) { --- 50 unchanged lines hidden --- |