mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-06 03:40:50 +02:00
second set of ANSI C changes: C89-style function declarations, more inline functions, remove register keyword
This commit is contained in:
+92
-184
@@ -1,6 +1,6 @@
|
||||
/* pcomplete.c - functions to generate lists of matches for programmable completion. */
|
||||
|
||||
/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1999-2022 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -79,71 +79,69 @@
|
||||
typedef SHELL_VAR **SVFUNC ();
|
||||
|
||||
#ifndef HAVE_STRPBRK
|
||||
extern char *strpbrk PARAMS((char *, char *));
|
||||
extern char *strpbrk (char *, char *);
|
||||
#endif
|
||||
|
||||
extern STRING_INT_ALIST word_token_alist[];
|
||||
extern char *signal_names[];
|
||||
|
||||
#if defined (DEBUG)
|
||||
#if defined (PREFER_STDARG)
|
||||
static void debug_printf (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
|
||||
#endif
|
||||
#endif /* DEBUG */
|
||||
|
||||
static int it_init_joblist PARAMS((ITEMLIST *, int));
|
||||
static int it_init_joblist (ITEMLIST *, int);
|
||||
|
||||
static int it_init_aliases PARAMS((ITEMLIST *));
|
||||
static int it_init_arrayvars PARAMS((ITEMLIST *));
|
||||
static int it_init_bindings PARAMS((ITEMLIST *));
|
||||
static int it_init_builtins PARAMS((ITEMLIST *));
|
||||
static int it_init_disabled PARAMS((ITEMLIST *));
|
||||
static int it_init_enabled PARAMS((ITEMLIST *));
|
||||
static int it_init_exported PARAMS((ITEMLIST *));
|
||||
static int it_init_functions PARAMS((ITEMLIST *));
|
||||
static int it_init_helptopics PARAMS((ITEMLIST *));
|
||||
static int it_init_hostnames PARAMS((ITEMLIST *));
|
||||
static int it_init_jobs PARAMS((ITEMLIST *));
|
||||
static int it_init_running PARAMS((ITEMLIST *));
|
||||
static int it_init_stopped PARAMS((ITEMLIST *));
|
||||
static int it_init_keywords PARAMS((ITEMLIST *));
|
||||
static int it_init_signals PARAMS((ITEMLIST *));
|
||||
static int it_init_variables PARAMS((ITEMLIST *));
|
||||
static int it_init_setopts PARAMS((ITEMLIST *));
|
||||
static int it_init_shopts PARAMS((ITEMLIST *));
|
||||
static int it_init_aliases (ITEMLIST *);
|
||||
static int it_init_arrayvars (ITEMLIST *);
|
||||
static int it_init_bindings (ITEMLIST *);
|
||||
static int it_init_builtins (ITEMLIST *);
|
||||
static int it_init_disabled (ITEMLIST *);
|
||||
static int it_init_enabled (ITEMLIST *);
|
||||
static int it_init_exported (ITEMLIST *);
|
||||
static int it_init_functions (ITEMLIST *);
|
||||
static int it_init_helptopics (ITEMLIST *);
|
||||
static int it_init_hostnames (ITEMLIST *);
|
||||
static int it_init_jobs (ITEMLIST *);
|
||||
static int it_init_running (ITEMLIST *);
|
||||
static int it_init_stopped (ITEMLIST *);
|
||||
static int it_init_keywords (ITEMLIST *);
|
||||
static int it_init_signals (ITEMLIST *);
|
||||
static int it_init_variables (ITEMLIST *);
|
||||
static int it_init_setopts (ITEMLIST *);
|
||||
static int it_init_shopts (ITEMLIST *);
|
||||
|
||||
static int shouldexp_filterpat PARAMS((char *));
|
||||
static char *preproc_filterpat PARAMS((char *, const char *));
|
||||
static int shouldexp_filterpat (char *);
|
||||
static char *preproc_filterpat (char *, const char *);
|
||||
|
||||
static void init_itemlist_from_varlist PARAMS((ITEMLIST *, SVFUNC *));
|
||||
static void init_itemlist_from_varlist (ITEMLIST *, SVFUNC *);
|
||||
|
||||
static STRINGLIST *gen_matches_from_itemlist PARAMS((ITEMLIST *, const char *));
|
||||
static STRINGLIST *gen_action_completions PARAMS((COMPSPEC *, const char *));
|
||||
static STRINGLIST *gen_globpat_matches PARAMS((COMPSPEC *, const char *));
|
||||
static STRINGLIST *gen_wordlist_matches PARAMS((COMPSPEC *, const char *));
|
||||
static STRINGLIST *gen_shell_function_matches PARAMS((COMPSPEC *, const char *,
|
||||
static STRINGLIST *gen_matches_from_itemlist (ITEMLIST *, const char *);
|
||||
static STRINGLIST *gen_action_completions (COMPSPEC *, const char *);
|
||||
static STRINGLIST *gen_globpat_matches (COMPSPEC *, const char *);
|
||||
static STRINGLIST *gen_wordlist_matches (COMPSPEC *, const char *);
|
||||
static STRINGLIST *gen_shell_function_matches (COMPSPEC *, const char *,
|
||||
const char *,
|
||||
char *, int, WORD_LIST *,
|
||||
int, int, int *));
|
||||
static STRINGLIST *gen_command_matches PARAMS((COMPSPEC *, const char *,
|
||||
int, int, int *);
|
||||
static STRINGLIST *gen_command_matches (COMPSPEC *, const char *,
|
||||
const char *,
|
||||
char *, int, WORD_LIST *,
|
||||
int, int));
|
||||
int, int);
|
||||
|
||||
static STRINGLIST *gen_progcomp_completions PARAMS((const char *, const char *,
|
||||
static STRINGLIST *gen_progcomp_completions (const char *, const char *,
|
||||
const char *,
|
||||
int, int, int *, int *,
|
||||
COMPSPEC **));
|
||||
COMPSPEC **);
|
||||
|
||||
static char *pcomp_filename_completion_function PARAMS((const char *, int));
|
||||
static char *pcomp_filename_completion_function (const char *, int);
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
static SHELL_VAR *bind_comp_words PARAMS((WORD_LIST *));
|
||||
static SHELL_VAR *bind_comp_words (WORD_LIST *);
|
||||
#endif
|
||||
static void bind_compfunc_variables PARAMS((char *, int, WORD_LIST *, int, int));
|
||||
static void unbind_compfunc_variables PARAMS((int));
|
||||
static WORD_LIST *build_arg_list PARAMS((char *, const char *, const char *, WORD_LIST *, int));
|
||||
static WORD_LIST *command_line_to_word_list PARAMS((char *, int, int, int *, int *));
|
||||
static void bind_compfunc_variables (char *, int, WORD_LIST *, int, int);
|
||||
static void unbind_compfunc_variables (int);
|
||||
static WORD_LIST *build_arg_list (char *, const char *, const char *, WORD_LIST *, int);
|
||||
static WORD_LIST *command_line_to_word_list (char *, int, int, int *, int *);
|
||||
|
||||
static int compgen_compspec = 0; /* are we generating completions for compgen? */
|
||||
|
||||
@@ -193,13 +191,7 @@ int pcomp_ind;
|
||||
#ifdef DEBUG
|
||||
/* Debugging code */
|
||||
static void
|
||||
#if defined (PREFER_STDARG)
|
||||
debug_printf (const char *format, ...)
|
||||
#else
|
||||
debug_printf (format, va_alist)
|
||||
const char *format;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
|
||||
@@ -221,15 +213,13 @@ debug_printf (format, va_alist)
|
||||
/* Functions to manage the item lists */
|
||||
|
||||
void
|
||||
set_itemlist_dirty (it)
|
||||
ITEMLIST *it;
|
||||
set_itemlist_dirty (ITEMLIST *it)
|
||||
{
|
||||
it->flags |= LIST_DIRTY;
|
||||
}
|
||||
|
||||
void
|
||||
initialize_itemlist (itp)
|
||||
ITEMLIST *itp;
|
||||
initialize_itemlist (ITEMLIST *itp)
|
||||
{
|
||||
(*itp->list_getter) (itp);
|
||||
itp->flags |= LIST_INITIALIZED;
|
||||
@@ -237,8 +227,7 @@ initialize_itemlist (itp)
|
||||
}
|
||||
|
||||
void
|
||||
clean_itemlist (itp)
|
||||
ITEMLIST *itp;
|
||||
clean_itemlist (ITEMLIST *itp)
|
||||
{
|
||||
STRINGLIST *sl;
|
||||
|
||||
@@ -255,10 +244,8 @@ clean_itemlist (itp)
|
||||
itp->flags &= ~(LIST_DONTFREE|LIST_DONTFREEMEMBERS|LIST_INITIALIZED|LIST_DIRTY);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
shouldexp_filterpat (s)
|
||||
char *s;
|
||||
shouldexp_filterpat (char *s)
|
||||
{
|
||||
register char *p;
|
||||
|
||||
@@ -276,9 +263,7 @@ shouldexp_filterpat (s)
|
||||
quote a `&' and inhibit substitution. Returns a new string. This just
|
||||
calls stringlib.c:strcreplace(). */
|
||||
static char *
|
||||
preproc_filterpat (pat, text)
|
||||
char *pat;
|
||||
const char *text;
|
||||
preproc_filterpat (char *pat, const char *text)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
@@ -292,10 +277,7 @@ preproc_filterpat (pat, text)
|
||||
a new STRINGLIST with the matching members of SL *copied*. Any
|
||||
non-matching members of SL->list are *freed*. */
|
||||
STRINGLIST *
|
||||
filter_stringlist (sl, filterpat, text)
|
||||
STRINGLIST *sl;
|
||||
char *filterpat;
|
||||
const char *text;
|
||||
filter_stringlist (STRINGLIST *sl, char *filterpat, const char *text)
|
||||
{
|
||||
int i, m, not;
|
||||
STRINGLIST *ret;
|
||||
@@ -334,8 +316,7 @@ filter_stringlist (sl, filterpat, text)
|
||||
This understands how rl_completion_matches sets matches[0] (the lcd of the
|
||||
strings in the list, unless it's the only match). */
|
||||
STRINGLIST *
|
||||
completions_to_stringlist (matches)
|
||||
char **matches;
|
||||
completions_to_stringlist (char **matches)
|
||||
{
|
||||
STRINGLIST *sl;
|
||||
int mlen, i, n;
|
||||
@@ -365,8 +346,7 @@ completions_to_stringlist (matches)
|
||||
The caller is responsible for setting ITP->flags correctly. */
|
||||
|
||||
static int
|
||||
it_init_aliases (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_aliases (ITEMLIST *itp)
|
||||
{
|
||||
#ifdef ALIAS
|
||||
alias_t **alias_list;
|
||||
@@ -395,9 +375,7 @@ it_init_aliases (itp)
|
||||
}
|
||||
|
||||
static void
|
||||
init_itemlist_from_varlist (itp, svfunc)
|
||||
ITEMLIST *itp;
|
||||
SVFUNC *svfunc;
|
||||
init_itemlist_from_varlist (ITEMLIST *itp, SVFUNC *svfunc)
|
||||
{
|
||||
SHELL_VAR **vlist;
|
||||
STRINGLIST *sl;
|
||||
@@ -420,8 +398,7 @@ init_itemlist_from_varlist (itp, svfunc)
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_arrayvars (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_arrayvars (ITEMLIST *itp)
|
||||
{
|
||||
#if defined (ARRAY_VARS)
|
||||
init_itemlist_from_varlist (itp, all_array_variables);
|
||||
@@ -432,8 +409,7 @@ it_init_arrayvars (itp)
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_bindings (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_bindings (ITEMLIST *itp)
|
||||
{
|
||||
char **blist;
|
||||
STRINGLIST *sl;
|
||||
@@ -451,8 +427,7 @@ it_init_bindings (itp)
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_builtins (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_builtins (ITEMLIST *itp)
|
||||
{
|
||||
STRINGLIST *sl;
|
||||
register int i, n;
|
||||
@@ -468,8 +443,7 @@ it_init_builtins (itp)
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_enabled (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_enabled (ITEMLIST *itp)
|
||||
{
|
||||
STRINGLIST *sl;
|
||||
register int i, n;
|
||||
@@ -487,8 +461,7 @@ it_init_enabled (itp)
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_disabled (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_disabled (ITEMLIST *itp)
|
||||
{
|
||||
STRINGLIST *sl;
|
||||
register int i, n;
|
||||
@@ -506,16 +479,14 @@ it_init_disabled (itp)
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_exported (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_exported (ITEMLIST *itp)
|
||||
{
|
||||
init_itemlist_from_varlist (itp, all_exported_variables);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_functions (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_functions (ITEMLIST *itp)
|
||||
{
|
||||
init_itemlist_from_varlist (itp, all_visible_functions);
|
||||
return 0;
|
||||
@@ -524,8 +495,7 @@ it_init_functions (itp)
|
||||
/* Like it_init_builtins, but includes everything the help builtin looks at,
|
||||
not just builtins with an active implementing function. */
|
||||
static int
|
||||
it_init_helptopics (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_helptopics (ITEMLIST *itp)
|
||||
{
|
||||
STRINGLIST *sl;
|
||||
register int i, n;
|
||||
@@ -540,8 +510,7 @@ it_init_helptopics (itp)
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_hostnames (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_hostnames (ITEMLIST *itp)
|
||||
{
|
||||
STRINGLIST *sl;
|
||||
|
||||
@@ -555,9 +524,7 @@ it_init_hostnames (itp)
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_joblist (itp, jstate)
|
||||
ITEMLIST *itp;
|
||||
int jstate;
|
||||
it_init_joblist (ITEMLIST *itp, int jstate)
|
||||
{
|
||||
#if defined (JOB_CONTROL)
|
||||
STRINGLIST *sl;
|
||||
@@ -597,29 +564,25 @@ it_init_joblist (itp, jstate)
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_jobs (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_jobs (ITEMLIST *itp)
|
||||
{
|
||||
return (it_init_joblist (itp, -1));
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_running (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_running (ITEMLIST *itp)
|
||||
{
|
||||
return (it_init_joblist (itp, 0));
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_stopped (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_stopped (ITEMLIST *itp)
|
||||
{
|
||||
return (it_init_joblist (itp, 1));
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_keywords (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_keywords (ITEMLIST *itp)
|
||||
{
|
||||
STRINGLIST *sl;
|
||||
register int i, n;
|
||||
@@ -636,8 +599,7 @@ it_init_keywords (itp)
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_signals (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_signals (ITEMLIST *itp)
|
||||
{
|
||||
STRINGLIST *sl;
|
||||
|
||||
@@ -650,16 +612,14 @@ it_init_signals (itp)
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_variables (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_variables (ITEMLIST *itp)
|
||||
{
|
||||
init_itemlist_from_varlist (itp, all_visible_variables);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_setopts (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_setopts (ITEMLIST *itp)
|
||||
{
|
||||
STRINGLIST *sl;
|
||||
|
||||
@@ -672,8 +632,7 @@ it_init_setopts (itp)
|
||||
}
|
||||
|
||||
static int
|
||||
it_init_shopts (itp)
|
||||
ITEMLIST *itp;
|
||||
it_init_shopts (ITEMLIST *itp)
|
||||
{
|
||||
STRINGLIST *sl;
|
||||
|
||||
@@ -691,9 +650,7 @@ it_init_shopts (itp)
|
||||
new one before trying the match. TEXT is dequoted before attempting a
|
||||
match. */
|
||||
static STRINGLIST *
|
||||
gen_matches_from_itemlist (itp, text)
|
||||
ITEMLIST *itp;
|
||||
const char *text;
|
||||
gen_matches_from_itemlist (ITEMLIST *itp, const char *text)
|
||||
{
|
||||
STRINGLIST *ret, *sl;
|
||||
int tlen, i, n;
|
||||
@@ -729,9 +686,7 @@ gen_matches_from_itemlist (itp, text)
|
||||
/* A wrapper for rl_filename_completion_function that dequotes the filename
|
||||
before attempting completions. */
|
||||
static char *
|
||||
pcomp_filename_completion_function (text, state)
|
||||
const char *text;
|
||||
int state;
|
||||
pcomp_filename_completion_function (const char *text, int state)
|
||||
{
|
||||
static char *dfn; /* dequoted filename */
|
||||
int iscompgen, iscompleting;
|
||||
@@ -825,9 +780,7 @@ pcomp_filename_completion_function (text, state)
|
||||
/* Functions to generate lists of matches from the actions member of CS. */
|
||||
|
||||
static STRINGLIST *
|
||||
gen_action_completions (cs, text)
|
||||
COMPSPEC *cs;
|
||||
const char *text;
|
||||
gen_action_completions (COMPSPEC *cs, const char *text)
|
||||
{
|
||||
STRINGLIST *ret, *tmatches;
|
||||
char **cmatches; /* from rl_completion_matches ... */
|
||||
@@ -889,9 +842,7 @@ gen_action_completions (cs, text)
|
||||
to use TEXT, we should call quote_string_for_globbing before the call to
|
||||
glob_filename (in which case we could use shell_glob_filename). */
|
||||
static STRINGLIST *
|
||||
gen_globpat_matches (cs, text)
|
||||
COMPSPEC *cs;
|
||||
const char *text;
|
||||
gen_globpat_matches (COMPSPEC *cs, const char *text)
|
||||
{
|
||||
STRINGLIST *sl;
|
||||
int gflags;
|
||||
@@ -909,9 +860,7 @@ gen_globpat_matches (cs, text)
|
||||
/* Perform the shell word expansions on CS->words and return the results.
|
||||
Again, this ignores TEXT. */
|
||||
static STRINGLIST *
|
||||
gen_wordlist_matches (cs, text)
|
||||
COMPSPEC *cs;
|
||||
const char *text;
|
||||
gen_wordlist_matches (COMPSPEC *cs, const char *text)
|
||||
{
|
||||
WORD_LIST *l, *l2;
|
||||
STRINGLIST *sl;
|
||||
@@ -956,8 +905,7 @@ gen_wordlist_matches (cs, text)
|
||||
#ifdef ARRAY_VARS
|
||||
|
||||
static SHELL_VAR *
|
||||
bind_comp_words (lwords)
|
||||
WORD_LIST *lwords;
|
||||
bind_comp_words (WORD_LIST *lwords)
|
||||
{
|
||||
SHELL_VAR *v;
|
||||
|
||||
@@ -980,11 +928,7 @@ bind_comp_words (lwords)
|
||||
#endif /* ARRAY_VARS */
|
||||
|
||||
static void
|
||||
bind_compfunc_variables (line, ind, lwords, cw, exported)
|
||||
char *line;
|
||||
int ind;
|
||||
WORD_LIST *lwords;
|
||||
int cw, exported;
|
||||
bind_compfunc_variables (char *line, int ind, WORD_LIST *lwords, int cw, int exported)
|
||||
{
|
||||
char ibuf[INT_STRLEN_BOUND(int) + 1];
|
||||
char *value;
|
||||
@@ -1033,8 +977,7 @@ bind_compfunc_variables (line, ind, lwords, cw, exported)
|
||||
}
|
||||
|
||||
static void
|
||||
unbind_compfunc_variables (exported)
|
||||
int exported;
|
||||
unbind_compfunc_variables (int exported)
|
||||
{
|
||||
unbind_variable_noref ("COMP_LINE");
|
||||
unbind_variable_noref ("COMP_POINT");
|
||||
@@ -1061,12 +1004,7 @@ unbind_compfunc_variables (exported)
|
||||
make do with the COMP_LINE and COMP_POINT variables. */
|
||||
|
||||
static WORD_LIST *
|
||||
build_arg_list (cmd, cname, text, lwords, ind)
|
||||
char *cmd;
|
||||
const char *cname;
|
||||
const char *text;
|
||||
WORD_LIST *lwords;
|
||||
int ind;
|
||||
build_arg_list (char *cmd, const char *cname, const char *text, WORD_LIST *lwords, int ind)
|
||||
{
|
||||
WORD_LIST *ret, *cl, *l;
|
||||
WORD_DESC *w;
|
||||
@@ -1105,15 +1043,9 @@ build_arg_list (cmd, cname, text, lwords, ind)
|
||||
variable, this does nothing if arrays are not compiled into the shell. */
|
||||
|
||||
static STRINGLIST *
|
||||
gen_shell_function_matches (cs, cmd, text, line, ind, lwords, nw, cw, foundp)
|
||||
COMPSPEC *cs;
|
||||
const char *cmd;
|
||||
const char *text;
|
||||
char *line;
|
||||
int ind;
|
||||
WORD_LIST *lwords;
|
||||
int nw, cw;
|
||||
int *foundp;
|
||||
gen_shell_function_matches (COMPSPEC *cs, const char *cmd, const char *text,
|
||||
char *line, int ind, WORD_LIST *lwords,
|
||||
int nw, int cw, int *foundp)
|
||||
{
|
||||
char *funcname;
|
||||
STRINGLIST *sl;
|
||||
@@ -1221,14 +1153,9 @@ gen_shell_function_matches (cs, cmd, text, line, ind, lwords, nw, cw, foundp)
|
||||
STRINGLIST from the results and return it. */
|
||||
|
||||
static STRINGLIST *
|
||||
gen_command_matches (cs, cmd, text, line, ind, lwords, nw, cw)
|
||||
COMPSPEC *cs;
|
||||
const char *cmd;
|
||||
const char *text;
|
||||
char *line;
|
||||
int ind;
|
||||
WORD_LIST *lwords;
|
||||
int nw, cw;
|
||||
gen_command_matches (COMPSPEC *cs, const char *cmd, const char *text,
|
||||
char *line, int ind, WORD_LIST *lwords,
|
||||
int nw, int cw)
|
||||
{
|
||||
char *csbuf, *cscmd, *t;
|
||||
int cmdlen, cmdsize, n, ws, we;
|
||||
@@ -1307,18 +1234,12 @@ gen_command_matches (cs, cmd, text, line, ind, lwords, nw, cw)
|
||||
}
|
||||
|
||||
static WORD_LIST *
|
||||
command_line_to_word_list (line, llen, sentinel, nwp, cwp)
|
||||
char *line;
|
||||
int llen, sentinel, *nwp, *cwp;
|
||||
command_line_to_word_list (char *line, int llen, int sentinel, int *nwp, int *cwp)
|
||||
{
|
||||
WORD_LIST *ret;
|
||||
const char *delims;
|
||||
|
||||
#if 0
|
||||
delims = "()<>;&| \t\n"; /* shell metacharacters break words */
|
||||
#else
|
||||
delims = rl_completer_word_break_characters;
|
||||
#endif
|
||||
ret = split_at_delims (line, llen, delims, sentinel, SD_NOQUOTEDELIM|SD_COMPLETE, nwp, cwp);
|
||||
return (ret);
|
||||
}
|
||||
@@ -1326,12 +1247,8 @@ command_line_to_word_list (line, llen, sentinel, nwp, cwp)
|
||||
/* Evaluate COMPSPEC *cs and return all matches for WORD. */
|
||||
|
||||
STRINGLIST *
|
||||
gen_compspec_completions (cs, cmd, word, start, end, foundp)
|
||||
COMPSPEC *cs;
|
||||
const char *cmd;
|
||||
const char *word;
|
||||
int start, end;
|
||||
int *foundp;
|
||||
gen_compspec_completions (COMPSPEC *cs, const char *cmd, const char *word,
|
||||
int start, int end, int *foundp)
|
||||
{
|
||||
STRINGLIST *ret, *tmatches;
|
||||
char *line;
|
||||
@@ -1536,8 +1453,7 @@ gen_compspec_completions (cs, cmd, word, start, end, foundp)
|
||||
}
|
||||
|
||||
void
|
||||
pcomp_set_readline_variables (flags, nval)
|
||||
int flags, nval;
|
||||
pcomp_set_readline_variables (int flags, int nval)
|
||||
{
|
||||
/* If the user specified that the compspec returns filenames, make
|
||||
sure that readline knows it. */
|
||||
@@ -1557,9 +1473,7 @@ pcomp_set_readline_variables (flags, nval)
|
||||
/* Set or unset FLAGS in the options word of the current compspec.
|
||||
SET_OR_UNSET is 1 for setting, 0 for unsetting. */
|
||||
void
|
||||
pcomp_set_compspec_options (cs, flags, set_or_unset)
|
||||
COMPSPEC *cs;
|
||||
int flags, set_or_unset;
|
||||
pcomp_set_compspec_options (COMPSPEC *cs, int flags, int set_or_unset)
|
||||
{
|
||||
if (cs == 0 && ((cs = pcomp_curcs) == 0))
|
||||
return;
|
||||
@@ -1570,13 +1484,9 @@ pcomp_set_compspec_options (cs, flags, set_or_unset)
|
||||
}
|
||||
|
||||
static STRINGLIST *
|
||||
gen_progcomp_completions (ocmd, cmd, word, start, end, foundp, retryp, lastcs)
|
||||
const char *ocmd;
|
||||
const char *cmd;
|
||||
const char *word;
|
||||
int start, end;
|
||||
int *foundp, *retryp;
|
||||
COMPSPEC **lastcs;
|
||||
gen_progcomp_completions (const char *ocmd, const char *cmd, const char *word,
|
||||
int start, int end, int *foundp, int *retryp,
|
||||
COMPSPEC **lastcs)
|
||||
{
|
||||
COMPSPEC *cs, *oldcs;
|
||||
const char *oldcmd, *oldtxt;
|
||||
@@ -1635,10 +1545,8 @@ gen_progcomp_completions (ocmd, cmd, word, start, end, foundp, retryp, lastcs)
|
||||
bound the command currently being completed in pcomp_line (usually
|
||||
rl_line_buffer). */
|
||||
char **
|
||||
programmable_completions (cmd, word, start, end, foundp)
|
||||
const char *cmd;
|
||||
const char *word;
|
||||
int start, end, *foundp;
|
||||
programmable_completions (const char *cmd, const char *word,
|
||||
int start, int end, int *foundp)
|
||||
{
|
||||
COMPSPEC *lastcs;
|
||||
STRINGLIST *ret;
|
||||
|
||||
Reference in New Issue
Block a user