Subject: Problems with BSD editline
To: None <netbsd-help@netbsd.org>
From: Daniel Bolgheroni <dbolgheroni@unifei.edu.br>
List: netbsd-help
Date: 02/28/2005 08:29:43
Hi,

I'm trying to compile a program using the BSD editline version included
with NetBSD. I'm not sure what are the relationship between all editline
versions I found on Google yet, but whatever...

I'm writing another program with editline, not the one below, but this
is the simplest program I can write to find out what are I am doing
wrong.

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?

#include <fcntl.h>
#include <histedit.h>

int main(int argc, char *argv[]) {
  EditLine *el;
  int count = 0;
  const char *prompt;

  el = el_init(argv[0], stdin, stdout, stderr);
  el_set(el, EL_PROMPT, "test> ");
  el_set(el, EL_EDITOR, "emacs");

  prompt = el_gets(el, &count);

  el_end(el);
  return 0;
}

Thank you.