diff options
| author | jonb <none@none> | 2005-06-21 18:13:49 -0700 |
|---|---|---|
| committer | jonb <none@none> | 2005-06-21 18:13:49 -0700 |
| commit | da1a9cbef1219322a90f60d264d9fa2b6d269314 (patch) | |
| tree | e8a74820b402b59deaf737a07f78579ab2a9e7b6 /usr/src/cmd/find | |
| parent | 2dae3fb5f236a83380b9deea54417c4e1f535121 (diff) | |
| download | illumos-joyent-da1a9cbef1219322a90f60d264d9fa2b6d269314.tar.gz | |
PSARC/2004/734 Find Time Options Granularity Enhancement
5077247 Find should support a way to find modified times less than 1 day
Diffstat (limited to 'usr/src/cmd/find')
| -rw-r--r-- | usr/src/cmd/find/find.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/usr/src/cmd/find/find.c b/usr/src/cmd/find/find.c index 99466de17c..dd8fab87ad 100644 --- a/usr/src/cmd/find/find.c +++ b/usr/src/cmd/find/find.c @@ -20,10 +20,12 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +#pragma ident "%Z%%M% %I% %E% SMI" + /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ @@ -37,8 +39,6 @@ * Copyright 1985, 1990 by Mortice Kern Systems Inc. All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <errno.h> #include <pwd.h> @@ -62,6 +62,7 @@ #define A_DAY (long)(60*60*24) /* a day full of seconds */ +#define A_MIN (long)(60) #define BLKSIZ 512 #define round(x, s) (((x)+(s)-1)&~((s)-1)) #ifndef FTW_SLN @@ -82,7 +83,7 @@ enum Command PRINT, DEPTH, LOCAL, MOUNT, ATIME, MTIME, CTIME, NEWER, NAME, F_USER, F_GROUP, INUM, SIZE, LINKS, PERM, EXEC, OK, CPIO, NCPIO, TYPE, AND, OR, NOT, LPAREN, RPAREN, CSIZE, VARARGS, FOLLOW, - PRUNE, NOUSER, NOGRP, FSTYPE, LS, XATTR, ACL + PRUNE, NOUSER, NOGRP, FSTYPE, LS, XATTR, ACL, MMIN, AMIN, CMIN }; enum Type @@ -106,8 +107,10 @@ static struct Args commands[] = "(", LPAREN, Unary, ")", RPAREN, Unary, "-a", AND, Op, + "-amin", AMIN, Num, "-atime", ATIME, Num, "-cpio", CPIO, Cpio, + "-cmin", CMIN, Num, "-ctime", CTIME, Num, "-depth", DEPTH, Unary, "-exec", EXEC, Exec, @@ -117,6 +120,7 @@ static struct Args commands[] = "-links", LINKS, Num, "-local", LOCAL, Unary, "-mount", MOUNT, Unary, + "-mmin", MMIN, Num, "-mtime", MTIME, Num, "-name", NAME, Str, "-ncpio", NCPIO, Cpio, @@ -504,8 +508,11 @@ int *actionp; np->first.ll = atoll(b); break; + case CMIN: case CTIME: + case MMIN: case MTIME: + case AMIN: case ATIME: case LINKS: np->first.l = atol(b); @@ -823,6 +830,18 @@ struct FTW *state; days: l = (now-t)/A_DAY; goto num; + case MMIN: + t = statb->st_mtime; + goto mins; + case AMIN: + t = statb->st_atime; + goto mins; + case CMIN: + t = statb->st_ctime; + goto mins; + mins: + l = (now-t)/A_MIN; + goto num; case CSIZE: ll = (long long)statb->st_size; goto llnum; |
