From: Clint Adams <schizo@debian.org>
To: Bart Schaefer <schaefer@candle.brasslantern.com>
Cc: Zsh hackers list <zsh-workers@sunsite.auc.dk>
Subject: Re: PATCH: termcap/terminfo support in modules
Date: Mon, 4 Dec 2000 19:23:08 -0500 [thread overview]
Message-ID: <20001204192308.A4194@dman.com> (raw)
In-Reply-To: <1001204172718.ZM19960@candle.brasslantern.com>; from schaefer@candle.brasslantern.com on Mon, Dec 04, 2000 at 05:27:18PM +0000
> It's not that they're not defined, they're just not in a library that
> configure is testing for. Or rather, configure is not testing for those
> functions in particular, even though it does test for -lcurses.
Right. So we won't build the module unless we find tiget* in -ltermcap
or whatever has tgetent().
> Other random things I noticed:
This should address all but the potential namespace conflict.
Index: configure.in
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.in,v
retrieving revision 1.36
diff -u -r1.36 configure.in
--- configure.in 2000/12/04 19:21:06 1.36
+++ configure.in 2000/12/05 00:10:54
@@ -848,7 +848,8 @@
signgam \
putenv getenv \
brk sbrk \
- pathconf sysconf)
+ pathconf sysconf \
+ tigetflag tigetnum tigetstr)
AC_FUNC_STRCOLL
AC_FUNC_MMAP
Index: Src/Modules/terminfo.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/terminfo.c,v
retrieving revision 1.1
diff -u -r1.1 terminfo.c
--- Src/Modules/terminfo.c 2000/12/03 20:53:25 1.1
+++ Src/Modules/terminfo.c 2000/12/05 00:10:56
@@ -39,46 +39,47 @@
int
bin_echoti(char *name, char **argv, char *ops, int func)
{
- char *s, buf[2048], *t, *u;
- int num, argct;
+ char *s, *t;
+ int num;
s = *argv++;
+ /* This depends on the termcap stuff in init.c */
if (termflags & TERM_BAD)
return 1;
if ((termflags & TERM_UNKNOWN) && (isset(INTERACTIVE) || !init_term()))
return 1;
/* if the specified capability has a numeric value, display it */
if (((num = tigetnum(s)) != -1) && (num != -2)) {
- printf("%d\n", num);
- return 0;
-}
-
-switch (tigetflag(s)) {
- case -1:
- break;
- case 0:
- puts("no");
- return 0;
- default:
- puts("yes");
- return 0;
-}
-
+ printf("%d\n", num);
+ return 0;
+ }
+
+ switch (tigetflag(s)) {
+ case -1:
+ break;
+ case 0:
+ puts("no");
+ return 0;
+ default:
+ puts("yes");
+ return 0;
+ }
+
/* get a string-type capability */
-t = tigetstr(s);
-if (!t || !*t) {
- /* capability doesn't exist, or (if boolean) is off */
- zwarnnam(name, "no such terminfo capability: %s", s, 0);
- return 1;
-}
-
-printf("%s", t);
-return 0;
+ t = (char *)tigetstr(s);
+ if (!t || !*t) {
+ /* capability doesn't exist, or (if boolean) is off */
+ zwarnnam(name, "no such terminfo capability: %s", s, 0);
+ return 1;
+ }
+
+ tputs(t, 1, putchar);
+ return 0;
}
static struct builtin bintab[] = {
-BUILTIN("echoti", 0, bin_echoti, 1, -1, 0, NULL, NULL),
- };
+ BUILTIN("echoti", 0, bin_echoti, 1, -1, 0, NULL, NULL),
+};
/* This says if we are cleaning up when the module is unloaded. */
@@ -100,7 +101,7 @@
{
Param pm;
HashTable ht;
-
+
unsetparam(terminfo_nam);
if (!(pm = createparam(terminfo_nam, PM_SPECIAL|PM_HIDE|PM_HIDEVAL|
@@ -136,13 +137,14 @@
char *tistr;
Param pm = NULL;
+ /* This depends on the termcap stuff in init.c */
if (termflags & TERM_BAD)
- return 1;
+ return NULL;
if ((termflags & TERM_UNKNOWN) && (isset(INTERACTIVE) || !init_term()))
- return 1;
-
+ return NULL;
+
unmetafy(name, &len);
-
+
pm = (Param) zhalloc(sizeof(struct param));
pm->nam = dupstring(name);
pm->flags = PM_READONLY;
@@ -154,7 +156,7 @@
pm->ename = NULL;
pm->old = NULL;
pm->level = 0;
-
+
if (((num = tigetnum(name)) != -1) && (num != -2)) {
pm->u.val = num;
pm->flags |= PM_INTEGER;
@@ -163,26 +165,25 @@
pm->u.str = num ? dupstring("yes") : dupstring("no");
pm->flags |= PM_SCALAR;
}
- else if ((tistr = tigetstr(name)) != NULL)
+ else if ((tistr = (char *)tigetstr(name)) != NULL)
{
pm->u.str = dupstring(tistr);
pm->flags |= PM_SCALAR;
}
else
{
- zwarn("no such capability: %s", name, 0);
- pm->u.str = dupstring("");
- pm->flags |= PM_UNSET;
+ zwarn("no such capability: %s", name, 0);
+ pm->u.str = dupstring("");
+ pm->flags |= PM_UNSET;
}
return (HashNode) pm;
-
+
}
/**/
static void
scanterminfo(HashTable ht, ScanFunc func, int flags)
{
-return 0;
}
/**/
@@ -190,7 +191,7 @@
setup_(Module m)
{
incleanup = 0;
-
+
return 0;
}
@@ -198,6 +199,8 @@
int
boot_(Module m)
{
+ setupterm((char *)0, 1, (int *)0);
+
return !createtihash() || !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
}
@@ -206,14 +209,14 @@
cleanup_(Module m)
{
Param pm;
-
+
incleanup = 1;
-
- if ((pm = (Param) paramtab->getnode(paramtab, terminfo_nam)) &&
- pm == terminfo_pm) {
- pm->flags &= ~PM_READONLY;
- unsetparam_pm(pm, 0, 1);
- }
+
+ if ((pm = (Param) paramtab->getnode(paramtab, terminfo_nam)) &&
+ pm == terminfo_pm) {
+ pm->flags &= ~PM_READONLY;
+ unsetparam_pm(pm, 0, 1);
+ }
deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
return 0;
}
@@ -224,3 +227,7 @@
{
return 0;
}
+
+
+
+
Index: Src/Modules/terminfo.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/terminfo.mdd,v
retrieving revision 1.1
diff -u -r1.1 terminfo.mdd
--- Src/Modules/terminfo.mdd 2000/12/03 20:53:25 1.1
+++ Src/Modules/terminfo.mdd 2000/12/05 00:10:56
@@ -1,5 +1,5 @@
name=zsh/terminfo
-link=either
+link=`if test "x$ac_cv_have_tigetstr" = xyes; then echo either; else echo no; fi`
load=yes
autobins="echoti"
next prev parent reply other threads:[~2000-12-05 0:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-12-03 20:48 Clint Adams
2000-12-04 16:38 ` Bart Schaefer
2000-12-04 16:46 ` Clint Adams
2000-12-04 17:05 ` Peter Stephenson
2000-12-04 17:27 ` Bart Schaefer
2000-12-05 0:23 ` Clint Adams [this message]
2000-12-05 2:17 ` Vin Shelton
2000-12-05 4:21 ` PATCH: texinfo (Re: PATCH: termcap/terminfo support in modules) Bart Schaefer
2000-12-05 10:04 ` PATCH: termcap/terminfo support in modules Peter Stephenson
2000-12-05 10:42 ` Peter Stephenson
2000-12-05 10:55 ` Peter Stephenson
2000-12-06 1:11 ` Clint Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20001204192308.A4194@dman.com \
--to=schizo@debian.org \
--cc=schaefer@candle.brasslantern.com \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).