*** ./src/bin/psql/input.c.orig 2005-01-07 03:29:09.000000000 +0900 --- ./src/bin/psql/input.c 2005-10-14 17:03:48.000000000 +0900 *************** *** 88,101 **** #ifdef USE_READLINE char *s; - static char *prev_hist = NULL; - if (useReadline) /* On some platforms, readline is declared as readline(char *) */ s = readline((char *) prompt); else s = gets_basic(prompt); if (useHistory && s && s[0]) { enum histcontrol HC; --- 88,110 ---- #ifdef USE_READLINE char *s; if (useReadline) /* On some platforms, readline is declared as readline(char *) */ s = readline((char *) prompt); else s = gets_basic(prompt); + return s; + #else + return gets_basic(prompt); + #endif + } + + void + saveCommandHistory(char *s) + { + static char *prev_hist = NULL; + #ifdef USE_READLINE if (useHistory && s && s[0]) { enum histcontrol HC; *************** *** 114,123 **** add_history(s); } } - - return s; - #else - return gets_basic(prompt); #endif } --- 123,128 ---- *** ./src/bin/psql/input.h.orig 2005-10-14 16:50:14.000000000 +0900 --- ./src/bin/psql/input.h 2005-10-14 16:50:07.000000000 +0900 *************** *** 38,42 **** --- 38,43 ---- void initializeInput(int flags); bool saveHistory(char *fname); + void saveCommandHistory(char *s); #endif /* INPUT_H */ *** ./src/bin/psql/mainloop.c.orig 2005-01-01 14:43:08.000000000 +0900 --- ./src/bin/psql/mainloop.c 2005-10-14 17:02:59.000000000 +0900 *************** *** 232,237 **** --- 232,241 ---- (scan_result == PSCAN_EOL && GetVariableBool(pset.vars, "SINGLELINE"))) { + #ifdef USE_READLINE + saveCommandHistory(query_buf->data); + #endif + /* execute query */ success = SendQuery(query_buf->data); slashCmdStatus = success ? CMD_SEND : CMD_ERROR;