vim for NetBSD 1.1 - diffs

vim for NetBSD 1.1 - diffs

Post by Bruce Edig » Thu, 14 Mar 1996 04:00:00



I like Bram Molenaar's "vim" vi editor lookalike.  I've got a SPARCStation
IPC at home, and I'm running NetBSD 1.1 on it.  Here are the "diffs"
for vim 3.0, as the sources were posted to comp.sources.misc on 16 Aug,
1994.

The only real changes I had to make were because NetBSD uses "termios",
while the #define's had it using the old sgttyb stuff.  Vim 3.0 compiles with
the struct sgttyb stuff, but it doesn't work quite right.  I made a few
mods to get the termios stuff included instead of sgttyb stuff.

diff -c -r orig.src/unix.c netbsd.src/unix.c
*** orig.src/unix.c     Tue Mar 12 22:31:27 1996
--- netbsd.src/unix.c   Mon Feb 12 16:21:55 1996
***************
*** 71,77 ****
  #   define SIGWINCH SIGWINDOW
  #  endif
  # else
! #  include <sgtty.h>
  # endif       /* hpux */
  #endif        /* !SYSV_UNIX */

--- 71,81 ----
  #   define SIGWINCH SIGWINDOW
  #  endif
  # else
! #  ifdef __NetBSD__
! #    include <termios.h>
! #  else
! #    include <sgtty.h>
! #  endif
  # endif       /* hpux */
  #endif        /* !SYSV_UNIX */

***************
*** 755,761 ****
  {
  #if defined(ECHOE) && defined(ICANON) && !defined(__NeXT__)
        /* for "new" tty systems */
! # ifdef CONVEX
        static struct termios told;
                   struct termios tnew;
  # else
--- 759,765 ----
  {
  #if defined(ECHOE) && defined(ICANON) && !defined(__NeXT__)
        /* for "new" tty systems */
! # if defined(CONVEX) || defined(__NetBSD__)
        static struct termios told;
                   struct termios tnew;
  # else
***************
*** 771,777 ****
--- 775,785 ----
  #ifdef TIOCLGET
                ioctl(0, TIOCLGET, &tty_local);
  #endif
+ #ifdef __NetBSD__
+               tcgetattr(0, &told);
+ #else
                ioctl(0, TCGETA, &told);
+ #endif
                tnew = told;
                /*
                 * ICRNL enables typing ^V^M
***************
*** 784,794 ****
--- 792,810 ----
                                                );
                tnew.c_cc[VMIN] = 1;                    /* return after 1 char */
                tnew.c_cc[VTIME] = 0;                   /* don't wait */
+ #ifdef __NetBSD__
+               tcsetattr(0, TCSANOW, &tnew);
+ #else
                ioctl(0, TCSETA, &tnew);
+ #endif
        }
        else
        {
+ #ifdef __NetBSD__
+               tcsetattr(0, TCSANOW, &told);
+ #else
                ioctl(0, TCSETA, &told);
+ #endif
  #ifdef TIOCLGET
                ioctl(0, TIOCLSET, &tty_local);
  #endif

 
 
 

vim for NetBSD 1.1 - diffs

Post by David E. O'Bri » Sun, 17 Mar 1996 04:00:00


: I like Bram Molenaar's "vim" vi editor lookalike.  I've got a SPARCStation
: IPC at home, and I'm running NetBSD 1.1 on it.  Here are the "diffs"
: for vim 3.0, as the sources were posted to comp.sources.misc on 16 Aug,
: 1994.

Interested parties, may want to try the new beta that will become version
4.0?  Currently there is *very* active developement on Vim.  The latest is
nuxi.cs.ucdavis.edu:/pub/vim/vim-3.21.tar.gz

Bram, is very, very willing to take patches and advice to getting Vim
compile w/o mods on your box.  He made a couple for me for FreeBSD (and he
has moved to FreeBSD for a lot of his developing -- good for all the *BSD
camps :-))



 
 
 

vim for NetBSD 1.1 - diffs

Post by Iain Hibbe » Sun, 17 Mar 1996 04:00:00



> I like Bram Molenaar's "vim" vi editor lookalike.  I've got a SPARCStation
> IPC at home, and I'm running NetBSD 1.1 on it.  Here are the "diffs"
> for vim 3.0, as the sources were posted to comp.sources.misc on 16 Aug,
> 1994.
> The only real changes I had to make were because NetBSD uses "termios",
> while the #define's had it using the old sgttyb stuff.

surely, instead of testing for a __NetBSD__ define, you should test for
something like TERMIOS, and get that included in the Makefile or whatever -
that way, all of a sudden it should work on all systems that use termios
instead of "old sgttyb stuff".   I only say this, because I find it irritating
trying to compile programs that compile OK on FreeBSD, but they used
__FreeBSD__ for such patches instead of a more generic word..

Quote:> ! #  ifdef __NetBSD__
> ! #    include <termios.h>
> ! #  else
> ! #    include <sgtty.h>
> ! #  endif

]ain
 
 
 

vim for NetBSD 1.1 - diffs

Post by J Wuns » Thu, 21 Mar 1996 04:00:00



>    I only say this, because I find it irritating trying to compile
> programs that compile OK on FreeBSD, but they used __FreeBSD__ for
> such patches instead of a more generic word..

To our defense, we aren't *encouraging* this (ab)use of __FreeBSD__
either.  Alas, the really generic way of finding out about whether a
particular system is a 4.4BSD descendant is horrible:

This is the appropriate part of the FreeBSD handbook:

===================================================================
The preferred way to tell 4.3BSD/Reno and newer versions of the BSD
code apart is by using the `BSD' macro defined in <sys/param.h>.
Hopefully that file is already included; if not, add the code:

     #ifdef _HAVE_PARAM_H
     #include <sys/param.h>
     #endif

to the proper place in the .c file and add -D_HAVE_PARAM_H to the
CFLAGS in the Makefile.

Then, you may use:

     #if (defined(BSD) && (BSD >= 199103))

to detect if the code is being compiled on a 4.3 Net2 code base or
newer (e.g. FreeBSD 1.x, 4.3/Reno, NetBSD 0.9, 386BSD, BSD/386 1.1 and
below).

Use:

     #if (defined(BSD) && (BSD >= 199306))

to detect if the code is being compiled on a 4.4 code base or newer
(e.g. FreeBSD 2.x, 4.4, NetBSD 1.0, BSD/386 2.0 or above).
===================================================================

This is really dreadful.  In particular, the _HAVE_PARAM_H must be
passed from the command line to keep the code generic.

Btw., for the case mentioned here, the >= 199103 would be the right
test, Net-2 did already have termios.

--
J"org Wunsch                                              Unix support engineer