public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Brian Foster <brian.foster@maxim-ic.com>
To: Mike Frysinger <vapier.adi@gmail.com>
Cc: Brian Norris <computersforpeace@gmail.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	Artem Bityutskiy <dedekind1@gmail.com>
Subject: Re: [PATCH v3 5/5] mtdinfo: consolidate help as display_help()
Date: Tue, 16 Aug 2011 09:18:15 +0200	[thread overview]
Message-ID: <201108160918.15975.brian.foster@maxim-ic.com> (raw)
In-Reply-To: <CAMjpGUcNqGkbTQUX9Lq+B+gSN8TUySs=p_kxZE4TQn1amwk2ow@mail.gmail.com>

On Tuesday 16 August 2011 06:00:57 Mike Frysinger wrote:
> 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

 And ‘ARRAY_SIZE(...)’, in this case, is simply ‘sizeof(...)’
 (or, actually, ‘sizeof(...)-1’ to be equivalent to ‘strlen’).

 Albeit I won't worry about the case of  strlen > 80  here,
 I am mildly curious what the output would be if that were
 indeed true...?

 The other thing I won't worry about is the assumption every
 output byte in PROGRAM_NAME is a printing glyph occupying
 exactly one cell.  That is true (in this case) ....

cheers!
	-blf-
-- 
Brian FOSTER
Principal MTS, Software
Maxim Integrated Products (Microcontroller BU), formerly Innova Card
Web    : http://www.maxim-ic.com/

  reply	other threads:[~2011-08-16  7:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-09 21:36 [PATCH v2 0/5] bugfix, cleanup for mtdinfo Brian Norris
2011-08-09 21:36 ` [PATCH v2 1/5] mtdinfo: don't open NULL pointer when getting region_info with `-a' Brian Norris
2011-08-11  4:31   ` Mike Frysinger
2011-08-09 21:36 ` [PATCH v2 2/5] mtdinfo: refactor code to remove "args.all" dependency Brian Norris
2011-08-11  4:33   ` Mike Frysinger
2011-08-09 21:36 ` [PATCH v2 3/5] mtdinfo: restructure help message Brian Norris
2011-08-11  4:33   ` Mike Frysinger
2011-08-09 21:36 ` [PATCH v2 4/5] mtdinfo: fixup "example usage" help section Brian Norris
2011-08-11  4:33   ` Mike Frysinger
2011-08-09 21:36 ` [PATCH v2 5/5] mtdinfo: consolidate help as display_help() Brian Norris
2011-08-11  4:33   ` Mike Frysinger
2011-08-11 16:19     ` [PATCH v3 " Brian Norris
2011-08-11 17:15       ` Mike Frysinger
2011-08-12  7:06       ` Brian Foster
2011-08-12 16:37         ` Brian Norris
2011-08-13 18:10           ` Mike Frysinger
2011-08-15 17:27             ` Brian Norris
2011-08-16  4:00               ` Mike Frysinger
2011-08-16  7:18                 ` Brian Foster [this message]
2011-08-16 17:12                   ` Brian Norris
2011-08-17  8:02                     ` Brian Foster
2011-08-15 20:17       ` [PATCH v4 " Brian Norris
2011-08-16 14:15 ` [PATCH v2 0/5] bugfix, cleanup for mtdinfo Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201108160918.15975.brian.foster@maxim-ic.com \
    --to=brian.foster@maxim-ic.com \
    --cc=computersforpeace@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=vapier.adi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox