projects
/
platform
/
upstream
/
bash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported from ../bash-3.1.tar.gz.
[platform/upstream/bash.git]
/
pcomplete.c
diff --git
a/pcomplete.c
b/pcomplete.c
index
2462bd6
..
ee462dc
100644
(file)
--- a/
pcomplete.c
+++ b/
pcomplete.c
@@
-1,7
+1,7
@@
/* pcomplete.c - functions to generate lists of matches for programmable
completion. */
/* pcomplete.c - functions to generate lists of matches for programmable
completion. */
-/* Copyright (C) 1999-200
4
Free Software Foundation, Inc.
+/* Copyright (C) 1999-200
5
Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
This file is part of GNU Bash, the Bourne Again SHell.
@@
-513,20
+513,22
@@
it_init_joblist (itp, jstate)
register int i;
register PROCESS *p;
char *s, *t;
register int i;
register PROCESS *p;
char *s, *t;
- JOB_STATE js;
+ JOB *j;
+ JOB_STATE ws; /* wanted state */
if (jstate == 0)
if (jstate == 0)
-
j
s = JRUNNING;
+
w
s = JRUNNING;
else if (jstate == 1)
else if (jstate == 1)
-
j
s = JSTOPPED;
+
w
s = JSTOPPED;
- sl = strlist_create (j
ob_
slots);
- for (i = j
ob_
slots - 1; i >= 0; i--)
+ sl = strlist_create (j
s.j_job
slots);
+ for (i = j
s.j_job
slots - 1; i >= 0; i--)
{
{
- if (jobs[i] == 0)
+ j = get_job_by_jid (i);
+ if (j == 0)
continue;
continue;
- p = j
obs[i]
->pipe;
- if (jstate == -1 || JOBSTATE(i) ==
j
s)
+ p = j->pipe;
+ if (jstate == -1 || JOBSTATE(i) ==
w
s)
{
s = savestring (p->command);
t = strpbrk (s, " \t\n");
{
s = savestring (p->command);
t = strpbrk (s, " \t\n");
@@
-843,6
+845,7
@@
gen_wordlist_matches (cs, text)
}
sl->list[sl->list_len = nw] = (char *)NULL;
}
sl->list[sl->list_len = nw] = (char *)NULL;
+ dispose_words (l2);
FREE (ntxt);
return sl;
}
FREE (ntxt);
return sl;
}
@@
-862,7
+865,7
@@
bind_comp_words (lwords)
VUNSETATTR (v, att_readonly);
if (array_p (v) == 0)
v = convert_var_to_array (v);
VUNSETATTR (v, att_readonly);
if (array_p (v) == 0)
v = convert_var_to_array (v);
- v = assign_array_var_from_word_list (v, lwords);
+ v = assign_array_var_from_word_list (v, lwords
, 0
);
VUNSETATTR (v, att_invisible);
return v;
VUNSETATTR (v, att_invisible);
return v;
@@
-882,7
+885,7
@@
bind_compfunc_variables (line, ind, lwords, cw, exported)
/* Set the variables that the function expects while it executes. Maybe
these should be in the function environment (temporary_env). */
/* Set the variables that the function expects while it executes. Maybe
these should be in the function environment (temporary_env). */
- v = bind_variable ("COMP_LINE", line);
+ v = bind_variable ("COMP_LINE", line
, 0
);
if (v && exported)
VSETATTR(v, att_exported);
if (v && exported)
VSETATTR(v, att_exported);
@@
-987,6
+990,7
@@
gen_shell_function_matches (cs, text, line, ind, lwords, nw, cw)
SHELL_VAR *f, *v;
WORD_LIST *cmdlist;
int fval;
SHELL_VAR *f, *v;
WORD_LIST *cmdlist;
int fval;
+ sh_parser_state_t ps;
#if defined (ARRAY_VARS)
ARRAY *a;
#endif
#if defined (ARRAY_VARS)
ARRAY *a;
#endif
@@
-1010,8
+1014,10
@@
gen_shell_function_matches (cs, text, line, ind, lwords, nw, cw)
bind_compfunc_variables (line, ind, lwords, cw - 1, 0);
cmdlist = build_arg_list (funcname, text, lwords, cw);
bind_compfunc_variables (line, ind, lwords, cw - 1, 0);
cmdlist = build_arg_list (funcname, text, lwords, cw);
-
+
+ save_parser_state (&ps);
fval = execute_shell_function (f, cmdlist);
fval = execute_shell_function (f, cmdlist);
+ restore_parser_state (&ps);
/* Now clean up and destroy everything. */
dispose_words (cmdlist);
/* Now clean up and destroy everything. */
dispose_words (cmdlist);