Subject: Re: Problems with BSD editline
To: Daniel Bolgheroni <dbolgheroni@unifei.edu.br>
From: Dave Huang <khym@azeotrope.org>
List: netbsd-help
Date: 02/28/2005 02:06:10
On Mon, Feb 28, 2005 at 08:29:43AM +0000, Daniel Bolgheroni wrote:
> The problem is that I get "Segmentation fault (core dumped)" every time
> I run it. I get no errors with gcc even when using "-Wall -W" (yes, and
> I'm using "-ledit -ltermcap" too).
> 
> Am I doing something wrong?

Yes, the problem is with this line:
>   el_set(el, EL_PROMPT, "test> ");

The third parameter to el_set() is not the prompt string itself,
but a function that returns the prompt string:

     EL_PROMPT, char *(*f)(EditLine *)
           Define prompt printing function as f, which is to return a
           string that contains the prompt.
-- 
Name: Dave Huang         |  Mammal, mammal / their names are called /
INet: khym@azeotrope.org |  they raise a paw / the bat, the cat /
FurryMUCK: Dahan         |  dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 29 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++