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

Mike Frysinger vapier.adi at gmail.com
Tue Aug 16 00:00:57 EDT 2011


On Mon, Aug 15, 2011 at 13:27, Brian Norris wrote:
> On Sat, Aug 13, 2011 at 11:10 AM, Mike Frysinger 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 :)

gcc optimizes strlen("constant") into a number
-mike



More information about the linux-mtd mailing list