lichray / nvi2

A multibyte fork of the nvi editor for BSD
Other
144 stars 34 forks source link

Use nvi2 without terminfo/termcap library #63

Open liweitianux opened 5 years ago

liweitianux commented 5 years ago

Hello,

First, thank you for developing and maintaining the nvi2 software.

I'm a DragonFly BSD developer. Nvi2 is part of the base system as well as the initrd(7) rescue system in DragonFly BSD. The initrd rescue system is a collection of statically linked utilities. We've included nvi2 in it, but nvi2 cannot really work because it requires the terminfo library. See also the BUGS section of FreeBSD's rescue(8).

So I'm openning this issue to ask: whether or not it is possible to make nvi2 work without depending on terminfo/termcap library? If not, would it be hard to make it work, e.g., by embedding the dumb/ansi term information in the program? I can help work on the patch if you like. Thank you.

Regards, Aaron

lichray commented 5 years ago

I'm not sure what exactly behavior you want. If you don't want nvi2 to link to terminfo library, then you will have to reimplement the "cl" library without relying on term.h, which is lots of work. If you just want nvi2 to work under rescue without accessing termcap files, then env TERM=dumb nvi should do the trick (can you give it a test?).

liweitianux commented 5 years ago

Thank you for the prompt reply.

I've tried env TERM=dumb nvi in the rescue mode, but it doesn't work either, with error message No terminal database found.

Meanwhile, when I tried to set the TERM variable in the rescue shell, I got messages:

rescue# export TERM=dumb
Cannot read termcap database;
using dumb terminal settings.

In addition, in a normal system (i.e., nvi can access terminfo), using TERM=dumb makes nvi still unusable; the text formatting is wrong (e.g., wrongly placed newlines).

Regards, Aaron

zhihaoy commented 5 years ago

That's unfortunate. I forgot how did I get my nvi2 to work in rescue, but since I have a special ~/.termcap, that may explain it.