small usr.bin/find patch

View: New views
9 Messages — Rating Filter:   Alert me  

small usr.bin/find patch

by Alexander Best :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi everybody,

here's just a quick hack i applied to find. i very often use the -size switch
and always forget if you need to append "m" or "M" for megabyte or "k" or "K"
for kilobyte. after applying the patch find accepts both. ;-)

cheers.


_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

findpatch (1K) Download Attachment

Re: small usr.bin/find patch

by Julian Elischer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Alexander Best wrote:
> hi everybody,
>
> here's just a quick hack i applied to find. i very often use the -size switch
> and always forget if you need to append "m" or "M" for megabyte or "k" or "K"
> for kilobyte. after applying the patch find accepts both. ;-)
>
> cheers.
>

Are you sure this is wise? after all 125 millibytes would be 1 bit..

(  :-)  )


>
> ------------------------------------------------------------------------
>
> _______________________________________________
> freebsd-hackers@... mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: small usr.bin/find patch

by Wojciech Puchar-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>>
>> cheers.
>>
>
> Are you sure this is wise? after all 125 millibytes would be 1 bit..

Agree. While lots of people use m instead of M and b instead of B, this is
not right to correct proper behavior to improper just for them.
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: small usr.bin/find patch

by Ilya Orehov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

+------- Julian Elischer, 2009-06-17 -------
| Alexander Best wrote:
| >hi everybody,
| >
| >here's just a quick hack i applied to find. i very often use the -size
| >switch
| >and always forget if you need to append "m" or "M" for megabyte or "k" or
| >"K"
| >for kilobyte. after applying the patch find accepts both. ;-)
| >
| >cheers.
| >
|
| Are you sure this is wise? after all 125 millibytes would be 1 bit..
|
| (  :-)  )

BTW, our du(1) accepts only lowercase -k and -m.
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: small usr.bin/find patch

by Alexander Best :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hmmm...but dd e.g. uses lowercase instead of upercase letters to indicate
kilobyte, megabyte and so on. isn't there some unix/posix/whatever standard
telling app developers what to use?

Wojciech Puchar schrieb am 2009-06-17:

> >>cheers.


> >Are you sure this is wise? after all 125 millibytes would be 1 bit..

> Agree. While lots of people use m instead of M and b instead of B,
> this is not right to correct proper behavior to improper just for
> them.
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: small usr.bin/find patch

by Johan van Selst :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Alexander Best wrote:
> hmmm...but dd e.g. uses lowercase instead of upercase letters to indicate
> kilobyte, megabyte and so on. isn't there some unix/posix/whatever standard
> telling app developers what to use?

It might be appropriate to use expand_number() here. This is what some
other tools do as well and consistency between tools is "a nice thing".


Ciao,
Johan


attachment0 (169 bytes) Download Attachment

Re: small usr.bin/find patch

by Matthew Seaman-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Alexander Best wrote:
> hmmm...but dd e.g. uses lowercase instead of upercase letters to indicate
> kilobyte, megabyte and so on. isn't there some unix/posix/whatever standard
> telling app developers what to use?

Sure. The standard for scale-prefixes is defined by the Systeme
Internationale as part of the definition of SI units:

  http://www.npl.co.uk/reference/measurement-units/si-prefixes/

Note that these are strictly powers-of-10^3 multipliers, and explicitly
not the computing style powers-of-2^10 commonly used for file sizes or
hard drive capacities, which should instead use the somewhat clunky Ki,
Mi, Gi etc. forms:

  http://physics.nist.gov/cuu/Units/binary.html

These binary prefixes are mandated by the IEC and approved by the IEEE
amongst others.

Not that many people use the binary prefixes appropriately, relying on
context to disambiguate 1 MB = 1024 KB = 1,048,576 Bytes etc.  Except
that (confusingly) as a measure of network bandwidth 10 Mb/s always was
10,000,000 b/s and never 10,485,760 b/s; a fact that has caught me out
more than a few times.

Making find(1) / dd(1) / etc. operate pedantically correctly with these
scale-factor symbols would cause a certain degree of pain for little
practical gain.  Unless there was a broad consensus amongst all Unixoid
OS providers, I can't see that change ever happening.

        Cheers,

        Matthew

--
Dr Matthew J Seaman MA, D.Phil.                       Flat 3
                                                      7 Priory Courtyard
PGP: http://www.infracaninophile.co.uk/pgpkey         Ramsgate
                                                      Kent, CT11 9PW, UK



signature.asc (267 bytes) Download Attachment

Re: small usr.bin/find patch

by Lars Engels-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Quoting Alexander Best <alexbestms@...>:

> hmmm...but dd e.g. uses lowercase instead of upercase letters to indicate
> kilobyte, megabyte and so on. isn't there some unix/posix/whatever standard
> telling app developers what to use?
>

Actually thats only BSD's dd. GNU dd only accepts uppercase letters.


attachment0 (202 bytes) Download Attachment

Re: small usr.bin/find patch

by Alexander Best :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

wow. thanks a bunch for all the great info.

Matthew Seaman schrieb am 2009-06-24:
> Alexander Best wrote:
> > hmmm...but dd e.g. uses lowercase instead of upercase letters to
> > indicate
> > kilobyte, megabyte and so on. isn't there some unix/posix/whatever
> > standard
> > telling app developers what to use?

> Sure. The standard for scale-prefixes is defined by the Systeme
> Internationale as part of the definition of SI units:

>   http://www.npl.co.uk/reference/measurement-units/si-prefixes/

> Note that these are strictly powers-of-10^3 multipliers, and
> explicitly
> not the computing style powers-of-2^10 commonly used for file sizes
> or
> hard drive capacities, which should instead use the somewhat clunky
> Ki,
> Mi, Gi etc. forms:

>   http://physics.nist.gov/cuu/Units/binary.html

> These binary prefixes are mandated by the IEC and approved by the
> IEEE
> amongst others.

> Not that many people use the binary prefixes appropriately, relying
> on
> context to disambiguate 1 MB = 1024 KB = 1,048,576 Bytes etc.  Except
> that (confusingly) as a measure of network bandwidth 10 Mb/s always
> was
> 10,000,000 b/s and never 10,485,760 b/s; a fact that has caught me
> out
> more than a few times.

> Making find(1) / dd(1) / etc. operate pedantically correctly with
> these
> scale-factor symbols would cause a certain degree of pain for little
> practical gain.  Unless there was a broad consensus amongst all
> Unixoid
> OS providers, I can't see that change ever happening.

>         Cheers,

>         Matthew

_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."