3
3
*
4
4
* Copyright 2000-2002 by PostgreSQL Global Development Group
5
5
*
6
- * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.75 2003/03/28 16:34:50 momjian Exp $
6
+ * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.76 2003/04/03 20:18:16 tgl Exp $
7
7
*/
8
8
9
9
/*----------------------------------------------------------------------
@@ -67,7 +67,7 @@ extern char *filename_completion_function();
67
67
#endif
68
68
69
69
#ifdef HAVE_RL_COMPLETION_MATCHES
70
- #define completion_matches ( x , y ) rl_completion_matches((x), ((rl_compentry_func_t *)(y)))
70
+ #define completion_matches rl_completion_matches
71
71
#endif
72
72
73
73
#define BUF_SIZE 2048
@@ -76,12 +76,13 @@ extern char *filename_completion_function();
76
76
77
77
/* Forward declaration of functions */
78
78
static char * * psql_completion (char * text ,int start ,int end );
79
- static char * create_command_generator (char * text ,int state );
80
- static char * complete_from_query (char * text ,int state );
81
- static char * complete_from_schema_query (char * text ,int state );
82
- static char * _complete_from_query (int is_schema_query ,char * text ,int state );
83
- static char * complete_from_const (char * text ,int state );
84
- static char * complete_from_list (char * text ,int state );
79
+ static char * create_command_generator (const char * text ,int state );
80
+ static char * complete_from_query (const char * text ,int state );
81
+ static char * complete_from_schema_query (const char * text ,int state );
82
+ static char * _complete_from_query (int is_schema_query ,
83
+ const char * text ,int state );
84
+ static char * complete_from_const (const char * text ,int state );
85
+ static char * complete_from_list (const char * text ,int state );
85
86
86
87
static PGresult * exec_query (char * query );
87
88
char * quote_file_name (char * text ,int match_type ,char * quote_pointer );
@@ -1357,7 +1358,7 @@ psql_completion(char *text, int start, int end)
1357
1358
as defined above.
1358
1359
*/
1359
1360
static char *
1360
- create_command_generator (char * text ,int state )
1361
+ create_command_generator (const char * text ,int state )
1361
1362
{
1362
1363
static int list_index ,
1363
1364
string_length ;
@@ -1383,13 +1384,13 @@ create_command_generator(char *text, int state)
1383
1384
/* The following two functions are wrappers for _complete_from_query */
1384
1385
1385
1386
static char *
1386
- complete_from_query (char * text ,int state )
1387
+ complete_from_query (const char * text ,int state )
1387
1388
{
1388
1389
return _complete_from_query (0 ,text ,state );
1389
1390
}
1390
1391
1391
1392
static char *
1392
- complete_from_schema_query (char * text ,int state )
1393
+ complete_from_schema_query (const char * text ,int state )
1393
1394
{
1394
1395
return _complete_from_query (1 ,text ,state );
1395
1396
}
@@ -1412,7 +1413,7 @@ complete_from_schema_query(char *text, int state)
1412
1413
*/
1413
1414
1414
1415
static char *
1415
- _complete_from_query (int is_schema_query ,char * text ,int state )
1416
+ _complete_from_query (int is_schema_query ,const char * text ,int state )
1416
1417
{
1417
1418
static int list_index ,
1418
1419
string_length ;
@@ -1421,7 +1422,7 @@ _complete_from_query(int is_schema_query, char *text, int state)
1421
1422
const char * item ;
1422
1423
1423
1424
/*
1424
- * If thisist the first time for this completion, we fetch a list of
1425
+ * If thisis the first time for this completion, we fetch a list of
1425
1426
* our "things" from the backend.
1426
1427
*/
1427
1428
if (state == 0 )
@@ -1471,7 +1472,7 @@ _complete_from_query(int is_schema_query, char *text, int state)
1471
1472
SQL words that can appear at certain spot.
1472
1473
*/
1473
1474
static char *
1474
- complete_from_list (char * text ,int state )
1475
+ complete_from_list (const char * text ,int state )
1475
1476
{
1476
1477
static int string_length ,
1477
1478
list_index ,
@@ -1531,7 +1532,7 @@ complete_from_list(char *text, int state)
1531
1532
The string to be passed must be in completion_charp.
1532
1533
*/
1533
1534
static char *
1534
- complete_from_const (char * text ,int state )
1535
+ complete_from_const (const char * text ,int state )
1535
1536
{
1536
1537
(void )text ;/* We don't care about what was entered
1537
1538
* already. */