freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "James K. Lowden" <jklowden AT freetds.org>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] getopt compatibility
- Date: Mon, 26 May 2008 11:36:05 -0400
ZIGLIO, Frediano, VF-IT wrote:
> In tsql
> getopt is restarted to read options. It's currently restarted using GNU
> getopt way, that is setting optind with 0. However under *BSD there is a
> optreset to reset status. However I mainly got problems with HP-UX
> getopt... as you can read from
> http://docs.hp.com/en/B2355-60105/getopt.3C.html getopt get reset with 1
> as optind. ... From HP-UX manual it seems also that behavior
> of this getopt implementation is quite different as from my
> understanding it stops reading parameters at the first no-options one...
> How to fix this problem??
Hi Freddy,
Looking at the code, I think the most portable choice -- and probably the
least work -- is to refactor tsql.c: call getopt(3) in only one place, and
don't reset optind/optreset.
(Curiously, I use tsql on NetBSD and have never noticed any problem.
Maybe that's because of the sequence I usually put the options in.)
I think refactoring is best because otherwise you need an autoconf test
for behavior (testing for HP/UX isn't the Right Thing) and a tds_getopt
with a bunch of #define macros. It would look like src/tds/net.c. :-(
Besides, the code will be easier to understand when all the options are
parsed in one place.
Regards,
--jkl
-
[freetds] getopt compatibility,
ZIGLIO, Frediano, VF-IT, 05/26/2008
-
Re: [freetds] getopt compatibility,
James K. Lowden, 05/26/2008
-
Re: [freetds] getopt compatibility,
ZIGLIO, Frediano, VF-IT, 05/27/2008
-
Re: [freetds] getopt compatibility,
James K. Lowden, 05/27/2008
-
Re: [freetds] getopt compatibility,
ZIGLIO, Frediano, VF-IT, 05/27/2008
- Re: [freetds] getopt compatibility, ZIGLIO, Frediano, VF-IT, 05/27/2008
-
Re: [freetds] getopt compatibility,
James K. Lowden, 05/27/2008
- Re: [freetds] getopt compatibility, Christos Zoulas, 05/27/2008
-
Re: [freetds] getopt compatibility,
ZIGLIO, Frediano, VF-IT, 05/28/2008
- Re: [freetds] getopt compatibility, James K. Lowden, 05/28/2008
-
Re: [freetds] getopt compatibility,
ZIGLIO, Frediano, VF-IT, 05/27/2008
-
Re: [freetds] getopt compatibility,
James K. Lowden, 05/27/2008
-
Re: [freetds] getopt compatibility,
ZIGLIO, Frediano, VF-IT, 05/27/2008
-
Re: [freetds] getopt compatibility,
James K. Lowden, 05/26/2008
Archive powered by MHonArc 2.6.24.