function.c (127d7563c4779d9be231b4657388dd55622139a4) function.c (3f5223f84ac91b218fb0544edf5e914e339023b3)
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

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

121 * -n, such that "-mtime -1" would be less than 0 days, which isn't what the
122 * user wanted. Correct so that -1 is "less than 1".
123 */
124#define TIME_CORRECT(p, ttype) \
125 if ((p)->type == ttype && (p)->flags == F_LESSTHAN) \
126 ++((p)->t_data);
127
128/*
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

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

121 * -n, such that "-mtime -1" would be less than 0 days, which isn't what the
122 * user wanted. Correct so that -1 is "less than 1".
123 */
124#define TIME_CORRECT(p, ttype) \
125 if ((p)->type == ttype && (p)->flags == F_LESSTHAN) \
126 ++((p)->t_data);
127
128/*
129 * -amin n functions --
130 *
131 * True if the difference between the file access time and the
132 * current time is n min periods.
133 */
134int
135f_amin(plan, entry)
136 PLAN *plan;
137 FTSENT *entry;
138{
139 extern time_t now;
140
141 COMPARE((now - entry->fts_statp->st_atime +
142 60 - 1) / 60, plan->t_data);
143}
144
145PLAN *
146c_amin(arg)
147 char *arg;
148{
149 PLAN *new;
150
151 ftsoptions &= ~FTS_NOSTAT;
152
153 new = palloc(N_AMIN, f_amin);
154 new->t_data = find_parsenum(new, "-amin", arg, NULL);
155 TIME_CORRECT(new, N_AMIN);
156 return (new);
157}
158
159
160/*
129 * -atime n functions --
130 *
131 * True if the difference between the file access time and the
132 * current time is n 24 hour periods.
133 */
134int
135f_atime(plan, entry)
136 PLAN *plan;

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

150
151 ftsoptions &= ~FTS_NOSTAT;
152
153 new = palloc(N_ATIME, f_atime);
154 new->t_data = find_parsenum(new, "-atime", arg, NULL);
155 TIME_CORRECT(new, N_ATIME);
156 return (new);
157}
161 * -atime n functions --
162 *
163 * True if the difference between the file access time and the
164 * current time is n 24 hour periods.
165 */
166int
167f_atime(plan, entry)
168 PLAN *plan;

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

182
183 ftsoptions &= ~FTS_NOSTAT;
184
185 new = palloc(N_ATIME, f_atime);
186 new->t_data = find_parsenum(new, "-atime", arg, NULL);
187 TIME_CORRECT(new, N_ATIME);
188 return (new);
189}
190
191
158/*
192/*
193 * -cmin n functions --
194 *
195 * True if the difference between the last change of file
196 * status information and the current time is n min periods.
197 */
198int
199f_cmin(plan, entry)
200 PLAN *plan;
201 FTSENT *entry;
202{
203 extern time_t now;
204
205 COMPARE((now - entry->fts_statp->st_ctime +
206 60 - 1) / 60, plan->t_data);
207}
208
209PLAN *
210c_cmin(arg)
211 char *arg;
212{
213 PLAN *new;
214
215 ftsoptions &= ~FTS_NOSTAT;
216
217 new = palloc(N_CMIN, f_cmin);
218 new->t_data = find_parsenum(new, "-cmin", arg, NULL);
219 TIME_CORRECT(new, N_CMIN);
220 return (new);
221}
222
223/*
159 * -ctime n functions --
160 *
161 * True if the difference between the last change of file
162 * status information and the current time is n 24 hour periods.
163 */
164int
165f_ctime(plan, entry)
166 PLAN *plan;

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

181 ftsoptions &= ~FTS_NOSTAT;
182
183 new = palloc(N_CTIME, f_ctime);
184 new->t_data = find_parsenum(new, "-ctime", arg, NULL);
185 TIME_CORRECT(new, N_CTIME);
186 return (new);
187}
188
224 * -ctime n functions --
225 *
226 * True if the difference between the last change of file
227 * status information and the current time is n 24 hour periods.
228 */
229int
230f_ctime(plan, entry)
231 PLAN *plan;

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

246 ftsoptions &= ~FTS_NOSTAT;
247
248 new = palloc(N_CTIME, f_ctime);
249 new->t_data = find_parsenum(new, "-ctime", arg, NULL);
250 TIME_CORRECT(new, N_CTIME);
251 return (new);
252}
253
254
189/*
190 * -depth functions --
191 *
192 * Always true, causes descent of the directory hierarchy to be done
193 * so that all entries in a directory are acted on before the directory
194 * itself.
195 */
196int

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

673
674 new = palloc(N_MTIME, f_mtime);
675 new->t_data = find_parsenum(new, "-mtime", arg, NULL);
676 TIME_CORRECT(new, N_MTIME);
677 return (new);
678}
679
680/*
255/*
256 * -depth functions --
257 *
258 * Always true, causes descent of the directory hierarchy to be done
259 * so that all entries in a directory are acted on before the directory
260 * itself.
261 */
262int

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

739
740 new = palloc(N_MTIME, f_mtime);
741 new->t_data = find_parsenum(new, "-mtime", arg, NULL);
742 TIME_CORRECT(new, N_MTIME);
743 return (new);
744}
745
746/*
747 * -mmin n functions --
748 *
749 * True if the difference between the file modification time and the
750 * current time is n min periods.
751 */
752int
753f_mmin(plan, entry)
754 PLAN *plan;
755 FTSENT *entry;
756{
757 extern time_t now;
758
759 COMPARE((now - entry->fts_statp->st_mtime + 60 - 1) /
760 60, plan->t_data);
761}
762
763PLAN *
764c_mmin(arg)
765 char *arg;
766{
767 PLAN *new;
768
769 ftsoptions &= ~FTS_NOSTAT;
770
771 new = palloc(N_MMIN, f_mmin);
772 new->t_data = find_parsenum(new, "-mmin", arg, NULL);
773 TIME_CORRECT(new, N_MMIN);
774 return (new);
775}
776
777
778/*
681 * -name functions --
682 *
683 * True if the basename of the filename being examined
684 * matches pattern using Pattern Matching Notation S3.14
685 */
686int
687f_name(plan, entry)
688 PLAN *plan;

--- 553 unchanged lines hidden ---
779 * -name functions --
780 *
781 * True if the basename of the filename being examined
782 * matches pattern using Pattern Matching Notation S3.14
783 */
784int
785f_name(plan, entry)
786 PLAN *plan;

--- 553 unchanged lines hidden ---