diff options
| author | Peter Eisentraut | 2000-03-05 13:30:20 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2000-03-05 13:30:20 +0000 |
| commit | 8de482a8479eef200e184ce308bf3f40eac3215b (patch) | |
| tree | d987e8242b1fe545b0bcbd986cb518a157540a6d /src/bin/psql | |
| parent | 3c71ed7e72680ad5cde765978b98bd34bb58089a (diff) | |
Added configure test for readline's filename_completion_function
Completed psql's \? help
Diffstat (limited to 'src/bin/psql')
| -rw-r--r-- | src/bin/psql/common.c | 6 | ||||
| -rw-r--r-- | src/bin/psql/common.h | 4 | ||||
| -rw-r--r-- | src/bin/psql/help.c | 10 | ||||
| -rw-r--r-- | src/bin/psql/mainloop.c | 5 | ||||
| -rw-r--r-- | src/bin/psql/tab-complete.c | 14 | ||||
| -rw-r--r-- | src/bin/psql/tab-complete.h | 4 |
6 files changed, 33 insertions, 10 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 30e0cb5473e..fbf6950ffd3 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.18 2000/03/01 21:09:58 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.19 2000/03/05 13:30:19 petere Exp $ */ #include "postgres.h" #include "common.h" @@ -247,6 +247,8 @@ simple_prompt(const char *prompt, int maxlen, bool echo) PGconn *cancelConn; volatile bool cancel_pressed; +#ifndef WIN32 + #define write_stderr(String) write(fileno(stderr), String, strlen(String)) void @@ -269,7 +271,7 @@ handle_sigint(SIGNAL_ARGS) write_stderr(PQerrorMessage(cancelConn)); } } - +#endif /* not WIN32 */ /* diff --git a/src/bin/psql/common.h b/src/bin/psql/common.h index 96c8a799489..2f343e425a6 100644 --- a/src/bin/psql/common.h +++ b/src/bin/psql/common.h @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/common.h,v 1.8 2000/03/01 21:09:58 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/common.h,v 1.9 2000/03/05 13:30:19 petere Exp $ */ #ifndef COMMON_H #define COMMON_H @@ -30,7 +30,9 @@ char * simple_prompt(const char *prompt, int maxlen, bool echo); extern volatile bool cancel_pressed; extern PGconn *cancelConn; +#ifndef WIN32 void handle_sigint(SIGNAL_ARGS); +#endif /* not WIN32 */ PGresult * PSQLexec(const char *query); diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index 33c187bdb2a..a1bff8a31b1 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.23 2000/03/01 21:09:58 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.24 2000/03/05 13:30:19 petere Exp $ */ #include "postgres.h" #include "help.h" @@ -183,7 +183,7 @@ slashUsage(void) if (pset.notty == 0 && (pagerenv = getenv("PAGER")) && (pagerenv[0] != '\0') && - screen_size.ws_row <= 36 && + screen_size.ws_row <= 39 && (fout = popen(pagerenv, "w"))) { usePipe = true; @@ -195,6 +195,7 @@ slashUsage(void) fout = stdout; /* if you add/remove a line here, change the row test above */ + fprintf(fout, " \\a toggle between unaligned and aligned mode\n"); fprintf(fout, " \\c[onnect] [dbname|- [user]]\n" " connect to new database (currently '%s')\n", PQdb(pset.db)); fprintf(fout, " \\copy ... perform SQL COPY with data stream to the client machine\n"); @@ -209,8 +210,11 @@ slashUsage(void) fprintf(fout, " \\e [fname] edit the current query buffer or <fname> with external editor\n"); fprintf(fout, " \\echo <text> write text to stdout\n"); fprintf(fout, " \\encoding <encoding> set client encoding\n"); + fprintf(fout, " \\f <sep> change field separator\n"); fprintf(fout, " \\g [fname] send query to backend (and results in <fname> or |pipe)\n"); fprintf(fout, " \\h [cmd] help on syntax of sql commands, * for all commands\n"); + fprintf(fout, " \\H toggle HTML mode (currently %s)\n", + ON(pset.popt.topt.format==PRINT_HTML)); fprintf(fout, " \\i <fname> read and execute queries from filename\n"); fprintf(fout, " \\l list all databases\n"); fprintf(fout, " \\lo_export, \\lo_import, \\lo_list, \\lo_unlink\n" @@ -226,8 +230,8 @@ slashUsage(void) fprintf(fout, " \\set <var> <value> set internal variable\n"); fprintf(fout, " \\t don't show table headers or footers (currently %s)\n", ON(pset.popt.topt.tuples_only)); fprintf(fout, " \\unset <var> unset (delete) internal variable\n"); - fprintf(fout, " \\x toggle expanded output (currently %s)\n", ON(pset.popt.topt.expanded)); fprintf(fout, " \\w <fname> write current query buffer to a file\n"); + fprintf(fout, " \\x toggle expanded output (currently %s)\n", ON(pset.popt.topt.expanded)); fprintf(fout, " \\z list table access permissions\n"); fprintf(fout, " \\! [cmd] shell escape or command\n"); diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c index 4c5c7c55858..4bd4608e5ce 100644 --- a/src/bin/psql/mainloop.c +++ b/src/bin/psql/mainloop.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.23 2000/03/01 21:09:58 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.24 2000/03/05 13:30:19 petere Exp $ */ #include "postgres.h" #include "mainloop.h" @@ -92,6 +92,7 @@ MainLoop(FILE *source) /* main loop to get queries and execute them */ while (1) { +#ifndef WIN32 /* * Welcome code for Control-C */ @@ -133,7 +134,7 @@ MainLoop(FILE *source) break; } } - +#endif /* not WIN32 */ if (slashCmdStatus == CMD_NEWEDIT) { diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 9edfc6b6da8..54561cb3778 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.14 2000/02/20 14:28:20 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.15 2000/03/05 13:30:19 petere Exp $ */ /*----------- @@ -50,6 +50,10 @@ #include "common.h" #include "settings.h" +#if defined(HAVE_FILENAME_COMPLETION_FUNCTION) && !defined(HAVE_FILENAME_COMPLETION_FUNCTION_DECL) +char * filename_completion_function (char *, int); +#endif + #define BUF_SIZE 2048 #define ERROR_QUERY_TOO_LONG /* empty */ @@ -532,7 +536,15 @@ char ** psql_completion(char *text, int start, int end) strcmp(prev_wd, "\\s")==0 || strcmp(prev_wd, "\\w")==0 || strcmp(prev_wd, "\\write")==0 ) { +#ifdef HAVE_FILENAME_COMPLETION_FUNCTION matches = completion_matches(text, filename_completion_function); +#else + /* + * This will probably have the same effect, but you never know what + * the heck some readline incarnation out there is going to do. + */ + matches = NULL; +#endif } diff --git a/src/bin/psql/tab-complete.h b/src/bin/psql/tab-complete.h index 8c54cffeb64..c7d44bd2f07 100644 --- a/src/bin/psql/tab-complete.h +++ b/src/bin/psql/tab-complete.h @@ -3,11 +3,13 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.h,v 1.3 2000/01/29 16:58:49 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.h,v 1.4 2000/03/05 13:30:19 petere Exp $ */ #ifndef TAB_COMPLETE_H #define TAB_COMPLETE_H +#include "postgres.h" + void initialize_readline(void); #endif |
