Changeset: 7378903c7bd9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7378903c7bd9
Modified Files:
clients/mapiclient/ReadlineTools.c
Branch: default
Log Message:
Merge with Feb2013 branch.
diffs (76 lines):
diff --git a/clients/mapiclient/ReadlineTools.c
b/clients/mapiclient/ReadlineTools.c
--- a/clients/mapiclient/ReadlineTools.c
+++ b/clients/mapiclient/ReadlineTools.c
@@ -228,7 +228,7 @@ static char *mal_commands[] = {
static int
mal_help(int cnt, int key)
{
- char *name, *c, buf[BUFSIZ];
+ char *name, *c, buf[512];
int seekpos = 0, rowcount;
MapiHdl table_hdl;
@@ -240,7 +240,7 @@ mal_help(int cnt, int key)
c--;
while (c > rl_line_buffer && !isspace(*c))
c--;
- snprintf(buf, BUFSIZ, "manual.help(\"%s\");", c);
+ snprintf(buf, sizeof(buf), "manual.help(\"%s\");", c);
if ((table_hdl = mapi_query(_mid, buf)) == NULL || mapi_error(_mid)) {
if (table_hdl) {
mapi_explain_query(table_hdl, stderr);
@@ -271,7 +271,7 @@ mal_command_generator(const char *text,
static int idx;
static int seekpos, len, rowcount;
static MapiHdl table_hdl;
- char *name, buf[BUFSIZ];
+ char *name, buf[512];
/* we pick our own portion of the linebuffer */
text = rl_line_buffer + strlen(rl_line_buffer) - 1;
@@ -295,20 +295,19 @@ mal_command_generator(const char *text,
}
/* try the server to answer */
if (!state) {
- char cmd[BUFSIZ], *c;
+ char *c;
c = strstr(text, ":=");
if (c)
text = c + 2;
while (isspace((int) *text))
text++;
- c = strchr(text, '.');
- if (c == NULL)
- snprintf(cmd, BUFSIZ, "%s.*(", text);
+ if (strchr(text, '.') == NULL)
+ snprintf(buf, sizeof(buf),
+ "manual.completion(\"%s.*(\");", text);
else
- snprintf(cmd, BUFSIZ, "%s(", text);
+ snprintf(buf, sizeof(buf),
+ "manual.completion(\"%s(\");", text);
seekpos = 0;
- len = strlen(cmd);
- snprintf(buf, BUFSIZ, "manual.completion(\"%s\");", cmd);
if ((table_hdl = mapi_query(_mid, buf)) == NULL ||
mapi_error(_mid)) {
if (table_hdl) {
mapi_explain_query(table_hdl, stderr);
@@ -365,7 +364,8 @@ init_readline(Mapi mid, char *lang, int
_mid = mid;
/* Allow conditional parsing of the ~/.inputrc file. */
rl_readline_name = "MapiClient";
- /* Tell the completer that we want to try our own completion before std
completion (filename) kicks in. */
+ /* Tell the completer that we want to try our own completion
+ * before std completion (filename) kicks in. */
if (strcmp(language, "sql") == 0) {
rl_attempted_completion_function = sql_completion;
} else if (strcmp(language, "mil") == 0) {
@@ -401,7 +401,7 @@ init_readline(Mapi mid, char *lang, int
case ENOENT:
/* history file didn't exist, so try to create
* it and then try again */
- if ((f = fopen(_history_file, "w")) != NULL) {
+ if ((f = fopen(_history_file, "w")) == NULL) {
/* failed to create, don't
* bother saving */
_save_history = 0;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list