version 1.11, 2003/08/07 16:44:32 |
version 1.12, 2009/02/17 21:34:26 |
Line 132 prompt_end(EditLine *el __attribute__((_ |
|
Line 132 prompt_end(EditLine *el __attribute__((_ |
|
* Install a prompt printing function |
* Install a prompt printing function |
*/ |
*/ |
protected int |
protected int |
prompt_set(EditLine *el, el_pfunc_t prf, int op) |
prompt_set(EditLine *el, el_pfunc_t prf, void *arg, int op) |
{ |
{ |
el_prompt_t *p; |
el_prompt_t *p; |
|
|
Line 140 prompt_set(EditLine *el, el_pfunc_t prf, |
|
Line 140 prompt_set(EditLine *el, el_pfunc_t prf, |
|
p = &el->el_prompt; |
p = &el->el_prompt; |
else |
else |
p = &el->el_rprompt; |
p = &el->el_rprompt; |
|
|
if (prf == NULL) { |
if (prf == NULL) { |
if (op == EL_PROMPT) |
if (op == EL_PROMPT) |
p->p_func = prompt_default; |
p->p_func = prompt_default; |
else |
else |
p->p_func = prompt_default_r; |
p->p_func = prompt_default_r; |
} else |
p->p_arg = NULL; |
|
} else { |
p->p_func = prf; |
p->p_func = prf; |
|
p->p_arg = arg; |
|
} |
|
|
p->p_pos.v = 0; |
p->p_pos.v = 0; |
p->p_pos.h = 0; |
p->p_pos.h = 0; |
return (0); |
return (0); |
Line 157 prompt_set(EditLine *el, el_pfunc_t prf, |
|
Line 162 prompt_set(EditLine *el, el_pfunc_t prf, |
|
* Retrieve the prompt printing function |
* Retrieve the prompt printing function |
*/ |
*/ |
protected int |
protected int |
prompt_get(EditLine *el, el_pfunc_t *prf, int op) |
prompt_get(EditLine *el, el_pfunc_t *prf, void **arg, int op) |
{ |
{ |
|
el_prompt_t *p; |
|
|
if (prf == NULL) |
if (prf == NULL) |
return (-1); |
return (-1); |
|
|
if (op == EL_PROMPT) |
if (op == EL_PROMPT) |
*prf = el->el_prompt.p_func; |
p = &el->el_prompt; |
else |
else |
*prf = el->el_rprompt.p_func; |
p = &el->el_rprompt; |
|
|
|
*prf = p->p_func; |
|
|
|
if (arg) |
|
*arg = p->p_arg; |
return (0); |
return (0); |
} |
} |