[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: any way to have elvis-tiny link with slang ?

According to Miquel van Smoorenburg:
> Or even better, SLtt_tgetent, SLtt_tputs and SLtt_tgoto should
> be implemented. Would be just a few lines of code. I could whip
> up a patch to do that I guess, but it would have to be added to
> the Debian slang package ofcourse.

I've done just that, and I can compile elvis-tiny against libslang now.
I have no idea or this ever was the original intent of the slang
developer (using libslang as a termcap emulation library) but this
is all you need in elvis-tiny to get it to link against libslang:

#ifdef SLANG
#include <slang.h>
#define tgetent(x, y)   SLtt_tgetent(y)
#define tgetstr(x, y)   SLtt_tgetstr(x)
#define tgetnum         SLtt_tgetnum
#define tgetflag        SLtt_tgetflag
#define tputs           SLtt_tputs
#define tgoto           SLtt_tgoto
#define tgetstr(i, a)   SLtt_tgetstr(i)

here is the patch:

diff -ruN t/slang-1.3.9/src/slang.h slang-1.3.9/src/slang.h
--- t/slang-1.3.9/src/slang.h	Thu Sep 23 09:25:59 1999
+++ slang-1.3.9/src/slang.h	Tue Nov 23 00:16:05 1999
@@ -1260,6 +1260,9 @@
    extern char *SLtt_tigetent (char *);
    extern char *SLtt_tigetstr (char *, char **);
    extern int SLtt_tigetnum (char *, char **);
+   extern int SLtt_tgetent(char *name);
+   extern char *SLtt_tgoto(char *cap, int col, int row);
+   extern int SLtt_tputs(char *str, int affcnt, int (*putc)(int));
 # endif
diff -ruN t/slang-1.3.9/src/sldisply.c slang-1.3.9/src/sldisply.c
--- t/slang-1.3.9/src/sldisply.c	Thu Sep 23 09:25:59 1999
+++ slang-1.3.9/src/sldisply.c	Tue Nov 23 00:23:13 1999
@@ -1977,6 +1977,22 @@
    return TGETFLAG (s);
+int SLtt_tgetent(char *term)
+  return SLtt_initialize(term) == 0;
+int SLtt_tputs(char *str, int affcnt, int (*p)(int))
+  while(*str) (*p)(*str++);
+  return 0;
+char *SLtt_tgoto(char *cap, int col, int row)
+  static char buf[64];
+  tt_sprintf(buf, cap, row, col);
+  return buf;
 static int Vt100_Like = 0;

First things first, but not necessarily in that order.

Reply to: