[ccan] [PATCH] make ccan/opt accept k, M suffixes for long-destined options

Douglas Bagnall douglas at paradise.net.nz
Thu Apr 28 12:31:54 EST 2011


You perhaps don't want this one in, at least in its current state.

It makes ccan/opt accept 'k' and 'M' suffixes for arguments destined
to be stored in long or unsigned long integers.  That is, these all do
the same thing:

$ foo -x 5M
$ foo -x $((5 * 1024 * 1024))
$ foo -x 5242880
$ foo -x 5120k

Some reasons not to want it are that it assumes 'k' means 1024, when
1000 might be more useful in general; and that it comes with
absolutely no tests (or documentation).

OTOH, it is really useful if you are dealing with big numbers on the
command line and hate counting digits.

I can do tests and documentation if you like the idea.

Douglas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0029-make-ccan-opt-accept-k-M-suffixes-for-long-destined-.patch
Type: text/x-patch
Size: 1486 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/ccan/attachments/20110428/fdd357b8/attachment.bin>


More information about the ccan mailing list