All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 1/3] iptables: fix error reporting with wrong/missing arguments
Date: Wed, 19 Nov 2008 11:05:04 +0100	[thread overview]
Message-ID: <4923E4D0.6020003@netfilter.org> (raw)
In-Reply-To: <alpine.LNX.1.10.0811191027340.30388@fbirervta.pbzchgretzou.qr>

Jan Engelhardt wrote:
> On Wednesday 2008-11-19 00:43, Pablo Neira Ayuso wrote:
>> @@ -1888,9 +1888,26 @@ int do_command6(int argc, char *argv[], char **table, ip6tc_handle_t *handle)
>> 					continue;
>> 				}
>>
>> -				if (!m)
>> +				if (!m) {
>> +					if (c == '?') {
>> +						if (optopt) {
>> +							exit_error(
>> +							   PARAMETER_PROBLEM,
>> +							   "option `%s' "
>> +							   "requires an "
>> +							   "argument",
>> +							   argv[optind-1]);
>> +						} else {
>> +							exit_error(
>> +							   PARAMETER_PROBLEM,
>> +							   "unknown option "
>> +							   "`%s'",
>> +							   argv[optind-1]);
>> +						}
>> +					}
>> 					exit_error(PARAMETER_PROBLEM,
>> 						   "Unknown arg `%s'", optarg);
>> +				}
> 
> I think it is time to give attention to CodingStyle section 1:
> 
> 	“The answer to that is that if you need more than 3 levels of
> 	indentation, you're screwed anyway, and should fix your
> 	program.”
> 
> Maybe this could be put into a separate function somehow than trying
> to squeeze everything between colums 64 and 80?

Putting this code into a function will not make any better for the whole
section of code under the "default" tag in the switch - which is indeed
already horrible as it looks like a real Spanish chorizo [1].

Of course, you are free to send a patch to cleanup not only this part,
but the whole default section of the switch. I'd be please to apply it.

[1] http://en.wikipedia.org/wiki/Chorizo

-- 
"Los honestos son inadaptados sociales" -- Les Luthiers
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2008-11-19 10:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-18 23:43 [PATCH 1/3] iptables: fix error reporting with wrong/missing arguments Pablo Neira Ayuso
2008-11-18 23:43 ` [PATCH 2/3] state: report spaces in the state list parsing Pablo Neira Ayuso
2008-11-19  9:29   ` Jan Engelhardt
2008-11-19 10:11     ` Pablo Neira Ayuso
2008-11-18 23:44 ` [PATCH 3/3] iptables: refer to dmesg when we hit error Pablo Neira Ayuso
2008-11-19  9:28 ` [PATCH 1/3] iptables: fix error reporting with wrong/missing arguments Jan Engelhardt
2008-11-19 10:05   ` Pablo Neira Ayuso [this message]

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=4923E4D0.6020003@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=jengelh@medozas.de \
    --cc=netfilter-devel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.