Subject: Re: RFC: /kern/summary
To: Ignatios Souvatzis <is@jocelyn.rhein.de>
From: Brian C. Grayson <bgrayson@marvin.ece.utexas.edu>
List: tech-kern
Date: 03/11/1999 08:34:19
On Thu, Mar 11, 1999 at 01:11:59PM +0100, Ignatios Souvatzis wrote:
> On Wed, Mar 10, 1999 at 03:59:29PM -0600, Brian C. Grayson wrote:
> > 
> >   This could definitely be done.  If we want to keep it
> > source-able by sh, though, all padding will have to be done at
> > the end of a line,
> 
> no, it wouldn't necessarily...
> 
> > which means sprintf won't cut it.
> 
> oh yes, it would.
> 
> Try printf("MemorySize=%09d\n", 345)  for numbers, or
>     printf("TheKernelName=%20s\n", "unknown") for strings.

  If that last one is changed to %-20 (sh doesn't like "var= val"),
and people don't mind 0-padded numbers, then yes this is
source-able by sh.  Oops -- one can specify %-7d for 32-bit
numbers, and get blank-padded on the right.  So sprintf can do it
all, after all.

  If I end up going this way (versus Jukka's ideas), though,
I'd probably write up several mini-routines for printing, for
efficiency reasons (if benchmarking shows that they are
sufficiently faster than the general-case-handling sprintf), in
which case it would be trivial to add right-padding of numbers
and strings.

  Brian