Skip to Content.
Sympa Menu

freetds - [freetds] getopt reset fix

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: christos AT zoulas.com (Christos Zoulas)
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] getopt reset fix
  • Date: Mon, 30 Nov 2009 15:09:31 -0500

Hello,

The options reset code seems to be busted. On systems that have optreset,
you need to set optreset = 1 and optind = 1 to properly restart parsing
options, for systems that don't, you need to only set optind = 0. To
duplicate

(echo select 1 && echo go) | tsql -o qh

The -o part will try to use getopt to parse the options and fail...

christos

Index: tsql.c
===================================================================
RCS file: freetds/src/apps/tsql.c,v
retrieving revision 1.15
diff -u -u -r1.15 tsql.c
--- tsql.c 17 Jun 2009 18:49:14 -0000 1.15
+++ tsql.c 30 Nov 2009 20:05:11 -0000
@@ -313,8 +313,10 @@
{
#ifdef HAVE_GETOPT_OPTRESET
optreset = 1;
-#endif
optind = 1;
+#else
+ optind = 0;
+#endif
}

/*



  • [freetds] getopt reset fix, Christos Zoulas, 11/30/2009

Archive powered by MHonArc 2.6.24.

Top of Page