FreeBSD Bugzilla – Attachment 16539 Details for
Bug 30309
New FIND(1) option
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.88 KB, created by
Nils M Holm
on 2001-09-04 13:50:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Nils M Holm
Created:
2001-09-04 13:50:01 UTC
Size:
3.88 KB
patch
obsolete
>diff -u /usr/src/usr.bin/find.old/extern.h /usr/src/usr.bin/find/extern.h >--- /usr/src/usr.bin/find.old/extern.h Tue Sep 4 14:07:04 2001 >+++ /usr/src/usr.bin/find/extern.h Tue Sep 4 14:09:51 2001 >@@ -69,6 +69,7 @@ > PLAN *c_newer __P((char *)); > PLAN *c_nogroup __P((void)); > PLAN *c_nouser __P((void)); >+PLAN *c_nt __P((char *)); > PLAN *c_path __P((char *)); > PLAN *c_perm __P((char *)); > PLAN *c_print __P((void)); >diff -u /usr/src/usr.bin/find.old/find.1 /usr/src/usr.bin/find/find.1 >--- /usr/src/usr.bin/find.old/find.1 Tue Sep 4 14:07:04 2001 >+++ /usr/src/usr.bin/find/find.1 Tue Sep 4 14:32:23 2001 >@@ -291,6 +291,12 @@ > True if the file belongs to an unknown user. > .It Ic -nogroup > True if the file belongs to an unknown group. >+.It Ic -nt Ar difference >+True if the current file has a more recent last modification time than >+the current time minus the specified difference (the file is newer than >+the given amount of time). Time values may have suffixes: s=seconds, >+m=minutes, h=hours, D=days, W=weeks, M=months (30D), Y=years (365D). >+Suffixes may be mixed: -nt 5h30m. > .It Ic -path Ar pattern > True if the pathname being examined matches > .Ar pattern . >diff -u /usr/src/usr.bin/find.old/find.h /usr/src/usr.bin/find/find.h >--- /usr/src/usr.bin/find.old/find.h Tue Sep 4 14:07:04 2001 >+++ /usr/src/usr.bin/find/find.h Tue Sep 4 14:08:41 2001 >@@ -44,8 +44,8 @@ > N_EXEC, N_EXECDIR, N_EXPR, N_FLAGS, > N_FOLLOW, N_FSTYPE, N_GROUP, N_INUM, N_LINKS, N_LS, N_MMIN, > N_MTIME, N_NAME, >- N_NEWER, N_NOGROUP, N_NOT, N_NOUSER, N_OK, N_OPENPAREN, N_OR, N_PATH, >- N_PERM, N_PRINT, N_PRUNE, N_SIZE, N_TYPE, N_USER, N_XDEV, >+ N_NEWER, N_NOGROUP, N_NOT, N_NOUSER, N_NT, N_OK, N_OPENPAREN, N_OR, >+ N_PATH, N_PERM, N_PRINT, N_PRUNE, N_SIZE, N_TYPE, N_USER, N_XDEV, > N_PRINT0, N_DELETE, N_MAXDEPTH, N_MINDEPTH > }; > >diff -u /usr/src/usr.bin/find.old/function.c /usr/src/usr.bin/find/function.c >--- /usr/src/usr.bin/find.old/function.c Tue Sep 4 14:07:04 2001 >+++ /usr/src/usr.bin/find/function.c Tue Sep 4 14:26:29 2001 >@@ -59,6 +59,7 @@ > #include <stdlib.h> > #include <string.h> > #include <unistd.h> >+#include <ctype.h> > > #include "find.h" > >@@ -940,6 +941,75 @@ > ftsoptions &= ~FTS_NOSTAT; > > return (palloc(N_NOUSER, f_nouser)); >+} >+ >+/* >+ * -nt diff functions -- >+ * >+ * True if the different between the current time and the file >+ * modification time is less than the specified difference. >+ */ >+int >+f_nt(plan, entry) >+ PLAN *plan; >+ FTSENT *entry; >+{ >+ extern time_t now; >+ >+ return (entry->fts_statp->st_mtime > now - plan->t_data); >+} >+ >+PLAN * >+c_nt(difftime) >+ char *difftime; >+{ >+ PLAN *new; >+ time_t secs, a; >+ char *s; >+ >+ ftsoptions &= ~FTS_NOSTAT; >+ >+ secs = 0L; >+ a = 0L; >+ for (s = difftime; *s; s++) { >+ if (isdigit(*s)) { >+ a = a*10 + *s-'0'; >+ } >+ else if (*s == 's') { /* seconds */ >+ secs += a; >+ a = 0L; >+ } >+ else if (*s == 'm') { /* minutes */ >+ secs += a*60L; >+ a = 0L; >+ } >+ else if (*s == 'h') { /* hours */ >+ secs += a*3600L; >+ a = 0L; >+ } >+ else if (*s == 'D') { /* days */ >+ secs += a*86400L; >+ a = 0L; >+ } >+ else if (*s == 'W') { /* weeks */ >+ secs += a*604800L; >+ a = 0L; >+ } >+ else if (*s == 'M') { /* months (d*30)*/ >+ secs += a*2592000L; >+ a = 0L; >+ } >+ else if (*s == 'Y') { /* years (d*365)*/ >+ secs += a*31536000L; >+ a = 0L; >+ } >+ else { >+ errx(1, "-nt: bad difference: %s", difftime); >+ } >+ } >+ new = palloc(N_NT, f_nt); >+ new->t_data = secs; >+ return (new); > } > > /* >diff -u /usr/src/usr.bin/find.old/option.c /usr/src/usr.bin/find/option.c >--- /usr/src/usr.bin/find.old/option.c Tue Sep 4 14:07:04 2001 >+++ /usr/src/usr.bin/find/option.c Tue Sep 4 14:09:28 2001 >@@ -92,6 +92,7 @@ > { "-newer", N_NEWER, c_newer, O_ARGV }, > { "-nogroup", N_NOGROUP, c_nogroup, O_ZERO }, > { "-nouser", N_NOUSER, c_nouser, O_ZERO }, >+ { "-nt", N_NT, c_nt , O_ARGV }, > { "-o", N_OR, c_or, O_ZERO }, > { "-ok", N_OK, c_exec, O_ARGVP }, > { "-or", N_OR, c_or, O_ZERO },
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 30309
: 16539