Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Jun 2006 17:09:26 -0400
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        Kirill Ponomarew <krion@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/usr.bin/find find.1 function.c
Message-ID:  <200606011709.28816.jkim@FreeBSD.org>
In-Reply-To: <200605271827.k4RIRf7G078768@repoman.freebsd.org>
References:  <200605271827.k4RIRf7G078768@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Boundary-00=_Ie1fErgPmDISPAA
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Saturday 27 May 2006 02:27 pm, Kirill Ponomarew wrote:
> krion       2006-05-27 18:27:41 UTC
>
>   FreeBSD src repository
>
>   Modified files:
>     usr.bin/find         find.1 function.c
>   Log:
>   Add the capability for a trailing scale indicator to cause the
>   specified size to be read in the more familiar units of
> kilobytes, megabytes, gigabytes, terabytes and petabytes.
>
>   PR:             bin/50988
>   Submitted by:   Matthew Seaman <m.seaman@infracaninophile.co.uk>
>   MFC after:      7 days
>
>   Revision  Changes    Path
>   1.77      +21 -2     src/usr.bin/find/find.1
>   1.58      +35 -3     src/usr.bin/find/function.c

off_t may not be long long.  I think you should do something like the 
attached patch and you may just remove the comments.

Thanks!

Jung-uk Kim

--Boundary-00=_Ie1fErgPmDISPAA
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="find.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="find.diff"

Index: function.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/find/function.c,v
retrieving revision 1.58
diff -u -r1.58 function.c
--- function.c	27 May 2006 18:27:41 -0000	1.58
+++ function.c	1 Jun 2006 21:01:00 -0000
@@ -1399,24 +1399,24 @@
 	if (endch != '\0') {
 		divsize = 0;
 
+		scale = 1;
 		switch (endch) {
 		case 'c':                       /* characters */
-			scale = 0x1LL;
 			break;
 		case 'k':                       /* kilobytes 1<<10 */
-			scale = 0x400LL;
+			scale <<= 10;
 			break;
 		case 'M':                       /* megabytes 1<<20 */
-			scale = 0x100000LL;
+			scale <<= 20;
 			break;
 		case 'G':                       /* gigabytes 1<<30 */
-			scale = 0x40000000LL;
+			scale <<= 30;
 			break;
 		case 'T':                       /* terabytes 1<<40 */
-			scale = 0x1000000000LL;
+			scale <<= 40;
 			break;
 		case 'P':                       /* petabytes 1<<50 */
-			scale = 0x4000000000000LL;
+			scale <<= 50;
 			break;
 		default:
 			errx(1, "%s: %s: illegal trailing character",

--Boundary-00=_Ie1fErgPmDISPAA--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606011709.28816.jkim>