getopt reset fix
[email protected] (Christos Zoulas)
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Organization | Astron Software |
| Message-ID | <[email protected]> |
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
}
/*