[PATCH v3 5/5] mtdinfo: consolidate help as display_help()

Brian Norris computersforpeace at gmail.com
Mon Aug 15 13:27:13 EDT 2011


On Sat, Aug 13, 2011 at 11:10 AM, Mike Frysinger <vapier.adi at gmail.com> wrote:
> On Fri, Aug 12, 2011 at 12:37, Brian Norris wrote:
...
>> "mtdinfo"). I suppose we could either hardcode the spaces in or try to
>> do some sort of "ARRAY_SIZE" trickery (as found in the Linux kernel)
>
> you could probably use %*s and then pass in "" as well as <some max
> spacing number - strlen(PROGRAM_NAME)>.
>
> printf("%*s\n", 80 - strlen(PROGRAM_NAME), "");

Yes, that's what I meant...of course "strlen" is better than writing
your own ARRAY_SIZE() when you already have the full C library :)

But I'm not sure about the subtraction part. Perhaps just use the
length as extra indentation...I'll send a patch to make it clear!

Brian

"Someday, you might find yourself accidentally using printk() instead
of printf() in your user-space code. When that day comes, you can say
you are a true kernel hacker."
        --Robert Love, Linux Kernel Development



More information about the linux-mtd mailing list