cvs commit: src/usr.bin/ipcs ipcs.c
Giorgos Keramidas
keramida at ceid.upatras.gr
Tue Mar 8 17:11:40 GMT 2005
On 2005-03-08 09:05, John-Mark Gurney <gurney_j at resnet.uoregon.edu> wrote:
>Giorgos Keramidas wrote this message on Tue, Mar 08, 2005 at 15:20 +0200:
>>On 2005-03-08 13:14, Giorgos Keramidas <keramida at freebsd.org> wrote:
>>> Use 12 columns for (int) values, 20 columns for (long) and align
>>> headers properly (right justified for numbers, left justified for
>>> everything else).
>>
>> If anyone has a good idea for making the columns widths dynamically
>> adjustable, please do so :-)
>
> Yes, you can use a * instead of hard coding the widths, and then provide
> an integer on the printf line for the width... so:
> int foo, bar;
> int foowidth, barwidth;
>
> foowidth = barwidth = 8;
> foo = 0xa9201;
> bar = 0xab29023;
> printf("foo: %*d,\tbar: %*d\n", foowidth, foo, barwidth, bar);
Yes, that's a great idea. It will greatly simplify the formatting code
and make it easier to change _all_ the instances of variables that have
the same size to a new width.
:-)
More information about the cvs-src
mailing list