Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8de482a

Browse files
committed
Added configure test for readline's filename_completion_function
Completed psql's \? help
1 parent3c71ed7 commit8de482a

File tree

9 files changed

+51
-13
lines changed

9 files changed

+51
-13
lines changed

‎src/bin/psql/common.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.18 2000/03/01 21:09:58 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.19 2000/03/05 13:30:19 petere Exp $
77
*/
88
#include"postgres.h"
99
#include"common.h"
@@ -247,6 +247,8 @@ simple_prompt(const char *prompt, int maxlen, bool echo)
247247
PGconn*cancelConn;
248248
volatileboolcancel_pressed;
249249

250+
#ifndefWIN32
251+
250252
#definewrite_stderr(String) write(fileno(stderr), String, strlen(String))
251253

252254
void
@@ -269,7 +271,7 @@ handle_sigint(SIGNAL_ARGS)
269271
write_stderr(PQerrorMessage(cancelConn));
270272
}
271273
}
272-
274+
#endif/* not WIN32 */
273275

274276

275277
/*

‎src/bin/psql/common.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/common.h,v 1.8 2000/03/01 21:09:58 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/common.h,v 1.9 2000/03/05 13:30:19 petere Exp $
77
*/
88
#ifndefCOMMON_H
99
#defineCOMMON_H
@@ -30,7 +30,9 @@ char *simple_prompt(const char *prompt, int maxlen, bool echo);
3030

3131
externvolatileboolcancel_pressed;
3232
externPGconn*cancelConn;
33+
#ifndefWIN32
3334
voidhandle_sigint(SIGNAL_ARGS);
35+
#endif/* not WIN32 */
3436

3537
PGresult*PSQLexec(constchar*query);
3638

‎src/bin/psql/help.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.23 2000/03/01 21:09:58 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.24 2000/03/05 13:30:19 petere Exp $
77
*/
88
#include"postgres.h"
99
#include"help.h"
@@ -183,7 +183,7 @@ slashUsage(void)
183183
if (pset.notty==0&&
184184
(pagerenv=getenv("PAGER"))&&
185185
(pagerenv[0]!='\0')&&
186-
screen_size.ws_row <=36&&
186+
screen_size.ws_row <=39&&
187187
(fout=popen(pagerenv,"w")))
188188
{
189189
usePipe= true;
@@ -195,6 +195,7 @@ slashUsage(void)
195195
fout=stdout;
196196

197197
/* if you add/remove a line here, change the row test above */
198+
fprintf(fout," \\a toggle between unaligned and aligned mode\n");
198199
fprintf(fout," \\c[onnect] [dbname|- [user]]\n"
199200
" connect to new database (currently '%s')\n",PQdb(pset.db));
200201
fprintf(fout," \\copy ... perform SQL COPY with data stream to the client machine\n");
@@ -209,8 +210,11 @@ slashUsage(void)
209210
fprintf(fout," \\e [fname] edit the current query buffer or <fname> with external editor\n");
210211
fprintf(fout," \\echo <text> write text to stdout\n");
211212
fprintf(fout," \\encoding <encoding> set client encoding\n");
213+
fprintf(fout," \\f <sep> change field separator\n");
212214
fprintf(fout," \\g [fname] send query to backend (and results in <fname> or |pipe)\n");
213215
fprintf(fout," \\h [cmd] help on syntax of sql commands, * for all commands\n");
216+
fprintf(fout," \\H toggle HTML mode (currently %s)\n",
217+
ON(pset.popt.topt.format==PRINT_HTML));
214218
fprintf(fout," \\i <fname> read and execute queries from filename\n");
215219
fprintf(fout," \\l list all databases\n");
216220
fprintf(fout," \\lo_export, \\lo_import, \\lo_list, \\lo_unlink\n"
@@ -226,8 +230,8 @@ slashUsage(void)
226230
fprintf(fout," \\set <var> <value> set internal variable\n");
227231
fprintf(fout," \\t don't show table headers or footers (currently %s)\n",ON(pset.popt.topt.tuples_only));
228232
fprintf(fout," \\unset <var> unset (delete) internal variable\n");
229-
fprintf(fout," \\x toggle expanded output (currently %s)\n",ON(pset.popt.topt.expanded));
230233
fprintf(fout," \\w <fname> write current query buffer to a file\n");
234+
fprintf(fout," \\x toggle expanded output (currently %s)\n",ON(pset.popt.topt.expanded));
231235
fprintf(fout," \\z list table access permissions\n");
232236
fprintf(fout," \\! [cmd] shell escape or command\n");
233237

‎src/bin/psql/mainloop.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.23 2000/03/01 21:09:58 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.24 2000/03/05 13:30:19 petere Exp $
77
*/
88
#include"postgres.h"
99
#include"mainloop.h"
@@ -92,6 +92,7 @@ MainLoop(FILE *source)
9292
/* main loop to get queries and execute them */
9393
while (1)
9494
{
95+
#ifndefWIN32
9596
/*
9697
* Welcome code for Control-C
9798
*/
@@ -133,7 +134,7 @@ MainLoop(FILE *source)
133134
break;
134135
}
135136
}
136-
137+
#endif/* not WIN32 */
137138

138139
if (slashCmdStatus==CMD_NEWEDIT)
139140
{

‎src/bin/psql/tab-complete.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.14 2000/02/20 14:28:20 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.15 2000/03/05 13:30:19 petere Exp $
77
*/
88

99
/*-----------
@@ -50,6 +50,10 @@
5050
#include"common.h"
5151
#include"settings.h"
5252

53+
#if defined(HAVE_FILENAME_COMPLETION_FUNCTION)&& !defined(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
54+
char*filename_completion_function (char*,int);
55+
#endif
56+
5357
#defineBUF_SIZE 2048
5458
#defineERROR_QUERY_TOO_LONG/* empty */
5559

@@ -532,7 +536,15 @@ char ** psql_completion(char *text, int start, int end)
532536
strcmp(prev_wd,"\\s")==0||
533537
strcmp(prev_wd,"\\w")==0||strcmp(prev_wd,"\\write")==0
534538
) {
539+
#ifdefHAVE_FILENAME_COMPLETION_FUNCTION
535540
matches=completion_matches(text,filename_completion_function);
541+
#else
542+
/*
543+
* This will probably have the same effect, but you never know what
544+
* the heck some readline incarnation out there is going to do.
545+
*/
546+
matches=NULL;
547+
#endif
536548
}
537549

538550

‎src/bin/psql/tab-complete.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.h,v 1.3 2000/01/29 16:58:49 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.h,v 1.4 2000/03/05 13:30:19 petere Exp $
77
*/
88
#ifndefTAB_COMPLETE_H
99
#defineTAB_COMPLETE_H
1010

11+
#include"postgres.h"
12+
1113
voidinitialize_readline(void);
1214

1315
#endif

‎src/configure.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,18 @@ AC_EGREP_HEADER(rl_completion_append_character, readline.h,
846846
AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER))])
847847
AC_SUBST(HAVE_RL_COMPLETION_APPEND_CHARACTER)
848848

849+
dnl Check for readline's filename_completion_function.
850+
dnl Some versions have it but it's not in the headers, so we have to take
851+
dnl care of that, too.
852+
AC_CHECK_FUNCS(filename_completion_function,
853+
AC_EGREP_HEADER(filename_completion_function, readline.h,
854+
AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL),
855+
[AC_EGREP_HEADER(filename_completion_function, readline/readline.h,
856+
AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL))])
857+
)
858+
AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION)
859+
AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
860+
849861
dnl Check for GNU style long options support (getopt_long)
850862
AC_CHECK_FUNCS(getopt_long)
851863

‎src/include/config.h.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,12 @@ extern void srandom(unsigned int seed);
468468
/* Set to 1 if your libreadline defines rl_completion_append_character */
469469
#undef HAVE_RL_COMPLETION_APPEND_CHARACTER
470470

471+
/* Set to 1 if your libreadline has filename_completion_function */
472+
#undef HAVE_FILENAME_COMPLETION_FUNCTION
473+
474+
/* Set to 1 if your readline headers actually declare the above */
475+
#undef HAVE_FILENAME_COMPLETION_FUNCTION_DECL
476+
471477
/* Set to 1 if you have getopt_long() (GNU long options) */
472478
#undef HAVE_GETOPT_LONG
473479

‎src/include/port/win.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,3 @@ typedef unsigned char slock_t;
1414
#if (CYGWIN_VERSION_API_MAJOR >=0)&& (CYGWIN_VERSION_API_MINOR >=8)
1515
#definesys_nerr _sys_nerr
1616
#endif
17-
18-
/* not exported in readline.h */
19-
char*filename_completion_function();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp