Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 alpha 4/3/85; site ukma.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!cbosgd!ukma!david From: david@ukma.UUCP (David Herron, NPR Lover) Newsgroups: net.bugs.4bsd,net.unix-wizards Subject: Patch to find(1) to find large files. Message-ID: <1842@ukma.UUCP> Date: Mon, 3-Jun-85 17:06:06 EDT Article-I.D.: ukma.1842 Posted: Mon Jun 3 17:06:06 1985 Date-Received: Thu, 6-Jun-85 00:42:39 EDT Organization: U of Kentucky, Mathematical Sciences, Lexington KY Lines: 147 Xref: watmath net.bugs.4bsd:1544 net.unix-wizards:13411 Description: Find could really use a -bigger flag. The following context diff will describes how to add it to find. Syntax is "-bigger ". Which returns true for files which are bigger than the named file. Author: David Herron, ukma!david. Script started on Mon Jun 3 16:51:50 1985 ukma# rcsdiff -r1.1.1.1 -r1.1.1.4 -c find.c RCS file: RCS/find.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.4 diff -c -r1.1.1.1 -r1.1.1.4 *** /tmp/,RCSt1028957 Mon Jun 3 16:52:41 1985 --- /tmp/,RCSt2028957 Mon Jun 3 16:53:22 1985 *************** *** 1,5 #ifndef lint ! static char rcsid[] = "$Header: find.c,v 1.1.1.1 85/01/04 20:18:42 root Exp $"; #endif lint /* * $Locker: $ --- 1,5 ----- #ifndef lint ! static char rcsid[] = "$Header: find.c,v 1.1.1.4 85/06/03 16:41:03 root Exp $"; #endif lint /* * $Locker: $ *************** *** 4,9 /* * $Locker: $ * $Log: find.c,v $ * Revision 1.1.1.1 85/01/04 20:18:42 root * Branch for ukma changes * --- 4,23 ----- /* * $Locker: $ * $Log: find.c,v $ + * Revision 1.1.1.4 85/06/03 16:41:03 root + * Corrected a syntax error. + * ukma!david + * + * Revision 1.1.1.3 85/06/03 16:31:34 root + * Slight mistake. Forgot to define bigger() in e4(). + * ukma!david + * + * + * Revision 1.1.1.2 85/06/03 16:26:55 root + * Added command "-bigger file" which will find all the files bigger + * than the named file. + * -- ukma!david + * * Revision 1.1.1.1 85/01/04 20:18:42 root * Branch for ukma changes * *************** *** 42,47 int Wct = 2560; long Newer; struct stat Statb; --- 56,62 ----- int Wct = 2560; long Newer; + long Bigger; /* CHANGE ukma!david, for bigger() */ struct stat Statb; *************** *** 157,163 struct anode *e3() { /* parse parens and predicates */ int exeq(), ok(), glob(), mtime(), atime(), user(), group(), size(), perm(), links(), print(), ! type(), ino(), cpio(), newer(); struct anode *p1; int i; register char *a, *b, s; --- 172,178 ----- struct anode *e3() { /* parse parens and predicates */ int exeq(), ok(), glob(), mtime(), atime(), user(), group(), size(), perm(), links(), print(), ! type(), ino(), cpio(), newer(), bigger(); struct anode *p1; int i; register char *a, *b, s; *************** *** 248,253 } Newer = Statb.st_mtime; return mk(newer, (struct anode *)0, (struct anode *)0); } err: fprintf(stderr, "find: bad option < %s >\n", a); exit(1); --- 263,280 ----- } Newer = Statb.st_mtime; return mk(newer, (struct anode *)0, (struct anode *)0); + } else if (EQ(a, "-bigger")) { + /* + * CHANGE ukma!david -- Add in parsing for -bigger. + * Make everything look like -newer since it's the same + * kind of operation. + */ + if (stat(b, &Statb) < 0) { + fprintf(stderr, "find: cannot access < %s >\n", b); + exit(1); + } + Bigger = Statb.st_size; + return mk(bigger, (struct anode *)0, (struct anode *)0); } err: fprintf(stderr, "find: bad option < %s >\n", a); exit(1); *************** *** 442,447 newer() { return Statb.st_mtime > Newer; } /* support functions */ --- 469,478 ----- newer() { return Statb.st_mtime > Newer; + } + bigger() + { + return Statb.st_size > Bigger; } /* support functions */ ukma# script done on Mon Jun 3 16:58:23 1985