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] Old patch not applied
- Date: Mon, 2 Feb 2004 09:58:45 +0100
I found this patch on ML that was not applied (well... applied
partially):
Index: src/apps/tsql.c
===================================================================
RCS file: /src/twosigma/cvsroot/pub/devel/freetds/src/apps/tsql.c,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -u -u -1 -r1.1.1.3 -r1.2
--- src/apps/tsql.c 10 Oct 2003 21:32:56 -0000 1.1.1.3
+++ src/apps/tsql.c 10 Oct 2003 21:52:13 -0000 1.2
@@ -79,2 +79,4 @@
+static int istty = 0;
+
int do_query(TDSSOCKET * tds, char *buf, int opt_flags);
@@ -86,8 +88,7 @@
-#ifndef HAVE_READLINE
-char *readline(char *prompt);
-void add_history(const char *s);
+char *my_readline(char *prompt);
+void my_add_history(const char *s);
char *
-readline(char *prompt)
+my_readline(char *prompt)
{
@@ -111,5 +112,9 @@
void
-add_history(const char *s)
+my_add_history(const char *s)
{
}
+
+#ifndef HAVE_READLINE
+#define readline my_readline
+#define add_history my_add_history
#endif
@@ -229,2 +234,3 @@
+ *opt_flags = 0;
/* make sure we have enough elements */
@@ -442,3 +448,6 @@
*n = '\0';
- add_history(s);
+ if (istty)
+ add_history(s);
+ else
+ my_add_history(s);
(*line)++;
@@ -465,2 +474,4 @@
+ istty = isatty(0);
+
context = tds_alloc_context();
@@ -496,3 +507,6 @@
free(s);
- s = readline(prompt);
+ if (istty)
+ s = readline(prompt);
+ else
+ s = my_readline(prompt);
if (s != NULL) {
@@ -506,6 +520,6 @@
- if (!s || !strcmp(cmd, "exit") || !strcmp(cmd, "quit")
|| !strcmp(cmd, "bye")) {
+ if (!s || !strcasecmp(cmd, "exit") || !strcasecmp(cmd,
"quit") || !strcasecmp(cmd, "bye")) {
break;
}
- if (!strcmp(cmd, "version")) {
+ if (!strcasecmp(cmd, "version")) {
tds_version(tds, mybuf);
@@ -516,3 +530,3 @@
}
- if (!strncmp(cmd, "go", 2)) {
+ if (!strncasecmp(cmd, "go", 2)) {
line = 0;
@@ -521,6 +535,6 @@
mybuf[0] = '\0';
- } else if (!strcmp(cmd, "reset")) {
+ } else if (!strcasecmp(cmd, "reset")) {
line = 0;
mybuf[0] = '\0';
- } else if (!strcmp(cmd, ":r")) {
+ } else if (!strcasecmp(cmd, ":r")) {
slurp_input_file(strtok(NULL, " \t"), &mybuf,
&bufsz, &line);
@@ -531,3 +545,6 @@
}
- add_history(s);
+ if (istty)
+ add_history(s);
+ else
+ my_add_history(s);
strcat(mybuf, s);
I didn't find any reason why we discard this patch... mainly it detect
tsql on no tty.
freddy77
- [freetds] Old patch not applied, ZIGLIO, Frediano, VF-IT, 02/02/2004
Archive powered by MHonArc 2.6.24.