From: Ozgur Akan <akan@aiqa.com>
To: "netfilter-devel@lists.netfilter.org"
<netfilter-devel@lists.netfilter.org>
Subject: argv[optind-1] == optarg
Date: Sat, 22 May 2004 21:44:41 +0300 [thread overview]
Message-ID: <40AF9F99.7070305@aiqa.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 656 bytes --]
Hi,
I think using optarg instead of argv[optind-1] will be better. In
iptables.c; while parsing iptables options with getopt_long,
argv[optind-1] is used in 8 places.
optarg (option argument) gives us the value of the option we are
parsing. So when we do something with the argument of (for example) A
option the easiest way to get the value of A`s argument is using optarg.
optarg is designed to be used with getopt_long.
Using optind (option index) is more tricky because optind starts from 1
and when we are parsing an option with an index of value n of argv array
it shows n+2. That`s why we substract 1 from optind.
best wishes,
Ozgur Akan
[-- Attachment #2: Type: text/html, Size: 1117 bytes --]
next reply other threads:[~2004-05-22 18:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-22 18:44 Ozgur Akan [this message]
2004-05-24 5:26 ` argv[optind-1] == optarg Ozgur Akan
2004-05-25 19:24 ` Henrik Nordstrom
2004-05-26 13:00 ` Ozgur Akan
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=40AF9F99.7070305@aiqa.com \
--to=akan@aiqa.com \
--cc=netfilter-devel@lists.netfilter.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.