Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libedit/prompt.c,v rcsdiff: /ftp/cvs/cvsroot/src/lib/libedit/prompt.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.11.40.1 retrieving revision 1.12 diff -u -p -r1.11.40.1 -r1.12 --- src/lib/libedit/prompt.c 2009/05/13 19:18:29 1.11.40.1 +++ src/lib/libedit/prompt.c 2009/02/17 21:34:26 1.12 @@ -1,4 +1,4 @@ -/* $NetBSD: prompt.c,v 1.11.40.1 2009/05/13 19:18:29 jym Exp $ */ +/* $NetBSD: prompt.c,v 1.12 2009/02/17 21:34:26 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)prompt.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: prompt.c,v 1.11.40.1 2009/05/13 19:18:29 jym Exp $"); +__RCSID("$NetBSD: prompt.c,v 1.12 2009/02/17 21:34:26 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -87,23 +87,14 @@ prompt_print(EditLine *el, int op) { el_prompt_t *elp; char *p; - int ignore = 0; if (op == EL_PROMPT) elp = &el->el_prompt; else elp = &el->el_rprompt; - - for (p = (*elp->p_func)(el); *p; p++) { - if (elp->p_ignore == *p) { - ignore = !ignore; - continue; - } - if (ignore) - term__putc(el, *p); - else - re_putc(el, *p, 1); - } + p = (elp->p_func) (el); + while (*p) + re_putc(el, *p++, 1); elp->p_pos.v = el->el_refresh.r_cursor.v; elp->p_pos.h = el->el_refresh.r_cursor.h; @@ -120,12 +111,10 @@ prompt_init(EditLine *el) el->el_prompt.p_func = prompt_default; el->el_prompt.p_pos.v = 0; el->el_prompt.p_pos.h = 0; - el->el_prompt.p_ignore = '\0'; el->el_rprompt.p_func = prompt_default_r; el->el_rprompt.p_pos.v = 0; el->el_rprompt.p_pos.h = 0; - el->el_rprompt.p_ignore = '\0'; - return 0; + return (0); } @@ -143,7 +132,7 @@ prompt_end(EditLine *el __attribute__((_ * Install a prompt printing function */ protected int -prompt_set(EditLine *el, el_pfunc_t prf, char c, int op) +prompt_set(EditLine *el, el_pfunc_t prf, void *arg, int op) { el_prompt_t *p; @@ -157,15 +146,15 @@ prompt_set(EditLine *el, el_pfunc_t prf, p->p_func = prompt_default; else p->p_func = prompt_default_r; - } else + p->p_arg = NULL; + } else { p->p_func = prf; - - p->p_ignore = c; + p->p_arg = arg; + } p->p_pos.v = 0; p->p_pos.h = 0; - - return 0; + return (0); } @@ -173,22 +162,21 @@ prompt_set(EditLine *el, el_pfunc_t prf, * Retrieve the prompt printing function */ protected int -prompt_get(EditLine *el, el_pfunc_t *prf, char *c, int op) +prompt_get(EditLine *el, el_pfunc_t *prf, void **arg, int op) { el_prompt_t *p; if (prf == NULL) - return -1; + return (-1); if (op == EL_PROMPT) p = &el->el_prompt; else p = &el->el_rprompt; - *prf = el->el_rprompt.p_func; - - if (c) - *c = p->p_ignore; + *prf = p->p_func; - return 0; + if (arg) + *arg = p->p_arg; + return (0); }