Re: why was the VAR 'optind' never changed in initdb?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Clover White <mywhiteclover(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: why was the VAR 'optind' never changed in initdb?
Date: 2012-04-09 13:30:19
Message-ID: CA+TgmoZwD9QacF2_gM0rjxj2m6AdArnEhkvr5C5vB3Jp30UqJw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 9, 2012 at 7:38 AM, Clover White <mywhiteclover(at)gmail(dot)com> wrote:
> Hi,
>   I'm debugging initdb using gdb.
>   I found that I could not step in the function getopt_long in line 2572 in
> initdb.c.
>   I also found that the value of VAR optind never be changed. VAR optind is
> always equal to 1 but how could optind be larger than the value of argc(the
> value of argc is 6) in line 2648 and 2654.

Read the man page for getopt_long. It changes the global variable optind.

It's a silly interface, but also a long and hallowed UNIX tradition,
so we're stuck with it.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Condor 2012-04-09 13:32:30 Re: [streaming replication] 9.1.3 streaming replication bug ?
Previous Message Robert Haas 2012-04-09 13:25:36 Re: Last gasp