zsh-workers
 help / color / mirror / code / Atom feed
* Re: HP-UX 11.00 tgetenv dilemma
       [not found] <20010611165637.24436.qmail@web12503.mail.yahoo.com>
@ 2001-06-11 18:24 ` Andrej Borsenkow
  2001-06-11 22:05   ` Export problem a normal guy
  2001-06-11 22:52   ` HP-UX 11.00 tgetenv dilemma Bart Schaefer
  0 siblings, 2 replies; 13+ messages in thread
From: Andrej Borsenkow @ 2001-06-11 18:24 UTC (permalink / raw)
  To: a normal guy; +Cc: ZSH Workers Mailing List

a normal guy wrote:

> Andrej
> 
> At the risk of sounding ignorant, what does SUS stand for?  I
> assume it is the governing document for POSIX compatibility or
> the like.  Thanks,
> 



Single Unix Specification a.k.a. Unix 98 (current version). It is a 
superset of XPG (X/Open Portability Guide) that itself is superset of 
POSIX. It has a big advantage of being available online as opposed to 
either XPG or POSIX :-)


> 
> P.S.  What is the latest line of thought about the Export word
> splitting problem?  To fix or not to fix?
> 


It is not bug - it complies with standards. Granted, there are 
compatibility issues (both ksh and bash behave the way you desire), but 
so far you are the first person to note it :-) That does not mean I am 
opposed to "fixing" it - I just have no idea how easy (or difficult) it is.

-andrej


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

* Re: Export problem
  2001-06-11 18:24 ` HP-UX 11.00 tgetenv dilemma Andrej Borsenkow
@ 2001-06-11 22:05   ` a normal guy
  2001-06-11 22:52   ` HP-UX 11.00 tgetenv dilemma Bart Schaefer
  1 sibling, 0 replies; 13+ messages in thread
From: a normal guy @ 2001-06-11 22:05 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: ZSH Workers Mailing List

--- Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> wrote:
>> 
>> P.S.  What is the latest line of thought about the Export
word
>> splitting problem?  To fix or not to fix?
>> 
> 
> 
> It is not bug - it complies with standards. Granted, there are
> 
> compatibility issues (both ksh and bash behave the way you
> desire), but so far you are the first person to note it :-)
> That does not mean I am opposed to "fixing" it - I just have
> no idea how easy (or difficult) it is.
> 
> -andrej
> 

I appreciate you considering this for a fix (if possible). 
Thank you for pointing out that it is not a bug per the
standard.  As for compatibility, I work in a lab that mixes the
use of ksh88, sh-posix, bash, and zsh.  The line that found this
incompatibility is an environment setup script, and I'll attempt
to the line to conform to the SUS.  Zsh is an awesome shell and
I appreciate all the efforts made to by you guys.

Scott

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/


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

* Re: HP-UX 11.00 tgetenv dilemma
  2001-06-11 18:24 ` HP-UX 11.00 tgetenv dilemma Andrej Borsenkow
  2001-06-11 22:05   ` Export problem a normal guy
@ 2001-06-11 22:52   ` Bart Schaefer
  2001-06-12 10:25     ` Peter Stephenson
  1 sibling, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 2001-06-11 22:52 UTC (permalink / raw)
  To: Andrej Borsenkow, a normal guy; +Cc: ZSH Workers Mailing List

On Jun 11, 10:24pm, Andrej Borsenkow wrote:
> 
> a normal guy wrote:
> 
> > P.S.  What is the latest line of thought about the Export word
> > splitting problem?  To fix or not to fix?
> 
> so far you are the first person to note it :-) That does not mean I am 
> opposed to "fixing" it - I just have no idea how easy (or difficult) it is.

It shouldn't be all that difficult ... `export' and `typeset' already have
special handling of foo=bar arguments for MAGIC_EQUAL_SUBST.


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

* Re: HP-UX 11.00 tgetenv dilemma
  2001-06-11 22:52   ` HP-UX 11.00 tgetenv dilemma Bart Schaefer
@ 2001-06-12 10:25     ` Peter Stephenson
  2001-06-12 14:25       ` Bart Schaefer
  2001-06-12 17:16       ` KSH_TYPESET Peter Stephenson
  0 siblings, 2 replies; 13+ messages in thread
From: Peter Stephenson @ 2001-06-12 10:25 UTC (permalink / raw)
  To: Zsh hackers list

"Bart Schaefer" wrote:
> On Jun 11, 10:24pm, Andrej Borsenkow wrote:
> > 
> > a normal guy wrote:
> > 
> > > P.S.  What is the latest line of thought about the Export word
> > > splitting problem?  To fix or not to fix?
> > 
> > so far you are the first person to note it :-) That does not mean I am 
> > opposed to "fixing" it - I just have no idea how easy (or difficult) it is.
> 
> It shouldn't be all that difficult ... `export' and `typeset' already have
> special handling of foo=bar arguments for MAGIC_EQUAL_SUBST.

Here's an attempt.  The KSH_TYPESET option prevents wordsplitting if it
finds an `=' in the pre-expansion text for typeset etc.  It doesn't force
other typeset arguments not to be split, for example

  foo=(param1 param2)
  typeset $foo

clearly shouldn't inhibit wordsplitting.

I've made the MAGIC_EQUAL_SUBST behaviour follow the same behaviour that
would be used after typeset, i.e. respecting KSH_TYPESET.  This seems to be
the natural way to do it.

The new tests (which are supposed to pass) show how it works.  There'll be
some offset in the patch since I've been adding new options tests which I
haven't committed yet.

I shall assume this is good enough to go on the development branch straight
away --- it won't go on the 4.0 branch at all.

Index: Doc/Zsh/options.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v
retrieving revision 1.19
diff -u -r1.19 options.yo
--- Doc/Zsh/options.yo	2001/06/11 10:41:19	1.19
+++ Doc/Zsh/options.yo	2001/06/12 10:16:08
@@ -668,6 +668,16 @@
 set and unset options, all options are shown, marked `on' if
 they are in the non-default state, `off' otherwise.
 )
+pindex(KSH_TYPESET)
+cindex(argument splitting, in typeset etc.)
+cindex(ksh, argument splitting in typeset)
+item(tt(KSH_TYPESET) <K>)(
+Alters the way arguments to the tt(typeset) family of commands, including
+tt(declare), tt(export), tt(float), tt(integer), tt(local) and
+tt(readonly), are processed.  Without this option, zsh will perform normal
+word splitting after command and parameter expansion in arguments of an
+assignment; with it, word splitting does not take place in those cases.
+)
 pindex(LIST_AMBIGUOUS)
 cindex(ambiguous completion)
 cindex(completion, ambiguous)
@@ -757,6 +767,10 @@
 argument, and not used as an actual parameter assignment.  For example, in
 tt(echo foo=~/bar:~/rod), both occurrences of tt(~) would be replaced.
 Note that this happens anyway with tt(typeset) and similar statements.
+
+This option respects the setting of the tt(KSH_TYPESET) option.  In other
+words, if both options are in effect, arguments looking like
+assignments will not undergo wordsplitting.
 )
 pindex(MAIL_WARNING)
 cindex(mail, warning of reading)
Index: Src/options.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/options.c,v
retrieving revision 1.8
diff -u -r1.8 options.c
--- Src/options.c	2001/03/30 16:20:04	1.8
+++ Src/options.c	2001/06/12 10:16:09
@@ -145,6 +145,7 @@
 {NULL, "kshautoload",	      OPT_EMULATE|OPT_BOURNE,	 KSHAUTOLOAD},
 {NULL, "kshglob",             OPT_EMULATE|OPT_KSH,       KSHGLOB},
 {NULL, "kshoptionprint",      OPT_EMULATE|OPT_KSH,	 KSHOPTIONPRINT},
+{NULL, "kshtypeset",          OPT_EMULATE|OPT_KSH,	 KSHTYPESET},
 {NULL, "listambiguous",	      OPT_ALL,			 LISTAMBIGUOUS},
 {NULL, "listbeep",	      OPT_ALL,			 LISTBEEP},
 {NULL, "listpacked",	      0,			 LISTPACKED},
Index: Src/subst.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/subst.c,v
retrieving revision 1.19
diff -u -r1.19 subst.c
--- Src/subst.c	2001/05/19 00:31:23	1.19
+++ Src/subst.c	2001/06/12 10:16:09
@@ -50,6 +50,7 @@
 prefork(LinkList list, int flags)
 {
     LinkNode node;
+    int asssub = (flags & PF_TYPESET) && isset(KSHTYPESET);
 
     queue_signals();
     for (node = firstnode(list); node; incnode(node)) {
@@ -70,7 +71,7 @@
 	    if (isset(SHFILEEXPANSION))
 		filesub((char **)getaddrdata(node),
 			flags & (PF_TYPESET|PF_ASSIGN));
-	    if (!(node = stringsubst(list, node, flags & PF_SINGLE))) {
+	    if (!(node = stringsubst(list, node, flags & PF_SINGLE, asssub))) {
 		unqueue_signals();
 		return;
 	    }
@@ -97,7 +98,7 @@
 
 /**/
 static LinkNode
-stringsubst(LinkList list, LinkNode node, int ssub)
+stringsubst(LinkList list, LinkNode node, int ssub, int asssub)
 {
     int qt;
     char *str3 = (char *)getdata(node);
@@ -211,6 +212,12 @@
 	    str3 = str2;
 	    setdata(node, str3);
 	    continue;
+	} else if (asssub && ((c == '=') || c == Equals) && str != str3) {
+	    /*
+	     * We are in a normal argument which looks like an assignment
+	     * and is to be treated like one, with no word splitting.
+	     */
+	    ssub = 1;
 	}
 	str++;
     }
@@ -1885,7 +1892,7 @@
 
 	    *--fstr = Marker;
 	    init_list1(tl, fstr);
-	    if (!eval && !stringsubst(&tl, firstnode(&tl), ssub))
+	    if (!eval && !stringsubst(&tl, firstnode(&tl), ssub, 0))
 		return NULL;
 	    *str = aptr;
 	    tn = firstnode(&tl);
Index: Src/zsh.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v
retrieving revision 1.30
diff -u -r1.30 zsh.h
--- Src/zsh.h	2001/06/08 18:34:53	1.30
+++ Src/zsh.h	2001/06/12 10:16:09
@@ -1384,6 +1384,7 @@
     KSHAUTOLOAD,
     KSHGLOB,
     KSHOPTIONPRINT,
+    KSHTYPESET,
     LISTAMBIGUOUS,
     LISTBEEP,
     LISTPACKED,
Index: Test/E01options.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/E01options.ztst,v
retrieving revision 1.4
diff -u -r1.4 E01options.ztst
--- Test/E01options.ztst	2001/05/19 23:38:22	1.4
+++ Test/E01options.ztst	2001/06/12 10:16:09
@@ -502,6 +503,22 @@
 >unset
 >globassign
 
+  setopt kshtypeset
+  ktvars=(ktv1 ktv2)
+  typeset ktfoo=`echo arg1 arg2` $ktvars
+  print $+ktv1 $+ktv2 $+ktv3
+  print $ktfoo
+  unsetopt kshtypeset
+  typeset noktfoo=`echo noktarg1 noktarg2`
+  print $noktfoo
+  print $+noktarg1 $+noktarg2
+  unset ktfoo ktv1 ktv2 noktfoo noktarg2
+0:KSH_TYPESET option
+>1 1 0
+>arg1 arg2
+>noktarg1
+>0 1
+
   showopt() { setopt | egrep 'localoptions|ksharrays'; }
   f1() { setopt localoptions ksharrays; showopt }
   f2() { setopt ksharrays; showopt }
@@ -526,14 +543,28 @@
 
 # LOCAL_TRAPS was tested in C03traps (phew).
 
-  fn() { local HOME=/any/old/name; print var=~ 'anything goes/here'=~; }
+  fn() {
+    local HOME=/any/old/name
+    print -l var=~ 'anything goes/here'=~ split=`echo maybe not`;
+  }
   setopt magicequalsubst
+  fn
+  setopt kshtypeset
   fn
-  unsetopt magicequalsubst
+  unsetopt magicequalsubst kshtypeset
   fn
 0:MAGIC_EQUAL_SUBST option
->var=/any/old/name anything goes/here=/any/old/name
->var=~ anything goes/here=~
+>var=/any/old/name
+>anything goes/here=/any/old/name
+>split=maybe
+>not
+>var=/any/old/name
+>anything goes/here=/any/old/name
+>split=maybe not
+>var=~
+>anything goes/here=~
+>split=maybe
+>not
 
   setopt MARK_DIRS
   print tmp*

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


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


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

* Re: HP-UX 11.00 tgetenv dilemma
  2001-06-12 10:25     ` Peter Stephenson
@ 2001-06-12 14:25       ` Bart Schaefer
  2001-06-12 16:04         ` Peter Stephenson
  2001-06-12 17:16       ` KSH_TYPESET Peter Stephenson
  1 sibling, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 2001-06-12 14:25 UTC (permalink / raw)
  To: Peter Stephenson, Zsh hackers list

On Jun 12, 11:25am, Peter Stephenson wrote:
} Subject: Re: HP-UX 11.00 tgetenv dilemma
}
} Here's an attempt.  The KSH_TYPESET option prevents wordsplitting if it
} finds an `=' in the pre-expansion text for typeset etc.

The remaining problem is that KSH_TYPESET should be set by `emulate bash',
which it is not because `emulate bash' is equivalent to `emulate sh'.

-- 
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] 13+ messages in thread

* Re: HP-UX 11.00 tgetenv dilemma
  2001-06-12 14:25       ` Bart Schaefer
@ 2001-06-12 16:04         ` Peter Stephenson
  2001-06-13  5:00           ` Bart Schaefer
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Stephenson @ 2001-06-12 16:04 UTC (permalink / raw)
  To: Zsh hackers list

"Bart Schaefer" wrote:
> On Jun 12, 11:25am, Peter Stephenson wrote:
> } Subject: Re: HP-UX 11.00 tgetenv dilemma
> }
> } Here's an attempt.  The KSH_TYPESET option prevents wordsplitting if it
> } finds an `=' in the pre-expansion text for typeset etc.
> 
> The remaining problem is that KSH_TYPESET should be set by `emulate bash',
> which it is not because `emulate bash' is equivalent to `emulate sh'.

...and we don't want to set it for that because it's apparently correct for
the POSIX shell.  Should we introduce a separate emulation for bash?  It's
getting horribly complicated and we've never been that concerned about bash
compatilibity for non-POSIX features.

By the way, bash also seems to have the equivalent of MAGIC_EQUAL_SUBST
set:

  bash$ args() { typeset f; for f in "$@"; do echo $f; done; }
  bash$ args `echo one two`
  one
  two
  bash$ args foo`echo one two`
  fooone
  two
  bash$ args foo=`echo one two`
  foo=one two

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


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


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

* KSH_TYPESET
  2001-06-12 10:25     ` Peter Stephenson
  2001-06-12 14:25       ` Bart Schaefer
@ 2001-06-12 17:16       ` Peter Stephenson
  2001-06-12 17:22         ` KSH_TYPESET Peter Stephenson
  1 sibling, 1 reply; 13+ messages in thread
From: Peter Stephenson @ 2001-06-12 17:16 UTC (permalink / raw)
  To: Zsh hackers list

Peter Stephenson wrote:
> Here's an attempt.  The KSH_TYPESET option prevents wordsplitting if it
> finds an `=' in the pre-expansion text for typeset etc.  It doesn't force
> other typeset arguments not to be split, for example
> 
>   foo=(param1 param2)
>   typeset $foo
> 
> clearly shouldn't inhibit wordsplitting.
> 
> I've made the MAGIC_EQUAL_SUBST behaviour follow the same behaviour that
> would be used after typeset, i.e. respecting KSH_TYPESET.  This seems to be
> the natural way to do it.

Use of KSH_TYPESET together with MAGIC_EQUAL_SUBST completely breaks word
splitting with "$foo[@]".  I haven't the smallest clue how yet.  This will
stop the completion system working.

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


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


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

* Re: KSH_TYPESET
  2001-06-12 17:16       ` KSH_TYPESET Peter Stephenson
@ 2001-06-12 17:22         ` Peter Stephenson
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Stephenson @ 2001-06-12 17:22 UTC (permalink / raw)
  To: Zsh hackers list

Peter Stephenson wrote:
> Use of KSH_TYPESET together with MAGIC_EQUAL_SUBST completely breaks word
> splitting with "$foo[@]".

False alarm.  I seem to have been using mixed versions of the shell and
the libraries somehow.  Anyway, it's gone away.

pws


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


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

* Re: HP-UX 11.00 tgetenv dilemma
  2001-06-12 16:04         ` Peter Stephenson
@ 2001-06-13  5:00           ` Bart Schaefer
  2001-06-13  5:35             ` Andrej Borsenkow
  0 siblings, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 2001-06-13  5:00 UTC (permalink / raw)
  To: Peter Stephenson, Zsh hackers list

On Jun 12,  5:04pm, Peter Stephenson wrote:
}
} "Bart Schaefer" wrote:
} > 
} > The remaining problem is that KSH_TYPESET should be set by `emulate bash',
} > which it is not because `emulate bash' is equivalent to `emulate sh'.
} 
} ...and we don't want to set it for that because it's apparently correct for
} the POSIX shell.

Does the POSIX shell even permit parm=value arguments to `export' and
`typeset'?  Maybe we're worrying about an impossibility.  We've rarely
hesitated to allow forward-compatible-only extensions (i.e., in the
emulated shell the extension would cause an actual syntax error) to
remain in effect even during `emulate -R', as we're mainly concerned
that scripts written *without* such extensions will work properly.

} Should we introduce a separate emulation for bash? It's getting
} horribly complicated and we've never been that concerned about bash
} compatilibity for non-POSIX features.

Hrm.  Either we should actually make it work, or we should document that
bash is not fully emulated (the way we document that csh is not fully
emulated).  Or both, as there are probably other bash-isms that we don't
emulate, though we have a whole lot of OPT_ALIAS things for bash.  Or
else remove `emulate bash' again and have only (|c|k|z)sh.

Doesn't seem like it's all that complicated to add another flag, though.

} By the way, bash also seems to have the equivalent of MAGIC_EQUAL_SUBST

Hrm, again.  I suppose we could special-case those two options in the
emulate() function when the argument is `bash', although their default
values would then appear reversed in the output from `setopt'.

-- 
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] 13+ messages in thread

* RE: HP-UX 11.00 tgetenv dilemma
  2001-06-13  5:00           ` Bart Schaefer
@ 2001-06-13  5:35             ` Andrej Borsenkow
  2001-06-13 13:04               ` Clint Adams
  0 siblings, 1 reply; 13+ messages in thread
From: Andrej Borsenkow @ 2001-06-13  5:35 UTC (permalink / raw)
  To: Zsh hackers list

> 
> Does the POSIX shell even permit parm=value arguments to `export' and
> `typeset'?

export name[=word]... 
export -p 
 
There is no typeset in POSIX.

-andrej


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

* Re: HP-UX 11.00 tgetenv dilemma
  2001-06-13  5:35             ` Andrej Borsenkow
@ 2001-06-13 13:04               ` Clint Adams
  0 siblings, 0 replies; 13+ messages in thread
From: Clint Adams @ 2001-06-13 13:04 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: Zsh hackers list


> export name[=word]... 
> export -p 
>  
> There is no typeset in POSIX.

But there is `readonly'

readonly name[=word]... 
readonly -p 


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

* Re: HP-UX 11.00 tgetenv dilemma
  2001-06-08  5:26 ` HP-UX 11.00 tgetenv dilemma Andrej Borsenkow
@ 2001-06-08 16:10   ` Bart Schaefer
  0 siblings, 0 replies; 13+ messages in thread
From: Bart Schaefer @ 2001-06-08 16:10 UTC (permalink / raw)
  To: ZSH Workers Mailing List

On Jun 8,  9:26am, Andrej Borsenkow wrote:
}
} [Moved to zsh-workers]
} 
} > 2. If the X-Open Standard is truely as HP claims, we can add
} > another #ifdef block to the existing TGETENT_ACCEPTS_NULL to
} > work with this situation.  Then we link with -lcurses as the
} > current configure script does.
} 
} Pretty hard to figure out automatically.

It actually shouldn't be all that difficult.  (The TGETENT_ACCEPTS_NULL
configure test is already going to be wrong for this case, BTW.)  If we
accept that "vt100" is sufficiently universal that it's guaranteed to
exist, which the accepts-null test seems to imply, then we just have to
do three tests:

	r1 = tgetent(buffer, "vt100")
	r2 = tgetent(buffer, "!@#$%^&*")
	r3 = tgetent(NULL, "vt100")

If (r1 == -1) we can't access the terminfo directory and we should give
up (bail out of configure with an error?).

If (r2 == -1) then we have the wierd HP-UX-11-style tgetent(), because
otherwise it ought to be == 0 (no cap file).

If (r3 == r1) then TGETENT_ACCEPTS_NULL.
 
} 3. Use setupterm if compiled with curses (or just if available) and tgetent
} otherwise. The above problem should happen only on systems with terminfo and
} setupterm must be there.

Please refer to zsh-workers/14061 for my concerns about setupterm().  I
still think it may be wrong even to call it from the terminfo module, and
I don't know what we should do about use_env().

-- 
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] 13+ messages in thread

* RE: HP-UX 11.00 tgetenv dilemma
       [not found] <20010602004009.8849.qmail@web12507.mail.yahoo.com>
@ 2001-06-08  5:26 ` Andrej Borsenkow
  2001-06-08 16:10   ` Bart Schaefer
  0 siblings, 1 reply; 13+ messages in thread
From: Andrej Borsenkow @ 2001-06-08  5:26 UTC (permalink / raw)
  To: ZSH Workers Mailing List, a normal guy

[Moved to zsh-workers]

>
> HP-UX 11.00 has two man pages discussing tgetent.  'man termcap'
> says:
>
> =======================================================(quote)
>         :
> tgetent()       ...tgetent() returns -1 if it cannot
>                 access the terminfo directory, 0 if there is no
>                 capability file for name, and 1 if all goes
> well.
>         :
> =======================================================(unquote)
>
> but 'man tgetent' says
>
>
> =======================================================(quote)
> 	:
> RETURN VALUE
>       Upon successful completion, functions that return an
>       integer return OK(0).  Otherwise, they return ERR(-1).
>
>       Functions that return pointers return a null pointer on
>       error.
> 	:
> =======================================================(unquote)
>
> The code in init.c, init_term() requires the man termcap
> functionality.  HP claims that the man tgetent functionality is
> the true X-Open Standard.  (I have not confirmed this.)
>

SUS says OK or ERR. It does not define the values. Interesting, I looked on
my own system and here manual says the same but tgetent() still works the
way zsh expects it.

> We can solve the problem in two ways.
>
> 1. If we link with -lHcurses, we get tgetent to return the
> expected 1 with success.  I suppose this would be done in the
> configure script.  This library may not be around for the
> future.
>
> 2. If the X-Open Standard is truely as HP claims, we can add
> another #ifdef block to the existing TGETENT_ACCEPTS_NULL to
> work with this situation.  Then we link with -lcurses as the
> current configure script does.
>

Pretty hard to figure out automatically.

3. Use setupterm if compiled with curses (or just if available) and tgetent
otherwise. The above problem should happen only on systems with terminfo and
setupterem must be there.

-andrej


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

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

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20010611165637.24436.qmail@web12503.mail.yahoo.com>
2001-06-11 18:24 ` HP-UX 11.00 tgetenv dilemma Andrej Borsenkow
2001-06-11 22:05   ` Export problem a normal guy
2001-06-11 22:52   ` HP-UX 11.00 tgetenv dilemma Bart Schaefer
2001-06-12 10:25     ` Peter Stephenson
2001-06-12 14:25       ` Bart Schaefer
2001-06-12 16:04         ` Peter Stephenson
2001-06-13  5:00           ` Bart Schaefer
2001-06-13  5:35             ` Andrej Borsenkow
2001-06-13 13:04               ` Clint Adams
2001-06-12 17:16       ` KSH_TYPESET Peter Stephenson
2001-06-12 17:22         ` KSH_TYPESET Peter Stephenson
     [not found] <20010602004009.8849.qmail@web12507.mail.yahoo.com>
2001-06-08  5:26 ` HP-UX 11.00 tgetenv dilemma Andrej Borsenkow
2001-06-08 16:10   ` Bart Schaefer

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