freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
- To: <freetds AT lists.ibiblio.org>
- Subject: [freetds] getopt compatibility
- Date: Mon, 26 May 2008 16:45:01 +0200
Hi,
I found a portability problem using getopt in src/apps/tsql.c. 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. This cause options to not get readed. I tried to write a
small test under Linux (which should use GNU getopt) and initial optind
is 1. It seems that initial value of optind is 1 however to correctly
restart getopt you have to set optind to 0 (there are some additional
status variable to reset). 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??
- try to detect HP-UX and reset optind with 1?
- use GNU getopt library under HP-UX?
- do not use getopt in get_opt_flags function cause it just support only
parameters without arguments?
- reset optind to 0 and set argv[0] to argv[1] (I have still to test
this cheat..) ?
Frediano
-
[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.