[PATCH v3 5/5] mtdinfo: consolidate help as display_help()
Mike Frysinger
vapier.adi at gmail.com
Sat Aug 13 14:10:46 EDT 2011
On Fri, Aug 12, 2011 at 12:37, Brian Norris wrote:
> On Fri, Aug 12, 2011 at 12:06 AM, Brian Foster wrote:
>>> + "Examples:\n"
>>> + " %1$s /dev/mtd0 print information MTD device /dev/mtd0\n"
>>> + " %1$s /dev/mtd0 -u print information MTD device /dev/mtd0\n"
>>> + "\t\t\t\tand include UBI layout information\n"
>>
>> Any reason this line, and only this line,
>> uses tabs (\t) for formatting whilst every
>> other line uses spaces? (FWIW, I prefer
>> spaces, but more importantly think there
>> should be some consistency.)
>
> Yes, sort of. It's used to be because we "don't know" the length of
> the "%1$s" strings (i.e., the PROGRAM_NAME macro, which here is just
> "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)
> to find the length of PROGRAM_NAME. I'll see how the second option
> works (for a potential v4 patch?) unless someone objects.
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), "");
-mike
More information about the linux-mtd
mailing list