All of lore.kernel.org
 help / color / mirror / Atom feed
* argv[optind-1] == optarg
@ 2004-05-22 18:44 Ozgur Akan
  2004-05-24  5:26 ` Ozgur Akan
  2004-05-25 19:24 ` Henrik Nordstrom
  0 siblings, 2 replies; 4+ messages in thread
From: Ozgur Akan @ 2004-05-22 18:44 UTC (permalink / raw)
  To: netfilter-devel@lists.netfilter.org

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-05-26 13:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-22 18:44 argv[optind-1] == optarg Ozgur Akan
2004-05-24  5:26 ` Ozgur Akan
2004-05-25 19:24 ` Henrik Nordstrom
2004-05-26 13:00   ` Ozgur Akan

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.