zsh-workers
 help / color / mirror / code / Atom feed
* zsh/termcap and zsh/terminfo modules
@ 2001-04-05  0:15 Bart Schaefer
  2001-04-05  5:48 ` Andrej Borsenkow
  0 siblings, 1 reply; 17+ messages in thread
From: Bart Schaefer @ 2001-04-05  0:15 UTC (permalink / raw)
  To: zsh-workers

My latest build appears to have created both of these but only installed
zsh/termcap.  Are they supposed to be mutually exclusive?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: zsh/termcap and zsh/terminfo modules
  2001-04-05  0:15 zsh/termcap and zsh/terminfo modules Bart Schaefer
@ 2001-04-05  5:48 ` Andrej Borsenkow
  2001-04-05 13:58   ` Clint Adams
  0 siblings, 1 reply; 17+ messages in thread
From: Andrej Borsenkow @ 2001-04-05  5:48 UTC (permalink / raw)
  To: zsh-workers

>
> My latest build appears to have created both of these but only installed
> zsh/termcap.  Are they supposed to be mutually exclusive?
>

Nope. I have both. Is it possible that one of them is linked statically? Check
for zsh_cv_shared_tgetent and zsh_cv_shared_tigetstr. It may well be, tests
take some of them wrong.

-andrej


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: zsh/termcap and zsh/terminfo modules
  2001-04-05  5:48 ` Andrej Borsenkow
@ 2001-04-05 13:58   ` Clint Adams
  2001-04-05 14:06     ` Andrej Borsenkow
  2001-04-06 18:39     ` Bart Schaefer
  0 siblings, 2 replies; 17+ messages in thread
From: Clint Adams @ 2001-04-05 13:58 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: zsh-workers

> Nope. I have both. Is it possible that one of them is linked statically? Check
> for zsh_cv_shared_tgetent and zsh_cv_shared_tigetstr. It may well be, tests
> take some of them wrong.

I have a vague recollection that this has something to do with people
wanting to link with libtermcap instead of ncurses.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: zsh/termcap and zsh/terminfo modules
  2001-04-05 13:58   ` Clint Adams
@ 2001-04-05 14:06     ` Andrej Borsenkow
  2001-04-06 18:39     ` Bart Schaefer
  1 sibling, 0 replies; 17+ messages in thread
From: Andrej Borsenkow @ 2001-04-05 14:06 UTC (permalink / raw)
  To: zsh-workers

>
> > Nope. I have both. Is it possible that one of them is linked
> statically? Check
> > for zsh_cv_shared_tgetent and zsh_cv_shared_tigetstr. It may well
> be, tests
> > take some of them wrong.
>
> I have a vague recollection that this has something to do with people
> wanting to link with libtermcap instead of ncurses.
>
>

Probably. Our system in curses-based with termcap emulation so configure finds
both functions. If termcap and terminfo libraries are distinct and you happen
to catch termcap, terminfo won't be found.

-andrej


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: zsh/termcap and zsh/terminfo modules
  2001-04-05 13:58   ` Clint Adams
  2001-04-05 14:06     ` Andrej Borsenkow
@ 2001-04-06 18:39     ` Bart Schaefer
  2001-04-09 13:12       ` Clint Adams
  1 sibling, 1 reply; 17+ messages in thread
From: Bart Schaefer @ 2001-04-06 18:39 UTC (permalink / raw)
  To: zsh-workers

It turns out that I actually don't have tigetstr on this machine.  The
build process compiles terminfo.o anyway, but then the config.modules
line causes linking to be skipped.

What caused me to notice was an attempt to write a function that would
report whether a terminal had automargin capability, regardless of which
of termcap or terminfo was available.  I didn't like getting "failed to
load module" from "zmodload -i zsh/terminfo"; yes, it can be redirected
away with 2>/dev/null, but that feels messy.

Can someone who has terminfo confirm that (( $+terminfo )) is a valid
test of whether the terminfo module is available?  Of course, zsh could
have been configured via config.modules to not autoload it ...

The other thought I had was to make both modules loadable, but simply
not do anything useful if the corresponding library wasn't available
(e.g. on my system "echoti ..." would always return nonzero, and the
$terminfo hash would be empty).  That makes (( $+terminfo )) useless.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: zsh/termcap and zsh/terminfo modules
  2001-04-06 18:39     ` Bart Schaefer
@ 2001-04-09 13:12       ` Clint Adams
  2001-04-09 15:45         ` PATCH: " Bart Schaefer
  0 siblings, 1 reply; 17+ messages in thread
From: Clint Adams @ 2001-04-09 13:12 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

> Can someone who has terminfo confirm that (( $+terminfo )) is a valid
> test of whether the terminfo module is available?  Of course, zsh could
> have been configured via config.modules to not autoload it ...

$+terminfo returns 1 (after autoloading the module).

> The other thought I had was to make both modules loadable, but simply
> not do anything useful if the corresponding library wasn't available
> (e.g. on my system "echoti ..." would always return nonzero, and the
> $terminfo hash would be empty).  That makes (( $+terminfo )) useless.

Perhaps the libraries to link to for each module should be dictated
by the .mdd files.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* PATCH: Re: zsh/termcap and zsh/terminfo modules
  2001-04-09 13:12       ` Clint Adams
@ 2001-04-09 15:45         ` Bart Schaefer
  2001-04-09 15:52           ` Clint Adams
  0 siblings, 1 reply; 17+ messages in thread
From: Bart Schaefer @ 2001-04-09 15:45 UTC (permalink / raw)
  To: zsh-workers

On Apr 9,  9:12am, Clint Adams wrote:
}
} > The other thought I had was to make both modules loadable, but simply
} > not do anything useful if the corresponding library wasn't available
} > (e.g. on my system "echoti ..." would always return nonzero, and the
} > $terminfo hash would be empty).  That makes (( $+terminfo )) useless.
} 
} Perhaps the libraries to link to for each module should be dictated
} by the .mdd files.

Possibly, but I don't see how that solves the problem.

Here's the sort of thing I mean:

schaefer[501] zmodload -i zsh/cap
schaefer[502] cap
cap: not available on this system
schaefer[503] zmodload -i zsh/terminfo
zsh: failed to load module: zsh/terminfo

Note that the "cap" module loads without complaint even though I have none
of the POSIX capability set libraries; it's the "cap" command that results
in a failure.

That convinces me that the following patch is appropriate; it makes the
`terminfo' variable disappear if zsh/terminfo can't support it, and the
`echoti' command reports "not available" in that case; but the module
will still load.  Similarly for zsh/termcap if tgetent() is not there.

I don't think it hurts anything to declare an autoparam that's never
defined?

Index: Src/Modules/termcap.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/termcap.c,v
retrieving revision 1.2
diff -u -r1.2 termcap.c
--- Src/Modules/termcap.c	2001/02/13 14:35:08	1.2
+++ Src/Modules/termcap.c	2001/04/09 15:40:58
@@ -32,6 +32,8 @@
 
 /* echotc: output a termcap */
 
+#ifdef HAVE_TGETENT
+
 /**/
 static int
 bin_echotc(char *name, char **argv, char *ops, int func)
@@ -99,6 +101,12 @@
     }
     return 0;
 }
+
+#else /* ! HAVE_TGETENT */
+
+#define bin_echotc bin_notavail
+
+#endif /* HAVE_TGETENT */
 
 static struct builtin bintab[] = {
     BUILTIN("echotc", 0, bin_echotc, 1, -1, 0, NULL, NULL),
Index: Src/Modules/termcap.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/termcap.mdd,v
retrieving revision 1.2
diff -u -r1.2 termcap.mdd
--- Src/Modules/termcap.mdd	2001/02/13 14:35:08	1.2
+++ Src/Modules/termcap.mdd	2001/04/09 15:40:58
@@ -7,10 +7,15 @@
 	      echo static
 	  fi
       else
+          echo either;
+      fi
+'
+load='if test "x$ac_cv_func_tgetent" = xyes; then
+          echo yes;
+      else
           echo no;
       fi
 '
-load=yes
 
 autobins="echotc"
 
Index: Src/Modules/terminfo.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/terminfo.c,v
retrieving revision 1.5
diff -u -r1.5 terminfo.c
--- Src/Modules/terminfo.c	2001/02/13 14:35:08	1.5
+++ Src/Modules/terminfo.c	2001/04/09 15:40:59
@@ -35,13 +35,15 @@
 
 /* echoti: output a terminfo capability */
 
+#ifdef HAVE_TIGETSTR
+
 /**/
 static int
 bin_echoti(char *name, char **argv, char *ops, int func)
 {
     char *s, *t;
     int num;
-    
+
     s = *argv++;
     /* This depends on the termcap stuff in init.c */
     if (termflags & TERM_BAD)
@@ -53,7 +55,7 @@
 	printf("%d\n", num);
 	return 0;
     }
-    
+
     switch (tigetflag(s)) {
     case -1:
 	break;
@@ -64,7 +66,7 @@
 	puts("yes");
 	return 0;
     }
-    
+
 /* get a string-type capability */
     t = (char *)tigetstr(s);
     if (!t || t == (char *)-1 || !*t) {
@@ -72,11 +74,17 @@
 	zwarnnam(name, "no such terminfo capability: %s", s, 0);
 	return 1;
     }
-    
+
     tputs(t, 1, putchar);
     return 0;
 }
 
+#else
+
+#define bin_echoti bin_notavail
+
+#endif
+
 static struct builtin bintab[] = {
     BUILTIN("echoti", 0, bin_echoti, 1, -1, 0, NULL, NULL),
 };
@@ -85,6 +93,8 @@
 
 static int incleanup;
 
+#ifdef HAVE_TIGETSTR
+
 /* Empty dummy function for special hash parameters. */
 
 /**/
@@ -101,19 +111,19 @@
 {
     Param pm;
     HashTable ht;
-    
+
     unsetparam(terminfo_nam);
-    
+
     if (!(pm = createparam(terminfo_nam, PM_SPECIAL|PM_HIDE|PM_HIDEVAL|
 			   PM_REMOVABLE|PM_HASHED)))
 	return NULL;
-    
+
     pm->level = pm->old ? locallevel : 0;
     pm->gets.hfn = hashgetfn;
     pm->sets.hfn = hashsetfn;
     pm->unsetfn = stdunsetfn;
     pm->u.hash = ht = newhashtable(7, terminfo_nam, NULL);
-    
+
     ht->hash        = hasher;
     ht->emptytable  = (TableFunc) shempty;
     ht->filltable   = NULL;
@@ -142,9 +152,9 @@
 	return NULL;
     if ((termflags & TERM_UNKNOWN) && (isset(INTERACTIVE) || !init_term()))
 	return NULL;
-    
+
     unmetafy(name, &len);
-    
+
     pm = (Param) zhalloc(sizeof(struct param));
     pm->nam = dupstring(name);
     pm->flags = PM_READONLY;
@@ -156,7 +166,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;
@@ -172,12 +182,11 @@
     }
     else
     {
-	zwarn("no such capability: %s", name, 0);
+	/* zwarn("no such capability: %s", name, 0); */
 	pm->u.str = dupstring("");
 	pm->flags |= PM_UNSET;
     }
     return (HashNode) pm;
-    
 }
 
 /**/
@@ -186,12 +195,14 @@
 {
 }
 
+#endif /* HAVE_TIGETSTR */
+
 /**/
 int
 setup_(Module m)
 {
     incleanup = 0;
-    
+
     return 0;
 }
 
@@ -199,9 +210,13 @@
 int
 boot_(Module m)
 {
+#ifdef HAVE_TIGETSTR
     setupterm((char *)0, 1, (int *)0);
 
-    return !createtihash() || !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
+    if (!createtihash())
+    	return 1;
+#endif
+    return  !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
 }
 
 /**/
@@ -209,14 +224,16 @@
 cleanup_(Module m)
 {
     Param pm;
-    
+
     incleanup = 1;
-    
+
+#ifdef HAVE_TIGETSTR
     if ((pm = (Param) paramtab->getnode(paramtab, terminfo_nam)) &&
 	pm == terminfo_pm) {
 	pm->flags &= ~PM_READONLY;
 	unsetparam_pm(pm, 0, 1);
     }
+#endif
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     return 0;
 }
@@ -227,7 +244,3 @@
 {
     return 0;
 }
-
-
-
-
Index: Src/Modules/terminfo.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/terminfo.mdd,v
retrieving revision 1.4
diff -u -r1.4 terminfo.mdd
--- Src/Modules/terminfo.mdd	2001/02/13 14:35:08	1.4
+++ Src/Modules/terminfo.mdd	2001/04/09 15:40:59
@@ -7,10 +7,15 @@
 	      echo static
 	  fi
       else
+          echo either;
+      fi
+'
+load='if test "x$ac_cv_func_tigetstr" = xyes; then
+          echo yes;
+      else
           echo no;
       fi
 '
-load=yes
 
 autobins="echoti"
 autoparams="terminfo"

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: PATCH: Re: zsh/termcap and zsh/terminfo modules
  2001-04-09 15:45         ` PATCH: " Bart Schaefer
@ 2001-04-09 15:52           ` Clint Adams
  2001-04-09 16:09             ` Bart Schaefer
  0 siblings, 1 reply; 17+ messages in thread
From: Clint Adams @ 2001-04-09 15:52 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

> Possibly, but I don't see how that solves the problem.

What I mean is, have configure determine what libraries are necessary
for each module, then link that module with the necessary libraries.  If
the required symbols are unavailable, do not link the module.
So you wouldn't get a terminfo.so if you didn't have gettistr,
but terminfo.so would be the only thing linked against ncurses if that's
the only module that requires it.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: PATCH: Re: zsh/termcap and zsh/terminfo modules
  2001-04-09 15:52           ` Clint Adams
@ 2001-04-09 16:09             ` Bart Schaefer
  2001-04-09 16:24               ` More ramblings " Bart Schaefer
  2001-04-09 17:34               ` PATCH: " Clint Adams
  0 siblings, 2 replies; 17+ messages in thread
From: Bart Schaefer @ 2001-04-09 16:09 UTC (permalink / raw)
  To: zsh-workers

On Apr 9, 11:52am, Clint Adams wrote:
} 
} What I mean is, have configure determine what libraries are necessary
} for each module, then link that module with the necessary libraries.  If
} the required symbols are unavailable, do not link the module.
} So you wouldn't get a terminfo.so if you didn't have gettistr,
} but terminfo.so would be the only thing linked against ncurses if that's
} the only module that requires it.

Ah.  Yes, that would be superior.

I notice that configure.in does not have an AC_SEARCH_LIBS for tigetstr,
only for tgetent.  That's why the ncurses library is never found on my
system -- the way configure.in is currently organized, tigetstr will be
found only if it is in the same library in which tgetent is found; and
termcap is always searched first except on aix, hpux, and solaris, so for
most systems that have termcap the zsh/terminfo module will be disabled.

Independent of linking modules with their own libraries, what's the right
way to deal with this?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 17+ messages in thread

* More ramblings Re: zsh/termcap and zsh/terminfo modules
  2001-04-09 16:09             ` Bart Schaefer
@ 2001-04-09 16:24               ` Bart Schaefer
  2001-04-09 16:28                 ` Peter Stephenson
  2001-04-09 16:58                 ` More ramblings Re: zsh/termcap and zsh/terminfo modules Bart Schaefer
  2001-04-09 17:34               ` PATCH: " Clint Adams
  1 sibling, 2 replies; 17+ messages in thread
From: Bart Schaefer @ 2001-04-09 16:24 UTC (permalink / raw)
  To: zsh-workers

On Apr 9,  4:09pm, Bart Schaefer wrote:
}
} I notice that configure.in does not have an AC_SEARCH_LIBS for tigetstr,
} only for tgetent.

Having stuck in an AC_SEARCH_LIBS(tigetstr, ...) I now have a working
zsh/terminfo module (but zsh is being linked against libcurses).

This leads me to notice that one can't dump out the entire terminal def'n
by using `print ${(kv)terminfo}':

zagzig% zmodload zsh/terminfo
zagzig% print $#terminfo
0
zagzig% print $terminfo[am]
yes
zagzig% print $#terminfo
0

Are there other special hashes that behave this way?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: More ramblings Re: zsh/termcap and zsh/terminfo modules
  2001-04-09 16:24               ` More ramblings " Bart Schaefer
@ 2001-04-09 16:28                 ` Peter Stephenson
  2001-04-10 17:35                   ` mapfile (Re: More ramblings Re: zsh/termcap and zsh/terminfo modules) Bart Schaefer
  2001-04-09 16:58                 ` More ramblings Re: zsh/termcap and zsh/terminfo modules Bart Schaefer
  1 sibling, 1 reply; 17+ messages in thread
From: Peter Stephenson @ 2001-04-09 16:28 UTC (permalink / raw)
  To: Zsh hackers list

Bart wrote:
> Are there other special hashes that behave this way?

$mapfile doesn't work properly when referred to as a full hash any more ---
it's supposed to give all the files in the current directory.  I noticed
this a while back but haven't had time to do anything about it.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: More ramblings Re: zsh/termcap and zsh/terminfo modules
  2001-04-09 16:24               ` More ramblings " Bart Schaefer
  2001-04-09 16:28                 ` Peter Stephenson
@ 2001-04-09 16:58                 ` Bart Schaefer
  1 sibling, 0 replies; 17+ messages in thread
From: Bart Schaefer @ 2001-04-09 16:58 UTC (permalink / raw)
  To: zsh-workers

On Apr 9,  4:24pm, Bart Schaefer wrote:
}
} Having stuck in an AC_SEARCH_LIBS(tigetstr, ...) I now have a working
} zsh/terminfo module (but zsh is being linked against libcurses).

However, now neither zsh/termcap nor zsh/terminfo is autoloaded; I just
realized that the `load' directive is not eval'd the way `link' is, so
that part of my last patch didn't work.  Fortunately, it's not needed.

Index: Src/Modules/termcap.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/termcap.mdd,v
retrieving revision 1.3
diff -u -r1.3 termcap.mdd
--- Src/Modules/termcap.mdd	2001/04/09 15:58:55	1.3
+++ Src/Modules/termcap.mdd	2001/04/09 16:47:16
@@ -10,12 +10,7 @@
           echo either;
       fi
 '
-load='if test "x$ac_cv_func_tgetent" = xyes; then
-          echo yes;
-      else
-          echo no;
-      fi
-'
+load=yes
 
 autobins="echotc"
 
Index: Src/Modules/terminfo.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/terminfo.mdd,v
retrieving revision 1.5
diff -u -r1.5 terminfo.mdd
--- Src/Modules/terminfo.mdd	2001/04/09 15:58:55	1.5
+++ Src/Modules/terminfo.mdd	2001/04/09 16:47:16
@@ -10,12 +10,7 @@
           echo either;
       fi
 '
-load='if test "x$ac_cv_func_tigetstr" = xyes; then
-          echo yes;
-      else
-          echo no;
-      fi
-'
+load=yes
 
 autobins="echoti"
 autoparams="terminfo"

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: PATCH: Re: zsh/termcap and zsh/terminfo modules
  2001-04-09 16:09             ` Bart Schaefer
  2001-04-09 16:24               ` More ramblings " Bart Schaefer
@ 2001-04-09 17:34               ` Clint Adams
  1 sibling, 0 replies; 17+ messages in thread
From: Clint Adams @ 2001-04-09 17:34 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

> I notice that configure.in does not have an AC_SEARCH_LIBS for tigetstr,
> only for tgetent.  That's why the ncurses library is never found on my
> system -- the way configure.in is currently organized, tigetstr will be
> found only if it is in the same library in which tgetent is found; and
> termcap is always searched first except on aix, hpux, and solaris, so for
> most systems that have termcap the zsh/terminfo module will be disabled.

Yes.  I recall that the feeling at the time was that people didn't want
to have a terminfo library linked into the main binary and all the modules
just for the sake of a terminfo module, and to avoid potential conflicts
in termcap handling.  That's why tigetstr isn't sought.  Since -ltermcap
here is really ncurses, that doesn't bother me.

I have no ideas on how to handle it without individual library linking.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* mapfile (Re: More ramblings Re: zsh/termcap and zsh/terminfo modules)
  2001-04-09 16:28                 ` Peter Stephenson
@ 2001-04-10 17:35                   ` Bart Schaefer
  2001-04-10 17:40                     ` Peter Stephenson
  0 siblings, 1 reply; 17+ messages in thread
From: Bart Schaefer @ 2001-04-10 17:35 UTC (permalink / raw)
  To: Zsh hackers list

On Apr 9,  5:28pm, Peter Stephenson wrote:
} 
} $mapfile doesn't work properly when referred to as a full hash any more
} --- it's supposed to give all the files in the current directory.

It still works for me:

zagzig% print -c ${(k)mapfile} 
config.log      config.status   Makefile        Src
config.h        stamp-h         Doc             Test
config.cache    Config          Etc             config.modules

The manual says "... the keys are the names of files in the current
directory, and the values are empty (to save a huge overhead in memory)."
So `print $mapfile' shouldn't show anything, but:

zagzig% print -c $#mapfile 
12

Unless this is different for you, I don't think there's anything wrong.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: mapfile (Re: More ramblings Re: zsh/termcap and zsh/terminfo modules)
  2001-04-10 17:35                   ` mapfile (Re: More ramblings Re: zsh/termcap and zsh/terminfo modules) Bart Schaefer
@ 2001-04-10 17:40                     ` Peter Stephenson
  2001-04-10 18:08                       ` Bart Schaefer
  0 siblings, 1 reply; 17+ messages in thread
From: Peter Stephenson @ 2001-04-10 17:40 UTC (permalink / raw)
  To: Zsh hackers list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

> zagzig% print -c ${(k)mapfile} 
> config.log      config.status   Makefile        Src
> config.h        stamp-h         Doc             Test
> config.cache    Config          Etc             config.modules
> 
> 
> Unless this is different for you, I don't think there's anything wrong.

It is different for me, it gives loads of ÿ's.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: mapfile (Re: More ramblings Re: zsh/termcap and zsh/terminfo modules)
  2001-04-10 17:40                     ` Peter Stephenson
@ 2001-04-10 18:08                       ` Bart Schaefer
  2001-04-11  0:05                         ` Peter Stephenson
  0 siblings, 1 reply; 17+ messages in thread
From: Bart Schaefer @ 2001-04-10 18:08 UTC (permalink / raw)
  To: Zsh hackers list

On Apr 10,  6:40pm, Peter Stephenson wrote:
} Subject: Re: mapfile (Re: More ramblings Re: zsh/termcap and zsh/terminfo 
}
} > zagzig% print -c ${(k)mapfile} 
} > config.log      config.status   Makefile        Src
} > config.h        stamp-h         Doc             Test
} > config.cache    Config          Etc             config.modules
} > 
} > Unless this is different for you, I don't think there's anything wrong.
} 
} It is different for me, it gives loads of ÿ's.

Hmm, well, could this possibly be a result of scanpmmapfile() relying on
the static buffer from metafy() that is returned by zreaddir() ?

I'm not sure whether the right thing to do about that is to dupstring() ?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: mapfile (Re: More ramblings Re: zsh/termcap and zsh/terminfo modules)
  2001-04-10 18:08                       ` Bart Schaefer
@ 2001-04-11  0:05                         ` Peter Stephenson
  0 siblings, 0 replies; 17+ messages in thread
From: Peter Stephenson @ 2001-04-11  0:05 UTC (permalink / raw)
  To: Zsh hackers list

Bart wrote:
> Hmm, well, could this possibly be a result of scanpmmapfile() relying on
> the static buffer from metafy() that is returned by zreaddir() ?
> 
> I'm not sure whether the right thing to do about that is to dupstring() ?

That seems to work.  I'm now off for Easter.  Stay alert!

Index: Src/Modules/mapfile.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/mapfile.c,v
retrieving revision 1.4
diff -u -r1.4 mapfile.c
--- Src/Modules/mapfile.c	2000/06/09 15:37:05	1.4
+++ Src/Modules/mapfile.c	2001/04/11 00:02:41
@@ -318,6 +318,7 @@
 	 * we always read the entire contents of every single file
 	 * in the directory into memory.  Hence just leave it empty.
 	 */
+	pm.nam = dupstring(pm.nam);
 	pm.u.str = "";
 	func((HashNode) &pm, flags);
     }

-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@csr.com
Web: http://www.pwstephenson.fsnet.co.uk


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2001-04-11  0:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-05  0:15 zsh/termcap and zsh/terminfo modules Bart Schaefer
2001-04-05  5:48 ` Andrej Borsenkow
2001-04-05 13:58   ` Clint Adams
2001-04-05 14:06     ` Andrej Borsenkow
2001-04-06 18:39     ` Bart Schaefer
2001-04-09 13:12       ` Clint Adams
2001-04-09 15:45         ` PATCH: " Bart Schaefer
2001-04-09 15:52           ` Clint Adams
2001-04-09 16:09             ` Bart Schaefer
2001-04-09 16:24               ` More ramblings " Bart Schaefer
2001-04-09 16:28                 ` Peter Stephenson
2001-04-10 17:35                   ` mapfile (Re: More ramblings Re: zsh/termcap and zsh/terminfo modules) Bart Schaefer
2001-04-10 17:40                     ` Peter Stephenson
2001-04-10 18:08                       ` Bart Schaefer
2001-04-11  0:05                         ` Peter Stephenson
2001-04-09 16:58                 ` More ramblings Re: zsh/termcap and zsh/terminfo modules Bart Schaefer
2001-04-09 17:34               ` PATCH: " Clint Adams

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).